please dont rip this site

PIC Microcontroller IO ISR Timing Method

Compinsating for ISR time loss in a time sensitve main code loop

Drew Vassallo says:

Just looking through my code to try to reduce some cycles and came up with this method for compensating for lost time during ISR servicing.

If you're doing a PWM loop or otherwise performing some loop count timing and get interrupted, you might be able to compensate for the lost time with:

;; No context saving required.
btfsc   flag, 0    ; to indicate whether or not you're inside PWM loop
decfsz  counter    ; loop counter for PWM
retfie
incfsz  counter
retfie

Note that the last incfsz (not incf!) is needed so your counter doesn't go below zero, which could hurt if you're using decfsz to monitor your loop counter. It would never skip the last retfie.

Of course, the path through the ISR has to be equal in time to the time through one PWM loop for this to be at all valuable.

Just thought I'd throw it out there as a useful snippet if anyone is intersted.

See also:

Comments:


file: /Techref/microchip/isrdelaycomp.htm, 1KB, , updated: 2014/11/10 16:22, local time: 2024/10/13 20:19,
TOP NEW HELP FIND: 
44.192.95.161:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©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://piclist.com/techref/microchip/isrdelaycomp.htm"> Compinsating for ISR time loss in a time sensitve main code loop</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 massmind.org, 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 piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .