5.2.1 2-byte Config Bits Registers

Configuration Registers with 2 Bytes

5.2.1.1 Introduction

The Configuration settings allow the user to select the oscillators, reset sources and memory protection from the several options available on the device. They are latched in place at the power-up and also after programming of the device.

5.2.1.2 Supported Device Families

PIC16(L)F184x PIC16(L)F182x PIC12(L)F182x PIC12(L)F184x PIC16(L)F193x
PIC16(L)F194x PIC16LF190x PIC16(L)F178x PIC16(L)F177x PIC16(L)F176x
PIC16(L)F170x PIC16(L)F171x PIC16LF15x PIC12(L)F157x PIC16(L)F157x
PIC16(L)F150x PIC12(L)F150x PIC12LF156x PIC16LF156x PIC16(L)F152x
PIC16(L)F151x PIC16(L)F145x

5.2.1.3 Required Header Files:

#include "mcc_generated_files/system/config_bits.h"

5.2.1.4 Module Documentation

5.2.1.4.1 CONFIGBITS Driver

This is the generated header file for the Configuration bits driver.

Module description

This is the generated header file for the Configuration bits driver.

Version: Driver Version 1.0.0
Note: The below code is an example code only and the value for each config bit setting will vary depending on the setup on the Configuration Bits module.

//CONFIG1
#pragma config FOSC = ECH    // Oscillator Selection->ECH, External Clock, High Power Mode (4-20 MHz): device clock supplied to CLKIN pins
#pragma config WDTE = OFF    // Watchdog Timer Enable->WDT disabled
#pragma config PWRTE = OFF    // Power-up Timer Enable->PWRT disabled
#pragma config MCLRE = ON    // MCLR Pin Function Select->MCLR/VPP pin function is MCLR
#pragma config CP = OFF    // Flash Program Memory Code Protection->Program memory code protection is disabled
#pragma config BOREN = ON    // Brown-out Reset Enable->Brown-out Reset enabled
#pragma config CLKOUTEN = OFF    // Clock Out Enable->CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
#pragma config IESO = ON    // Internal/External Switchover->Internal/External Switchover Mode is enabled
#pragma config FCMEN = ON    // Fail-Safe Clock Monitor Enable->Fail-Safe Clock Monitor is enabled

//CONFIG2
#pragma config WRT = OFF    // Flash Memory Self-Write Protection->Write protection off
#pragma config PLLEN = OFF    // PLL Enable->4x PLL is disabled
#pragma config STVREN = ON    // Stack Overflow/Underflow Reset Enable->Stack Overflow or Underflow will cause a Reset
#pragma config BORV = LO    // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (Vbor), low trip point selected.
#pragma config LVP = ON    // Low-Voltage Programming Enable->Low-voltage programming enabled
#pragma config LPBOR = OFF    // Low-Power Brown-out Reset Enable Bit->Low-Power BOR is disabled
#pragma config PPS1WAY = ON    // Peripheral Pin Select one-way control->The PPSLOCK bit cannot be cleared once it is set by software
#pragma config ZCD = OFF    // Zero-cross detect disable->ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON
#pragma config DEBUG = OFF    // In-Circuit Debugger Mode->In-Circuit Debugger disabled, ICSPCLK and ICSPDAT are general purpose I/O pins

5.2.1.4.2 System Driver

This is the generated header file for the System driver.

Module description

This is the generated header file for the System driver.

Version: Driver Version 1.0.0
Functions
  • void SYSTEM_Initialize (void)

    Initializes the system module. This routine is called only once during system initialization, before calling other APIs.

Function Documentation

SYSTEM_Initialize()

void SYSTEM_Initialize (void )

Initializes the system module. This routine is called only once during system initialization, before calling other APIs.

Parameters:
None.
Returns:

None.

5.2.1.5 File Documentation

5.2.1.5.1 source/config_bits.c File Reference

This is the generated Device Configuration bits file.

Detailed Description

This is the generated Device Configuration bits file.

CONFIGURATION BITS Generated Driver Source File

Version: Driver Version 1.0.0

5.2.1.5.2 source/config_bits.h File Reference

#include "../system/clock.h"

Detailed Description

CONFIGURATION BITS Generated Driver Header File

5.2.1.5.3 source/system.c File Reference

This file contains the API implementation for the System driver.

#include "../system.h"

Functions

  • void SYSTEM_Initialize (void)

    Initializes the system module. This routine is called only once during system initialization, before calling other APIs.

Detailed Description

This file contains the API implementation for the System driver.

System Driver Source File

Version: Driver Version 1.0.0

5.2.1.5.4 source/system.h File Reference

#include <xc.h>
#include <stdint.h>
#include <stdbool.h>
#include "config_bits.h"
#include "../system/clock.h"
#include "../system/pins.h"
#include "../system/interrupt.h"

Functions

  • void SYSTEM_Initialize (void)

    Initializes the system module. This routine is called only once during system initialization, before calling other APIs.

Detailed Description

System Driver Header File