'delay loop analysis'
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 ?
; clock is 1mS
; total delay is 1000 states, or one second
DELAY_1S ; 1 second delay
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
Dear Mr. Cooper,
PIC devices execute instructions using FOsc/4. Does it make more sens now ?
On Wed, 15 May 1996, Harrison Cooper wrote:
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
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.
At 08:32 AM 5/15/96 -0600, you wrote:
More... (looser matching)
- Last day of these posts
- In 1996
, 1997 only
- New search...