| ??? 01/25/03 23:55 Read: times |
#37275 - RE: The Generic delay loop |
With calculator from the web page..
Set Freq at - 12000000 Set Bus Divide = 12 Set Entry A = 100 Set N constant = 248 Inner Loop NOPs = 2 Outter Loop NOPs = 1 One Time NOPs = 0 You get a total delay of 0.100002 seconds. In other words, configured this way the subroutine is a generic 1 mSec delay routine with the total delay up to 255 mSec specified by the entry A value. I posted this example particularly so that persons new to 8051 assembly language programming can better see how to interpert the delay loop calculator I have linked on the previous port to this thread. Michael Karas Here is what that subroutine would look like: Delay: push acc mov a,#248 DelayLp: nop nop djnz acc, DelayLp nop pop acc djnz acc, Delay ret This type of subroutine is nice becasue it does not use any registers, will work nicely without regard to register bank settings and can be called only by having to setup one register, namely A. Michael Karas |
| Topic | Author | Date |
| Basic Delay Commands Use | 01/01/70 00:00 | |
| RE: Basic Delay Commands Use | 01/01/70 00:00 | |
| RE: The Generic delay loop | 01/01/70 00:00 | |
| RE: Basic Delay Commands Use | 01/01/70 00:00 | |
RE: Basic Delay Some Way | 01/01/70 00:00 |



