5.2.2 3-byte Config Bits Registers

Additional register for Watchdog Timer settings

5.2.2.1 Introduction

The Configuration settings allow the user to select the oscillators, reset sources and watchdog timer settings 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.2.2 Supported Device Families

PIC12(L)F161x PIC16(L)F161x PIC18(L)F-K83

5.2.2.3 Required Header Files:

#include "mcc_generated_files/system/config_bits.h"

5.2.2.4 Module Documentation

5.2.2.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 Bits->ECH, External Clock, High Power Mode (4-20 MHz): device clock supplied to CLKIN pins
#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 Switch Over->Internal External Switch Over 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 ZCD = OFF    // Zero Cross Detect Disable Bit->ZCD disable.  ZCD can be enabled by setting the ZCDSEN bit of ZCDCON
#pragma config PLLEN = OFF    // PLL Enable Bit->4x PLL is enabled when software sets the SPLLEN bit
#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 LPBOR = OFF    // Low-Power Brown Out Reset->Low-Power BOR is disabled
#pragma config LVP = ON    // Low-Voltage Programming Enable->Low-voltage programming enabled
#pragma config PPS1WAY = ON    // Peripheral Pin Select one-way control->The PPSLOCK bit cannot be cleared once it is set by software

//CONFIG3
#pragma config WDTCPS = WDTCPS1F    // WDT Period Select->Software Control (WDTPS)
#pragma config WDTE = OFF    // Watchdog Timer Enable->WDT disabled
#pragma config WDTCWS = WDTCWSSW    // WDT Window Select->Software WDT window size control (WDTWS bits)
#pragma config WDTCCS = SWC    // WDT Input Clock Selector->Software control, controlled by WDTCS bits

/**
 End of File
*/

5.2.2.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.2.5 File Documentation

5.2.2.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.2.5.2 source/config_bits.h File Reference

Detailed Description

CONFIGURATION BITS Generated Driver Header File

5.2.2.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.2.5.4 source/system.h File Reference

#include <xc.h>
#include <stdint.h>
#include <stdbool.h>
#include "config_bits.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