>How many processor cycles is this delay?
It will depend on what i is. Take a look at the generated assembly. For example, this is what I get with an int i.
Code:
stmt level source
1 void main(void)
2 {
3 1 int i;
4 1 for(i = 0; i < 16; ++i)
5 1 {
6 2 }
7 1 }
; FUNCTION main (BEGIN)
; SOURCE LINE # 1
; SOURCE LINE # 2
; SOURCE LINE # 4
;---- Variable 'i' assigned to Register 'R6/R7' ----
0000 E4 CLR A
0001 FF MOV R7,A
0002 FE MOV R6,A
0003 ?C0001:
; SOURCE LINE # 5
; SOURCE LINE # 6
0003 0F INC R7
0004 BF0001 CJNE R7,#00H,?C0005
0007 0E INC R6
0008 ?C0005:
0008 EF MOV A,R7
0009 6410 XRL A,#010H
000B 4E ORL A,R6
000C 70F5 JNZ ?C0001
; SOURCE LINE # 7
000E ?C0004:
000E 22 RET
; FUNCTION main (END)
Now comes the fun of looking up the instruction cycle times.
>Is there a more efficient way to create a delay in my embedded system?
Timer interrupts come to mind. You might find some useful information here.