Microchip Technology SW006022-2N Data Sheet

Page of 338
Common C Interface
 2012 Microchip Technology Inc.
DS52071B-page 45
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
#pragma config register = 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. The register token may represent a 
whole configuration word register, e.g., CONFIG1L.
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.