Professional Documents
Culture Documents
the ISR, is the code that receives control upon occurrence of the
interrupt. Most of the programming that goes into the service
routine is specific to the application; however, there are certain
housekeeping operations that should be included. The following
list describes the structure of an interrupt service routine for the
mid-range PICs:
1. Preserve the value in the w register.
2. Preserve the value of the STATUS register.
3. Execute the application-specific operations.
4. Restore the value of the STATUS register at the time of the
interrupt.
5. Restore the value of the w register at the time of the interrupt.
6. Issue the RETFIE instruction to end the interrupt handler.
In the PIC 16F84, the interrupt service routine must be located at
offset 0x004 in
code memory. A simple org directive takes care of ensuring this
location, as in the following code fragment: