- The constants FSR0, FSR1 and FSR2, are only for use with the LFSR (Load File Select Register) opcode.
They equate to 0, 1 and 2 respectively.
Using them with MOVFF, causes it to save/restore the memory at locations 0, 1 and 2, which are normally PBP's system variables.
On 18F's, the FSR's have 12-bit addresses, so it takes 2-bytes to hold each one.
For FSR0, the actual values are in FSR0L and FSR0H. If you are saving them, you need to save both.
But you only need to save the FSR's if they are also used by the interrupt handler. If you're handler doesn't use them ... it's just waisting time.
- The MOVWF opcode, requires that the BANK be set first, but you can't set the bank at that point, because the BSR register hasn't been saved yet.
Use MOVFF WREG, wsave instead.
- If you are using High Priority interrupts? Then you don't need to save WREG, STATUS or BSR. They are automatically saved by the CPU when the interrupt occurs.
Then use RETFIE 1 (FAST return).
- You are calling routines with underscores in front of them.
You aren't calling BASIC code from an ASM interrupt are you?
Bookmarks