Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/27/02 12:48
Read: times


 
#33287 - RE: delay code help!
There is a mistake in the code you provided.

If you want to use 3 registers for any delay then you create 3 loops, one complete under another. Such as

Loop1:
code... such as mov reg1,#value

Loop2:
code... such as mov reg2,#value

Loop3:
code... such as mov reg3,#value

djnz reg3 to loop3 instruction

djnz reg2 to loop2 instruction

djnz reg1 to loop1 instruction,

To understand; same as we PUSH and POP from the stack.

loop3 will be running the most as lsb and loop1 will be running the least as msb.

Each djnz instruction takes 3 instruction cycles, means 36 clock cycles, or 3uS in case you are using 12MHZ with standard 8051/52.

This way you can calcualte the required delay/value.

Goodluck.

Rauf

List of 9 messages in thread
TopicAuthorDate
delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      
RE: delay code help!            01/01/70 00:00      

Back to Subject List