piclist 2002\08\05\180149a >
Thread: : Delay loops
www.piclist.com/techref/microchip/time.htm?key=delay
face picon face BY : Jinx email (remove spam text)



>  bsf PORTB, 4
>  bsf PORTB, 1  ;---------------------
>  ; delay for at least 2ms
>  movlw 0x95
>  movwf Dlay
>  movlw 0x02
>  movwf Dlay + 1

>  decfsz Dlay
>   goto $ - 1

>  decfsz Dlay + 1
>   goto $ - 3

Hi Mike, the problem is that the inner loop (decfsz Dlay, goto $-1) is
being executed only twice. So your total delay is $195, not $295, or
770us short. Make it MOVLW 0x03, MOVWF Dlay+1 and you'll be
in business

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


<002201c23ccb$91138b40$679ca7cb@joe> 7bit

See also: www.piclist.com/techref/microchip/time.htm?key=delay
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) : Delay loops

month overview.

new search...