"Configuration Bits" Registers

These settings are saved in a special portion of flash memory, and are loaded at the moment power is applied to the microcontroller. By having them instantly available at power-on, we don’t need to waste time and processor cycles setting up the oscillator in our application code.

The configuration bits are defined using “#pragma config” statements using the MPLAB® C Compiler for PIC32 MCUs.

It is important to first define the signal source for the Primary Oscillator and the target system clock frequency. Following the guidelines in the datasheet, you can then determine the divider values and PLL multipliers required.

The “#pragma config” statements do not generate any executable code. Rather they define a word that is to be written into the appropriate configuration register address that matches the desired configuration option. This word will be written into the PIC32's flash memory when the device is programmed and is stored in the application's ‘.hex’ file generated by MPLAB® IDE.

To determine which options are allowed with the “#pragma config” statements refer to the ‘hlpPIC32MXConfigSet.chm’ file, and search for the exact PIC32 microcontroller you are using.

​

​

Refer to "C:\Program Files\Microchip\xc32\<ver>\docs\PIC32ConfigSet.html" for a listing of all #pragma config macros available for your MCU.

​

Refer to the "Special Features" section of the MCU data sheet to learn about all the configurable hardware options on the device.

OSCCON and OSCTUN SFRs

During run-time, it is possible to change the clock source, modify the oscillator settings, check the status of the various oscillator sources, and determine whether the PLLs are locked.

Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.

Click here to edit contents of this page.

Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.

Append content without editing the whole page source.

Check out how this page has evolved in the past.

If you want to discuss contents of this page - this is the easiest way to do it.

View and manage file attachments for this page.

A few useful tools to manage this Site.

See pages that link to and include this page.

Change the name (also URL address, possibly the category) of the page.