PDA

View Full Version : Interrupts - again



Charles Linquis
- 3rd July 2006, 23:58
I have been going back and forth through the various assembly-language interrupt routines for PBP, but I keep getting confused.

I'm using 18F parts. Can anyone tell me exactly which registers I must save and restore when writing an ISR that is entirely in assembly?

STATUS, W?
STATUS, W, PCLATH, FSR0? More?

SteveB
- 4th July 2006, 00:53
Charles,
You only need to save the value of registers that your ISR may change. The datasheet for the 18F series has an example for what would be considered as a bare minimum:


MOVWF W_TEMP ; W_TEMP is in virtual bank
MOVFF STATUS, STATUS_TEMP ; STATUS_TEMP located anywhere
MOVFF BSR, BSR_TEMP ; BSR_TMEP located anywhere
;
; USER ISR CODE
;
MOVFF BSR_TEMP, BSR ; Restore BSR
MOVF W_TEMP, W ; Restore WREG
MOVFF STATUS_TEMP, STATUS ; Restore STATUS
You may also need to save the PCL related registers and any FSRs you intend to use. So...

Can anyone tell me exactly which registers I must save and restore when writing an ISR that is entirely in assembly?
No. Unless, of course, you posted your code. However, your question may be more appropriate on the Microchip forum vs. the PIC BASIC pro forum;). You may even find your answer there with a little searching.

Steve