How To See The Setting Of The Configuration Register
- Configuration $.25
- Configuration bits are a collection of specialized bits that tin can only be modified at programme time. Configuration bits are "read" during reset and enable or disable hardware features in the microcontroller. The features controlled past the configuration bits include, only are not limited to, the clock source, Watchdog Timer, Brown-Out observe, and Retention Read protection. Configuration bits are not executable code. Essentially, they are fuses located in the programme memory infinite.
How Configuration Bits are Set
Each Microchip device has its own ready of configuration bits. Individual device datasheets contain the definition for each of the bits. For instance, find configuration fleck information in the "Special Features" section of nearly PIC® MCU datasheets.
The setting for each configuration bit can be determined by directives written in the application software. The syntax for the configuration fleck settings is bachelor from the compiler or associated library transmission. For example, the MPLAB® XC8 compiler transmission contains information on setting configuration bits using #pragma, whereas to the AVR® Libc manual contains information on setting fuses (avr/fuse.h) and lockbits (avr/lock.h) using macros.
This tutorial volition evidence how to generate the proper configuration lawmaking without consulting the compiler manual for the proper syntax.
How to Display the Configuration Bits Window
From the main menu, select Window > Target Memory Views > Configuration $.25. The Configuration $.25 window volition open in a tab in the Output area under the editor.
Note: Read Device Retentiveness is required for AVR and SAM devices to ensure correct configuration bit values before editing. When device memory is read, the window text changes from red to black.
How to Set Configuration Bits
In the Configuration Bits window, click on any value in the Options cavalcade and it will turn into a philharmonic box that will allow you to select the value you desire. The case below shows the Watchdog Timer changed from enabled to disabled.
How to Generate Initialization Code
Although you can read, change, and write device configuration bits using the Configuration Bits window, these settings will simply utilize to the current device. To ensure any device programmed with the awarding volition have the correct setup of configuration bits, controls on the window tin generate lawmaking to be placed in your application.
Notation: The code generation feature is currently not available for SAM devices using the Arm GCC compiler.
1
Click on the Generate Source Lawmaking to Output push button.
ii
The IDE will automatically generate the lawmaking necessary to initialize all the configuration $.25 to the settings you specified in the window. This code may now exist copied and pasted into 1 of your source files, or y'all may salve information technology to its ain file and add it to your project. To salvage the file, correct click anywhere in the Output window and select Save As from the popup carte.
iii
This lawmaking may optionally be inserted into the source file focused in the Editor. To insert the code, correct click in the Configuration Bits window and select Insert Source Lawmaking in Editor from the popup menu. The Toolbar push button volition too insert the code.
How To See The Setting Of The Configuration Register,
Source: https://microchipdeveloper.com/mplabx:view-and-set-configuration-bits
Posted by: salinasdelitth.blogspot.com
0 Response to "How To See The Setting Of The Configuration Register"
Post a Comment