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" 
		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 


file: /Techref/microchip/delay/xb1cr-ba.htm, 1KB, , updated: 2007/6/22 14:05, local time: 2024/11/22 06:00,
TOP NEW HELP FIND: 
18.191.129.241: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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/Techref/microchip/delay/xb1cr-ba.htm"> 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?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .