piclist 2001\02\15\132818a >
Thread: Inline delay code (was: LCD Problem Revisited)
www.piclist.com/techref/io/lcd/pic.htm?key=lcd
flavicon
face BY : mike@whitewing.co.uk



While we're on the subject of inline delays, here's a handy 'delay any
number of cycles' (within reason!) macro I did when messing with
generating TV timings :

usage : wait(n) delays n cycles, n = 0 to about 1024.


shortwait macro del  ; used by main wait macro
if (del>3) && (del<8)  call del7+(7-(del))
endif
 if del <4   if del>=2   goto $+1
 endif
 if ((del) & 1) == 1
 nop
 endif
endif
endm

; main macro - generates code to wait for (del) cycles)

wait macro del
if (del)<0
error 'negative delay'
endif
if (del)>=8  movlw ((del)-8) /4  call delay
shortwait ((del-8) % 4)  else
shortwait (del)
endif
endm

delay   addlw 0ff  skpnc  goto delay
return
del7 goto del5  ; 7 cycle delay
del6 goto del4  ; 6 cycle delay
del5 nop           ; 5 cycle delay
del4 return       ; 4 cycle delay

--
http://www.piclist.com hint: To leave the PICList
TakeThisOuTpiclist-unsubscribe-requestspamEraseMEmitvma.mit.edu


<1i5o8t4rajjc2746ksiqi22bk70h8vcfuc@4ax.com> quoted-printable

In reply to: <F51x53jn6kATsMmCh1r00014261@hotmail.com>
See also: www.piclist.com/techref/io/lcd/pic.htm?key=lcd
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) Inline delay code (was: LCD Problem Revisited)

month overview.

new search...