What Are the Configuration Bits? They are a collection of special bits that can only be modified at program time. Configuration bits are “read” during reset and enable or disable hardware features in the microcontroller. The features controlled by the configuration bits include, but not limited to, the clock source, WatchDog timer, brownout detect and Memory Read protection. Configuration bits are not executable code they are essentially fuses located in the program memory space.

Each PIC MCU has it’s own set of configuration bits. The Special Features section of the individual datasheets contains the definition for each of the bits.

The settings for the configuration bits is determined by directives written in the application software.

Here is a breakdown of the Configuration Bits for the PIC10F320 and PIC10F322 – Also below is a snip of code to insert into your program using XC8 to make setting them a little easier.

FOSC — Oscillator Selection bits
FOSC = INTOSC : (uses internal oscillator) INTOSC oscillator: CLKIN function disabled – I/O function available on CLKIN pin
FOSC = EC : Uses external oscillator – A clock source needs to present on the CLKIN pin
{My recommendation – use the internal oscillator – FOSC = INTOSC.}

BOREN — Brown-out Reset Enable (Resets the chip in the event of a brown out)
BOREN = OFF : Brown-out Reset disabled.
BOREN = SBODEN : Brown-out Reset controlled by the SBOREN bit in the BORCON register.
BOREN = NSLEEP : Brown-out Reset enabled while running and disabled in Sleep.
BOREN = ON : Brown-out Reset enabled.
{My recommendation – Set the Brown-out to ON so that the device will reset if voltage levels fall}

WDTE — Watchdog Timer Enable (Resets the device if the program does not issue a CLRWDT instruction within the time-out period.)
WDTE = OFF : Watchdog Timer is disabled
WDTE = SWDTEN : Watchdog Timer controlled by the SWDTEN bit in the WDTCON register.
WDTE = NSLEEP : Watchdog Timer enabled while running and disabled in Sleep.
WDTE = ON : Watchdog Timer is enabled
{My recommendation – for what we are doing – disable it – WDTE = OFF, unless you are writing some mission critical program}

PWRTE — Power-up Timer Enable (Holds the device in reset for ~64 ms after reset for power up. This allows the voltage of the device to rise to an acceptable level before operating)
PWRTE = ON : Power up Timer Enabled
PWRTE = OFF : Power up Timer Disabled
{My recommendation – enable it – PWRTE = ON}

MCLRE — MCLR Pin Function Select (Enables the MCLR Reset Pin or Disables it so the pin can be used for I/O)
MCLRE = OFF : MCLR pin function is digital input, MCLR internally tied to VDD
MCLRE = ON : MCLR pin function is MCLR you will need to provide an external pullup on MCLR
{My recommendation – Disable it so you can use the MCLR as an I/O pin – MCLRE = OFF}

CP — Code Protection (Protects the code in the MCU so it cannot be copied out)
CP = ON : Program memory code protection is enabled.
CP = OFF : Program memory code protection is disabled.
{My recommendation – Depends – if you are producing a commercial product perhaps enable it for debugging, building – disable it}

LVP — Low-Voltage Programming
LVP = OFF : High-voltage on MCLR/VPP must be used for programming.
LVP = ON : Low-voltage programming enabled.
{My recommendation – If you are using the PICKit or other ICD – this needs to be off – LVP = OFF}

LPBOR — Brown-out Reset Selection (enables use of the BORV config)
LPBOR = OFF : BOR disabled.
LPBOR = ON : BOR enabled.
{My recommendation – LPBOR = ON : BOR enabled}

BORV — Brown-out Reset Voltage Selection (The level of voltage that will trigger a brown out reset)
BORV = HI : Brown-out Reset Voltage (Vbor), high trip point selected. ~2.70v
BORV = LO : Brown-out Reset Voltage (Vbor), low trip point selected. ~1.90v
{My recommendation – BORV = LO}

WRT — Flash Memory Self-Write Protection (With the 10F320 and 10F322 you can write to flash memory though program code)
WRT = ALL : 000h to 1FFh write protected, no addresses may be modified by PMCON control.
WRT = HALF : 000h to 0FFh write protected, 100h to 1FFh may be modified by PMCON control.
WRT = BOOT : FF000h to 07Fh write protected, 080h to 1FFh may be modified by PMCON control.
WRT = OFF : Write protection off.
{My recommendation – WRT = OFF unless you really need it}

 

If you are looking for a configuration bits header file – I have one for XC8 – below. 

PIC10F322 XC8 My Recommended Configuration Bits