please dont rip this site

PIC Microcontoller Delay Method

Bob Ammerman [RAMMERMAN at PRODIGY.NET] says:

I prefix my N*3 delay routine with a few instructions and branch to the right one for the desired delay.
DELAY   macro count
        local next
        local n
n =  (count)

        if n < D'1' 
		error "Delay count less than 1" 
	if n < D'4' 
		if (n & 1) 
		if (n & 2) 
			goto next 
	if n <= D'7' 
		call delay4-(n-4) 
	movlw (n-D'5')/D'3' 
	call delay_3W_p4-((n+1) % 3) 

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 

file: /Techref/microchip/delay/xb1cr-ba.htm, 1KB, , updated: 2007/6/22 15:05, local time: 2024/6/19 04:21,

 ©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?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> PIC Microcontoller, Delay Method, Bob Ammerman</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!