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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/09/06 15:58
Read: times


 
#119869 - Delay correct
Responding to: ???'s previous message
Hi. Yes. It works.

DJNZ is Decrement and Jump if Not Zero. Every time this instruction is executed decrements in one, the register you want starting at 255.

It also needs a relative, that is where do you want it to jump if it's not zero. I decided to jump to the same instruction so it will decrement until it reches 0.

When 0, it jumps to the next consecutive instruction. In this case, another DJNZ. When the second DJNZ is done it jumps to the routine once again.

This way you can make delays with the exact time you need.

You can give any value between 0 and 255 to the register you'll decrement.

Finally, this is for the 80c51 family... maybe in othe uC's it will be an infinite loop.... Not here.

List of 7 messages in thread
TopicAuthorDate
Serail Com codes            01/01/70 00:00      
   How do you Know            01/01/70 00:00      
   I solved the problem for Serial Comm            01/01/70 00:00      
   Delay            01/01/70 00:00      
      Sorry David, that's not correct.            01/01/70 00:00      
         Delay correct            01/01/70 00:00      
         David referred to...            01/01/70 00:00      

Back to Subject List