3.15 __nested Keyword
The IAR __nested
keyword enables interrupts in the prologue of an interrupt
handler, that is it allows nested interrupts to occur.
Suggested Replacement
There is an MPLAB XC8 attribute and specifier that together perform a similar tasks to this keyword.
Use the MPLAB XC8 interrupt
attribute in addition to the
__interrupt(number)
specifier. The
ISR_NOBLOCK
macro can be used as an alias for
__attribute__((interrupt))
if preferred.
Caveats
The Common C Interface must be enabled using -mext=cci
to use the
__interrupt
qualifier.
Examples
volatile int x;
#pragma vector=2
void __nested __interrupt incIsr(void) {
x++;
}
to
MPLAB XC8 code similar
to:#include <xc.h>
volatile int x;
void __attribute__((interrupt)) __interrupt(2) incIsr(void) {
x++;
}
Further Information
See the Interrupts section in the MPLAB XC8 C Compiler User's Guide for AVR MCUs for more information on writing interrupt functions.