Searching \ for 'long delay loops' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/timers.htm?key=delay
Search entire site for: 'long delay loops'.

Truncated match.
PICList Thread
'long delay loops'
1998\06\08@062043 by Gavin Jackson

flavicon
face
Hi there

I was playing around with some long delays and
decided to get a formula for working out some of
the delays, instead of just trying random values
to get the desired delay.
The following code contains three loops with
different values. The code is called with the
value for DEL1 in w. This code includes the
call and return clock cycles in the formula.
Note that when F8 (step through) is used the
stopwatch shows an extra clock cycle, that
should not be there. If you step through the
delay you get the correct number of steps.

e.g..           SOME INSTRUCTION
               MOVLW   ??H <- use your DEL1 value
               CALL            DELAY1
               NEXT INSTRUCTION AFTER DELAY

DELAY1  MOVWF   DEL1
LOOP1           MOVLW   ??H <- use your DEL2 value
               MOVWF   DEL2
LOOP2           MOVLW   ??H <- use your DEL3 value
               MOVWF   DEL3
               DECFSZ  DEL3,F
               GOTO    $-1
               DECFSZ  DEL2,F
               GOTO            LOOP2
               DECFSZ  DEL1,F
               GOTO            LOOP1
               RETURN

The delay in clock cycles is:
4*(1 + DEL1 + DEL1*DEL2) + 3*DEL1*DEL2*DEL3

Regards

Gavin
--------------------------
spam_OUTvulcanTakeThisOuTspamihug.co.nz
www.geocities.com/TheTropics/Cabana/2625
--------------------------

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...