please dont rip this site

Microchip PIC Delay Code Generator


Delay

Instruction cycles

Seconds

Temporary registers names

Clock frequency

MHz

Generate routine   
Select CPU:    PIC    SX
 

For long delays (> 10 cycles) the code is based on nested loops using 'decfsz' and 'goto' instructions. Small delays are built using 'goto $ + 1' (2 cycles delay) and 'nop' (one cycle delay).

To calculate nested loop counter values the code generator uses an optimum search algorithm. The algorithm finds such values for counters that achieve good approximation to the specified delay.

Even if there is an error in the first block of nested loops, the rest of the code fixes that. As a result, one cycle resolution is achieved.

Idea: James Newton
Implementation: Nikolai Golovchenko

This application is mirrored at:

Also:

See:

See also:

Questions:

Daniel Chia Jin Hao Says:

For PIC18, this delay routine will need a little modification to work properly.. the goto $+1 within the delay loops that sometimes appears needs to be changed to goto $+6, since each program word is 2 bytes, and goto is a 4 byte instruction. Also, at the end sometimes goto $+1 is used as a 2 cycle delay, need to use goto $+4 to skip over the whole goto.

I hope this is correct, AFAIK it is.
+

Comments:


file: /Techref/piclist/codegen/delay.htm, 6KB, , updated: 2014/4/19 01:02, local time: 2014/12/22 19:53,
TOP NEW HELP FIND: 
54.226.136.179:LOG IN

 ©2014 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://www.piclist.com/techref/piclist/codegen/delay.htm"> Microchip PIC, ASM Delay Code, Code Generator </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 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 2014 contributors:
o List host: MIT, Site host massmind.org, Top posters @20141222 RussellMc, Richard R. Pope, IVP, John Gardner, alan.b.pearce, James Cameron, Bob Blick, David C Brown, Josh Koffman, Isaac Marino Bavaresco,
* 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 www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .