Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
Common C Interface
 2012 Microchip Technology Inc.
DS52053A-page 31
2.5.9
EEPROM Objects
The __eeprom qualifier may be used to indicate that variables should be positioned in 
EEPROM.
Use the native keywords discussed in the Differences section to look up information on 
the semantics of this qualifier.
Some devices may not implement EEPROM. Use of this qualifier for such devices will 
generate a warning. Stack-based (auto and parameter) variables cannot use the 
__eeprom
 specifier.
2.5.9.1
EXAMPLE
The following shows a variable qualified using __eeprom.
__eeprom int serialNos[4];
2.5.9.2
DIFFERENCES
The 8-bit compilers have used the qualifier, eeprom, to indicate this meaning for some 
devices.
The 16-bit compilers have used the space attribute to allocate variables to the memory 
space used for EEPROM.
2.5.9.3
MIGRATION TO THE CCI
For 8-bit compilers, change any occurrence of the eeprom qualifier, as in the following 
example:
eeprom
 char title[20];
to __eeprom, i.e., __eeprom char title[20];
For 16-bit compilers, change any occurrence of the eedata space attribute, as in the 
following
int mainSw __attribute__ ((space(eedata)));
to
int __eeprom mainSw;
2.5.9.4
CAVEATS
XC8 does not implement the __eeprom qualifiers for any PIC18 devices; this qualifier 
will work as expected for other 8-bit devices.
2.5.10
Interrupt Functions
The __interrupt(type) specifier may be used to indicate that a function is to act 
as an interrupt service routine. The type is a comma-separated list of keywords that 
indicate information about the interrupt function.
The current interrupt types are:
<empty> 
Implement the default interrupt function
low_priority 
The interrupt function corresponds to the low priority interrupt source (XC8 – PIC18 
only)
high_priority 
The interrupt function corresponds to the high priority interrupt source (XC8)