7.3 Configuration Bit Access
The #pragma config directive specifies the Configuration Words to be
programmed into the device running the application. This pragma can be used with either
C or C++ programs.
All 32-bit target devices have several Configuration Words. The bits within these words control fundamental device operation, such as the oscillator mode, watchdog timer, programming mode and code protection. Failure to correctly set these bits may result in code failure, or a non-running device.
config pragma has the following general
form:#pragma config setting = valuewhere
setting is a configuration word bit-field name
(e.g., WDT_ENABLE) and value can be
either a textual description of the desired state (e.g., CLEAR) or a
numerical value, as required by the setting. Multiple pragmas may be used to
incrementally specify the complete device state; however, more than one comma-separated
setting-value pair may be specified with each pragma.Refer to the PIC32ConfigSet.html file, located in Program Files/ Microchip/ <install-dir>/<version>/docs/PIC32ConfigSet.html for the setting/value pairs relevant for your target device.
Configuration settings may be specified with multiple #pragma config
directives. The compiler verifies that the configuration settings specified are valid
for the processor for which it is compiling. If a given setting in the Configuration
word has not been specified in any #pragma config directive, the bits
associated with that setting default to the unprogrammed value. Configuration settings
should be specified in only a single translation unit (a C/C++ file with all of its
include files after preprocessing).
For each Configuration word for which a setting is specified with the #pragma
config directive, the compiler generates a read-only data section named
.config_address, where address is the
hexadecimal representation of the address of the Configuration word. For example, if a
configuration setting was specified for the Configuration word located at address
0xBFC02FFC, a read-only data section named
.config_BFC02FFC would be created.
