View Single Post
  #2   Spotlight this post!  
Unread 02-12-2003, 02:54
JimWright949's Avatar
JimWright949 JimWright949 is offline
The Owen Day of Seattle
AKA: Jim Wright
FRC #4542 (Titanium Talons)
Team Role: Mentor
 
Join Date: Sep 2003
Rookie Year: 2003
Location: Redmond, WA
Posts: 94
JimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to behold
Re: Problem with interrupts on the PIC

There are two ways to handle this.

If you are writing code in C use the #pragma interrupt InterruptHandlerLow according top the Microchip C compiler ref' doc:
http://www.microchip.com/download/to...b18/51288b.pdf
the basic context should be saved for you.

In assembler the code to do this is:
MOVWF W_TEMP ; W_TEMP is in virtual bank
MOVFF STATUS, STATUS_TEMP ; STATUS_TEMP located anywhere
MOVFF BSR, BSR_TEMP ; BSR located anywhere
;
; USER ISR CODE
;
MOVFF BSR_TEMP, BSR ; Restore BSR
MOVF W_TEMP, W ; Restore WREG
MOVFF STATUS_TEMP,STATUS ; Restore STATUS

Which is found at the end of section 9 of the Pic18F8520 data sheet.

-Jim