Searching \ for 'delay loop analysis' 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: 'delay loop analysis'.

Truncated match.
PICList Thread
'delay loop analysis'
1996\05\15@103150 by Harrison Cooper

flavicon
face
Can someone tell me if this loop really is 1000 states ?
It appears (in the part), to run about 4x the length. Its
intended to be a 1 second delay.  I did measure the clock,
and its actual value (on pin 15 of a C84) is about 833 Hz
or 1.2 mS, but not off by enough to throw this whole thing
off.  What am I missing in my calculations ?

spam_OUThcooperTakeThisOuTspames.com

; clock is 1mS
; total delay is 1000 states, or one second



DELAY_1S                        ; 1 second delay
       MOVLW   D'10'
       MOVWF   OUTSIDE
LD_INSIDE_1S
       MOVLW   D'19'
       MOVWF   INSIDE
REPEAT_1S
       NOP                     ; A total of 5 states x 19 = 95
       NOP                     ;  plus 5 states overhead = 100 states
       DECFSZ  INSIDE,1        ; decrement inside loop by one
       GOTO    REPEAT_1S       ;  and continue until zero
       DECFSZ  OUTSIDE,1       ; decrement outside loop by one
       GOTO    LD_INSIDE_1S    ; Reload inside loop
       RETLW   0               ;  else return

1996\05\15@105119 by Chaipi Wijnbergen

flavicon
picon face
Dear Mr. Cooper,

PIC devices execute instructions using FOsc/4. Does it make more sens now ?

Chaipi



On Wed, 15 May 1996, Harrison Cooper wrote:

{Quote hidden}

1996\05\15@133839 by Norm Cramer

flavicon
face
The easy way to test this is to run it in MPSIM.  It will tell you exactly
how many clocks your code is taking.  Dont forget to account for the call,
goto, and return taking 2 cycles.  It also looks like you did not account
for the fact that the goto's are not executed on the last pass thru the
loops.  This is negligable for the outer loop but significant for the inner
loop.

BTW Andrew Warren has a quick basic program that does all of the work for
you in writting code that takes a specific number of cycles.  I don't have
his web page address handy but some one else is sure to provide it.

Hope this helps.

Norm

At 08:32 AM 5/15/96 -0600, you wrote:
{Quote hidden}

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