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

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053A-page 36
 2012 Microchip Technology Inc.
2.5.13.4
CAVEATS
With XC8, the __section() specifier cannot be used with any interrupt function.
2.5.14
Specifying Configuration Bits
The #pragma config directive may be used to program the configuration bits for a 
device. The pragma has the form:
#pragma config setting = state|value
where setting is a configuration setting descriptor (e.g., WDT), state is a descriptive 
value (e.g., ON) and value is a numerical value.
Use the native keywords discussed in the Differences section to look up information on 
the semantics of this directive.
2.5.14.1
EXAMPLE
The following shows configuration bits being specified using this pragma.
#pragma config WDT=ON, WDTPS = 0x1A
2.5.14.2
DIFFERENCES
The 8-bit compilers have used the __CONFIG() macro for some targets that did not 
already have support for the #pragma config.
The 16-bit compilers have used a number of macros to specify the configuration set-
tings.
The 32-bit compilers supported the use of #pragma config. 
2.5.14.3
MIGRATION TO THE CCI
For the 8-bit compilers, change any occurrence of the __CONFIG() macro, such as
__CONFIG(WDTEN & XT & DPROT)
to the #pragma config directive, as in
#pragma config WDTE=ON, FOSC=XT, CPD=ON
No migration is required if the #pragma config was already used.
For the 16-bit compilers, change any occurrence of the _FOSC() or _FBORPOR() 
macros attribute, as in the following example:
_FOSC(CSW_FSCM_ON & EC_PLL16);
to:
#pragma config FCKSMEM = CSW_ON_FSCM_ON,  FPR = ECIO_PLL16
No migration is required for 32-bit code.
2.5.14.4
CAVEATS
None.
2.5.15
Manifest Macros
The CCI defines the general form for macros that manifest the compiler and target 
device characteristics. These macros can be used to conditionally compile alternate 
source code based on the compiler or the target device.
The macros and macro families are details in Table 2-1.
TABLE 2-1:
MANIFEST MACROS DEFINED BY THE CCI
Name
Meaning if defined
Example
__XC__
Compiled with an MPLAB XC compiler
__XC__