I am about to do my first design with an enhanced 16F PIC microcontroller. I have a question regarding automatic context save & restore that occurs when an Interrupt is triggered.
Specifically, how many instruction periods does an enhanced PIC16F microcontroller such as the PIC16F1782 require to perform the automatic context save when an interrupt is triggered?
Older 16F PICs without automatic context save require 2 instruction periods to jump to the Interrupt vector and an additional 2 instruction periods to return from Interrupt. Context save within the ISR requires a minimum of 3 instruction periods to save W & Status and context restore when exiting the ISR requires a minimum of 4 instruction periods to restore Status & W.
The datasheet for an enhanced 16F PIC (PIC16F1782) says that all of the following registers are automatically saved in shadow registers when the Interrupt is triggered and restored when the Interrupt Return is executed:
• W register
• STATUS register (except for !TO and !PD)
• BSR register
• FSR registers
• PCLATH register
However, the datasheet doesn't state how much extra time (if any) is consumed by this context save and restore. The closest thing I can find is in the Instruction Set Summary (Table 29-3 on page 344 of the PIC16F1782 datasheet – DS40001579E) which states that RETFIE requires 2 instruction periods (same as the older 16F PICs)..
I have learned the hard way that sometimes the Microchip data sheet isn't always complete.
Best Answer
The information I was looking for is in the datasheet - just not quite where I expected it.
Section 8.2 of the PIC16F1782 datasheet (page 75 of document DS40001579E) states:
This information allows me to determine the maximum time that will elapse before my ISR is executed.