Mike Harrison [mike@WHITEWING.CO.UK] says:
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
file: /Techref/microchip/delay/xb0cr-mh.htm, 1KB, , updated: 2007/6/22 13:54, local time: 2024/12/26 11:52,
18.117.94.180:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/Techref/microchip/delay/xb0cr-mh.htm"> Delay X cycles (0-1024) macro by Mike Harrison</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.