3.6.1 Configuring Fuses Using XC8 Configuration Bits

To configure the fuses with the MPLAB X IDE, configuration pragmas can be used. More information about the compiler and the configuration bits of the desired device can be found by accessing the Compiler Help – the blue question mark from the MPLAB X IDE project dashboard, as presented in Figure 3-4.

Figure 3-4. Accessing Compiler Help

The configuration settings for all supported devices are presented at Configuration Settings Reference → 8-bit AVR MCUs, as shown in Figure 3-5.

Figure 3-5. Compiler Help → 8-bit Language Tools Readme and Reference

The configuration pragmas can be used as presented below.

#pragma config <setting> = <named value | literal constant>

The following example shows how to disable the Watchdog Timer and the CRC and to configure the start-up time to be 8 ms, using configuration pragmas.

/* Disable Watchdog Timer */
#pragma config PERIOD = PERIOD_OFF
/* Disable CRC and set the Reset Pin Configuration to GPIO mode */
#pragma config CRCSRC = CRCSRC_NOCRC, RSTPINCFG = RSTPINCFG_GPIO
/* Start-up Time select: 8 ms */
#pragma config SUT = SUT_8MS