ark5230
Advanced Member level 3
I am trying to get delay of one second using nested loops in 8051 assembly, use of timer will simplify this but it is required to do it this way!
Is this calculation OK ?
In implementation it is taking around 10 seconds instead of one second.
WAIT: MOV R2,#46
HERE1: MOV R3,#100
HERE2: MOV R4,#100
HERE3: DJNZ R4,HERE3
DJNZ R3,HERE2
DJNZ R2,HERE1
RET
Calculated time Micro sec 1030901
Sec 1.0309
Exec is number of time it is executed
M/C is the machine cycles used
Tot M/C is total machine cycles required
Clock is 11.0592 MHz (M/C is 1.085µs)
Is this calculation OK ?
In implementation it is taking around 10 seconds instead of one second.
WAIT: MOV R2,#46
HERE1: MOV R3,#100
HERE2: MOV R4,#100
HERE3: DJNZ R4,HERE3
DJNZ R3,HERE2
DJNZ R2,HERE1
RET
Calculated time Micro sec 1030901
Sec 1.0309
Exec is number of time it is executed
M/C is the machine cycles used
Tot M/C is total machine cycles required
Clock is 11.0592 MHz (M/C is 1.085µs)
Last edited: