4.8 Interrupts
The MPLAB XC8 compiler incorporates features allowing interrupts to be fully handled from C code. Interrupt functions are often called Interrupt Service Routines, or ISRs.
The compiler can generate code for projects using the full AVR interrupt vector table, where each interrupt source has a corresponding interrupt number and entry in the vector table, and the hardware executes the instruction at the entry matching the interrupt source. Check your device data sheet to see how interrupts operate and can be configured.
Alternatively, for those devices that support the Compact Vector Table (CVT) feature, the project can be configured to use a four-entry vector table. This feature forces all level 0 interrupt sources to share the same interrupt vector number. Thus, the interrupts generated by all these sources share the same ISR, reducing the project's memory footprint. This feature is most suitable for devices with limited memory and applications using a small number of interrupt sources. Note, however, that since additional code might be needed in the ISR to determine the interrupt source, the response time of the ISR could be longer.
- Reset
- Non-maskable interrupts (NMI)
- Priority Level 1 (LVL1) interrupts
- Priority level 0 (LVL0) interrupts