4.3 Accessing Advanced Code Security Configuration Bits Through MPLAB X

The ICSPDIS and SAFLOCK Configuration Bits of an 8-bit PIC microcontroller can be accessed through MPLAB X IDE. MPLAB X IDE provides a provision to read these Configuration Bits, and it is also capable of generating the #pragma directives that need to be included in the application firmware to configure these Configuration Bits on the microcontroller.

Note: Since the Configuration Bits are not executable code, they must be configured or modified at program mode/program time in the form of directives to the compiler using an external programmer and debugging tool via the ICSP interface.

In MPLAB X IDE, the Configuration Bits window features a drop-down menu for selecting a memory section from the available memory sections of the microcontroller, as shown in the Configuration Bits Window figure.

Figure 4-9. Configuration Bits Window
Tip: To open the Configuration Bits window in MPLAB X IDE, navigate to Production > Set Configuration Bits.
Tip: To open the Configuration Bits window in MPLAB X IPE, navigate to Window > Target Memory Views > Configuration Bits.

Since the ICSPDIS and the SAFLOCK Configuration Bits are OTP, they are listed in the “OTP Fuses” section of the Configuration Bits window.

CAUTION: Use extreme caution when using these Configuration Bits.
Important: MPLAB X IDE and MPLAB X IPE provide security against accidental writing of the OTP Fuses. To write to the OTP Fuses of the microcontroller, check the “Allow programming of OTP config memory” option under the “Program Options” of the external programmer and debugger tool settings, as shown in the Programmer and Debugging Tool Settings Window figure.
Figure 4-10. Programmer and Debugging Tool Settings Window
Tip:
  1. In MPLAB X IDE, to open the configuration settings window of a connected external programmer and debugger tool, navigate to Project > Properties > Conf, and select the connected programmer and debugger tool.
  2. The OTP Fuses configuration settings option is not available in MPLAB X when using the PIC18F56Q24 Curiosity Nano evaluation kit. For more information, refer to the Device Configuration Protection section of the PIC18F56Q24 Curiosity Nano User Guide.