Title |
Title
Saving and Restoring Status on Interrupt
|
---|---|
Name |
Name
AN534
|
Date |
Date
06/24/2015
|
Description |
Description
The PIC17C42 has a 16 level deep hardware stack. The program counter is pushed into this stack on interrupts and subroutine calls. However, other key registers are not saved to the stack. Registers such as WREG, ALUSTA (which has carry, zero and other flag bits) and the bank select register (BSR) must be saved in an interrupt service routine. The following macros, PUSH and POP implement a parameter stack in data memory to save these register values. The indirect addressing register, FSR0, is used to implement this parameter stack. It is assumed that FSR0 and its control bits are not used or modified elsewhere. The stack pointer (FSR0) is initialized at the
|