Table of Contents
What Are the PIC10F322 Configuration Bits?
Configuration bits are special bits in the microcontroller that can only be modified at programming time. These bits are “read” during a reset and enable or disable various hardware features. Features controlled by the configuration bits include the clock source, Watchdog Timer, Brown-out Detect, and Memory Read Protection. Essentially, these bits act like fuses located in the program memory space.
Each PIC MCU has its own set of configuration bits, which are detailed in the “Special Features” section of the individual datasheets. The settings for these bits are determined by directives written in the application software.
Breakdown of Configuration Bits for PIC10F320 and PIC10F322
Here’s a detailed breakdown of the configuration bits for the PIC10F320 and PIC10F322, along with code snippets to set them using XC8.
FOSC — Oscillator Selection Bits
#pragma config FOSC = INTOSC // Uses internal oscillator
#pragma config FOSC = EC // Uses external oscillator, clock source needed on CLKIN pin
Recommendation: Use the internal oscillator:
#pragma config FOSC = INTOSC
BOREN — Brown-out Reset Enable
#pragma config BOREN = OFF // Brown-out Reset disabled
#pragma config BOREN = SBODEN // Controlled by SBOREN bit in BORCON register
#pragma config BOREN = NSLEEP // Enabled while running, disabled in Sleep
#pragma config BOREN = ON // Brown-out Reset enabled
Recommendation: Enable Brown-out Reset:
#pragma config BOREN = ON
WDTE — Watchdog Timer Enable
#pragma config WDTE = OFF // Watchdog Timer disabled
#pragma config WDTE = SWDTEN // Controlled by SWDTEN bit in WDTCON register
#pragma config WDTE = NSLEEP // Enabled while running, disabled in Sleep
#pragma config WDTE = ON // Watchdog Timer enabled
Recommendation: Disable Watchdog Timer unless necessary:
#pragma config WDTE = OFF
PWRTE — Power-up Timer Enable
#pragma config PWRTE = ON // Power-up Timer enabled
#pragma config PWRTE = OFF // Power-up Timer disabled
Recommendation: Enable Power-up Timer:
#pragma config PWRTE = ON
MCLRE — MCLR Pin Function Select
#pragma config MCLRE = OFF // MCLR pin is digital input, internally tied to VDD
#pragma config MCLRE = ON // MCLR pin function is MCLR, needs external pull-up
Recommendation: Disable MCLR to use it as an I/O pin:
#pragma config MCLRE = OFF
CP — Code Protection
#pragma config CP = ON // Program memory code protection enabled
#pragma config CP = OFF // Program memory code protection disabled
Recommendation: Enable or disable based on your needs:
#pragma config CP = OFF
LVP — Low-Voltage Programming
#pragma config LVP = OFF // High-voltage on MCLR/VPP for programming
#pragma config LVP = ON // Low-voltage programming enabled
Recommendation: Disable Low-Voltage Programming if using PICKit or similar:
#pragma config LVP = OFF
LPBOR — Brown-out Reset Selection
#pragma config LPBOR = OFF // Brown-out Reset disabled
#pragma config LPBOR = ON // Brown-out Reset enabled
Recommendation: Enable Low-Power Brown-out Reset:
#pragma config LPBOR = ON
BORV — Brown-out Reset Voltage Selection
Recommendation: Use the low trip point:
#pragma config BORV = LO
WRT — Flash Memory Self-Write Protection
#pragma config WRT = ALL // All addresses write protected
#pragma config WRT = HALF // 0x000 to 0x0FF write protected
#pragma config WRT = BOOT // 0xFF000 to 0x07F write protected
#pragma config WRT = OFF // Write protection off
Recommendation: Disable write protection unless necessary:
#pragma config WRT = OFF
Sum It Up
Configuration bits are crucial for setting up the hardware features of your PIC10F322 microcontroller. By understanding and correctly setting these bits, you can optimize your microcontroller’s performance for your specific application. Use the provided configurations and recommendations as a guide to get started quickly and effectively.
See this post – If you are looking for a PIC10F322 configuration bits header file for XC8. Simplifying Your PIC10F322 Projects with a Standard Header File
Have a Project or Idea!?
Seeking Bespoke Technology Solutions?
Contact me today to discover how personalized, high-end tech solutions can meet your unique requirements.