This is a multi-part message in MIME format. ------=_NextPart_000_01A1_01C0979D.BE19DEC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I have a variation on this that doesn't waste so much space by calling an N*4 delay routine followed by an invocation of the short delay macro. Instead, I prefix my N*3 delay routine with a few instructions and branch to the right one for the desired delay. See attached. (just hacked out of a working source file). Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) ------=_NextPart_000_01A1_01C0979D.BE19DEC0 Content-Type: application/octet-stream; name="delay.inc" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="delay.inc" DELAY macro count local next local n n = (count) if n < D'1' error "Delay count less than 1" exitm endif if n < D'4' if (n & 1) nop endif if (n & 2) goto next next endif exitm endif if n <= D'7' call delay4-(n-4) exitm endif movlw (n-D'5')/D'3' call delay_3W_p4-((n+1) % 3) endm DELAY2 macro first,last DELAY last-first+1 endm ; Delay Routine delay_3W_p6: ;3N+6 from here down (includes call and return) movwf temp0 ;{1} delay_3W_p5: ;3N+5 from here down (includes call and return) movwf temp0 ;{1} delay_3W_p4: ;3N+4 from here down (includes call and return) movwf temp0 ;{1} delay_loop: ;3N+1 from here down (includes return) decfsz temp0,F ;{N+1} loop eats 3N-1 goto delay_loop ;{2N-2} return ;{2} delay7: nop delay6: nop delay5: nop delay4: return end ------=_NextPart_000_01A1_01C0979D.BE19DEC0-- -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu