please dont rip this site

PIC Micro Controller

0/3260

Interrupt Service Routine Register State Maintenance

Tony Nixon quotes the Microchip datasheet for the 16f8xx (and Robert Rolf added comments):

movwf w_temp	;given multiple banks, and no global memory 
		;you need to make a w_temp in each because you cannot change status prior to saving it.
swapf status,w 	;The swapf instruction, unlike the movf, affects NO status bits, which is why it is used here.
clrf status	;point to bank 0 and clear all the flags
movwf status_temp
movf pclath,w	;save PCLath
movwf pclath_temp
clrf pclath	;assume that this ISR is in page 0
;bcf status,irp	;This bcf is redundant & unnecessary unless the clrf status (above) is removed
movf fsr,w
movwf fsr_temp

; ISR

;The example fails to restore FSR here.
;One should

movf fsr_temp,w
movwf fsr

;to complete the restore sequence.

movf pclath_temp,w
movwf pclath
swapf status_temp,w
movwf status
swapf w_temp
swapf w_temp,w

Tom Handley says:

...one of the nice things about the 16C76/77 and 16F876/877 devices is that the upper 16 Bytes are aliased to Bank 0. This is a good place to keep a copy of W, STATUS, PCLATH, FSR, etc, during an ISR routine.

Timer tutorial (incl prescalers) by Andrew Warren

David A Cary of Motorguide Pinpoint Says:

Up: PIC Micro Controller Interrupt Routine Library http://piclist.org/techref/microchip/ints.htm


file: /techref/microchip/isrregs.htm, 1KB, , updated: 2001/6/18 13:53, local time: 2008/5/16 23:49,
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/isrregs.htm"> Saveing register state in an Interrupt Service Routine</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 @20080516 Apptech, Xiaofan Chen, Jinx, David VanHorn, Bob Axtell, Alan B. Pearce, William \Chops\ Westfield, bean, Cedric Chang, 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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .