please dont rip this site

PIC Microcontoller Delay Method

0/2669

Delay X cycles (0-1024) macro by Mike Harrison

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 14:54, local time: 2008/7/5 15:33,
TOP NEW HELP FIND: 
38.103.63.16:LOG IN
©2008 PLEASE DON'T RIP! DO: LINK / DIGG! / MAKE!

 ©2008 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!
<A HREF="http://www.piclist.com/techref/microchip/delay/xb0cr-mh.htm"> Delay X cycles (0-1024) macro by Mike Harrison</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be reviewed) Just type in the box and press the Post button. (HTML welcomed!): 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: 
Did you find what you needed?

  PICList 2008 contributors:
o List host: MIT, Site host massmind.org, Top posters @20080705 Apptech, Jinx, Xiaofan Chen, Alan B. Pearce, David VanHorn, Bob Axtell, William \Chops\ Westfield, Cedric Chang, olin piclist, Gerhard Fiedler,
* 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: Shultz Electronics, Larry Williams, David VanHorn, Bryan Whitehouse, Timothy Weber, David Challis. Peter Todd. on-going support is MOST appreciated!
* Contributors: Neil Narwani, David Cary, Elemer AM Nyiry, Philip J Taylor, Gus Calabrese of Omegadogs.com, Gautama Venegas, Patrick B. Murphy, William Chops Westfield, Peter Todd, Leslie Ellis
  'What can I do?' - SiCKO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .