Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053A-page 32
 2012 Microchip Technology Inc.
save(symbol-list) 
Save on entry and restore on exit the listed symbols (XC16)
irq(irqid) 
Specify the interrupt vector associated with this interrupt (XC16)
altirq(altirqid) 
Specify the alternate interrupt vector associated with this interrupt (XC16)
preprologue(asm) 
Specify assembly code to be executed before any compiler-generated interrupt code 
(XC16)
shadow 
Allow the ISR to utilise the shadow registers for context switching (XC16)
auto_psv 
The ISR will set the PSVPAG register and restore it on exit (XC16)
no_auto_psv 
The ISR will not set the PSVPAG register (XC16)
Use the native keywords discussed in the Differences section to look up information on 
the semantics of this specifier.
Some devices may not implement interrupts. Use of this qualifier for such devices will 
generate a warning. If the argument to the __interrupt specifier does not make 
sense for the target device, a warning or error will be issued by the compiler.
2.5.10.1
EXAMPLE
The following shows a function qualified using __interrupt.
__interrupt(low_priority) void getData(void) {
if (TMR0IE && TMR0IF) {
TMR0IF=0;
++tick_count;
}
}
2.5.10.2
DIFFERENCES
The 8-bit compilers have used the interrupt and low_priority qualifiers to indi-
cate this meaning for some devices. Interrupt routines were by default high priority.
The 16- and 32-bit compilers have used the interrupt attribute to define interrupt 
functions.
2.5.10.3
MIGRATION TO THE CCI
For 8-bit compilers, change any occurrence of the interrupt qualifier, as in the 
following examples:
void interrupt myIsr(void)
void interrupt low_priority myLoIsr(void)
to the following, respectively
void __interrupt(high_priority) myIsr(void)
void __interrupt(low_priority) myLoIsr(void)
For 16-bit compilers, change any occurrence of the interrupt attribute, as in the fol-
lowing example:
void __attribute__((interrupt,auto_psv,(irq(52)))) myIsr(void);