User manual

MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 212 2012 Microchip Technology Inc.
5.14.3 Predefined Macros
The compiler drivers define certain symbols to the preprocessor, allowing conditional
compilation based on chip type, etc. The symbols listed in Table 5-12 show the more
common symbols defined by the drivers.
TABLE 5-12: PREDEFINED MACROS
Symbol When set Usage
__CHIPNAME When chip selected To indicate the specific chip type
selected, e.g., __16F877
__DATABANK If eeprom or flash memory imple-
mented
Identifies which bank the EED-
ATA/PMDATA register is found
__DATE__ Always To indicate the current date, e.g.,
May 21 2004
__FILE__ Always To indicate this source file being
preprocessed.
__FLASHTYPE If flash memory is implemented To indicate the type of flash mem-
ory employed by the target
device, see _PROGMEM below.
__LINE__ Always To indicate this source line
number.
__J_PART If PIC18 device Indicates device a ’J’ series part
__MPLAB_ICDX__ If compiling for MPLAB
®
ICD or
MPLAB ICD 2/3 debugger
(where X is empty, 2 or 3.
Assigned 1 to indicate that the
code is generated for use with the
Microchip MPLAB ICD,ICD 2 or
ICD 3.
__MPLAB_PICKITX__ If compiling for MPLAB
®
PICKIT
2/3
Assigned 1 to indicate that the
code is generated for use with the
Microchip MPLAB PICKIT 2 or
PICKIT 3
__MPLAB_REALICE__ If compiling for MPLAB
®
REALICE
Assigned 1 to indicate that the
code is generated for use with the
Microchip MPLAB REALICE.
__RESETBITS_ADDR If --RUNTIME option request
STATUS register save
Indicates the address at which
the STATUS register will be saved
__TIME__ Always To indicate the current time, e.g.,
08:06:31.
__XC Always Indicates MPLAB XC compiler for
Microchip in use.
__XC8 Always Indicates MPLAB XC compiler for
Microchip 8-bit devices in use.
__XC8_VERSION Always To indicate the compiler’s version
number multiplied by 1000, e.g.,
v1.00 will be represented by
1000.
_CHIPNAME When chip selected To indicate the specific chip type
selected, e.g., _16F877
_BANKBITS_ Always Assigned 0, 1 or 2 to indicate 1, 2
or 4 available banks or RAM.
_BANKCOUNT_ Always To indicate the number of banks
of data memory implemented.
_COMMON_ If common RAM present To indicate whether device has
common RAM area.