Configuration Registers and BOD

Updated on 2017/11/07 18:31

Configuration Registers and BOD

Configuration Registers and BOD

Power management features

PIC18F2420/2520/4420/4520 devices include several features intended to maximize reliability and minimize cost through elimination of external components. These are:

  • Oscillator Selection
  • Resets
    • Power-on Reset (POR) 
    • Power-up Timer (PWRT) 
    • Oscillator Start-up Timer (OST) 
    • Brown-out Reset (BOR)
  • Interrupts
  • Watchdog Timer (WDT)
  • Fail-Safe Clock Monitor
  • Two-Speed Start-up
  • Code Protection
  • ID Locations  
  • In-Circuit Serial Programming

The oscillator can be configured for the application depending on frequency, power, accuracy and cost. “Oscillator Configurations”. A complete discussion of device Resets and interrupts is available in previous sections of this data sheet. In addition to their Power-up and Oscillator Start-up Timers provided for Resets, PIC18F2420/2520/4420/ 4520 devices have a Watchdog Timer, which is either permanently enabled via the Configuration bits or software controlled (if configured as disabled).
The inclusion of an internal RC oscillator also provides the additional benefits of a Fail-Safe Clock Monitor (FSCM) and Two-Speed Start-up. FSCM provides for background monitoring of the peripheral clock and automatic switchover in the event of its failure. TwoSpeed Start-up enables code to be executed almost immediately on start-up, while the primary clock source completes its start-up delays. All of these features are enabled and configured by setting the appropriate Configuration register bits.

Configuration Bits

The Configuration bits can be programmed (read as ‘0’) or left unprogrammed (read as ‘1’) to select various device configurations. These bits are mapped starting at program memory location, 300000h. The user will note that address 300000h is beyond the user program memory space. In fact, it belongs to the configuration memory space (300000h-3FFFFFh), which can only be accessed using table reads and table writes. Programming the Configuration registers is done in a manner similar to programming the Flash memory. The WR bit in the EECON1 register starts a self-timed write to the Configuration register. In normal operation mode, a TBLWT instruction with the TBLPTR pointing to the Configuration register sets up the address and the data for the Configuration register write. Setting the WR bit starts a long write to the Configuration register. The Configuration registers are written a byte at a time. To write or erase a configuration cell, a TBLWT instruction can write a ‘1’ or a ‘0’ into the cell. For additional details on Flash programming,  “Writing to Flash Program Memory”.

Configuration Registers

CONFIG1H: CONFIGURATION REGISTER 1 HIGH (BYTE ADDRESS 300001h)
It is an 8-bit register used to select different options for the microcontroller without changing any external hardware circuits or components

Bit76543210
Field--OSCSEN--FOSC2FOSC1FOSC0
BitDescription
7Reserved
6Reserved
5Oscillator system clock enable(Active Low Input Pin)
OSCEN=1; Oscillator system clock switch option is Disabled
OSCEN=0; Oscillator system clock switch option is Enabled
4Reserved
3Reserved
2-0 FOSC<2:0>: Oscillator Selection bits
111 = External RC oscillator as input to OSC1 pin and OSC2 pin used as general input output pin( RA6)
110 =HS Oscillator with PLL enable(Clk=4x Fosc)
101 =External clock as input to OSC1 pin and OSC2 pin used as general input output pin( RA6)
100 =External clock as input to OSC1 pin and OSC2 pin used as output pin Fout=Fosc/4
011 = RC oscillator
010 = HS oscillator,
001 = XT oscillator
000 = LP oscillator
  • The three bits Fosc2,Fosc1,Fosc0 are used to select the clock frequency to CPU
  • The default choice is 111 = External RC oscillator as input to OSC1 pin and OSC2 pin used as general input output pin( RA6) which uses on chip oscillator with the help of an external connected registers and capacitor

There are four different choices for crystal oscillator

OscillatorCrystal Frequency
PLLHS25 MHz
HS4 MHz
XT1-4 MHz
LP32 KHz- 200 KHz
  • As frequency increases , the Power requirement also increases.PLLHS requires more power while LP oscillator requires less power
  • By default if external oscillator circuit or clock source is not working then microcontroller switch itself to internal oscillator ,it will generate frequency of 32Khz

CONFIG2L Register and Reset voltage

Bit76543210
Field----BORV1BORV0BORENPWRTEN
BitDescription
7Reserved
6Reserved
5Oscillator system clock enable(Active Low Input Pin)
OSCEN=1; Oscillator system clock switch option is Disabled
OSCEN=0; Oscillator system clock switch option is Enabled
4Reserved
3-2BORV1-BORV0<3-2>: Brown out reset voltage
11-BOR voltage set to 2.0 V
10-BOR voltage set to 2.7 V
01-BOR voltage set to 4.2 V
00-BOR voltage set to 4.5 V
1 Brown out RESET  enable
BOREN=1; Brown out RESET  enable
BOREN=0; Brown out RESET  DISABLE
0Power On RESET timer enable(Active Low Input Pin)
OSCEN=1; Power On RESET timer is Disabled
OSCEN=0; Power On RESET timer enabled
  1. CONFIG2L Register provides stable voltage and stable clock frequency during RESET operation
  2. During System power up it requires stable voltage and stable clock frequency to function it properly
  3. Two timers help us to achieve that they are PWRT(Power on Reset Timer) and OST(Oscillator-start-up-Timer)
  4. These two internal timers help to reduce the delay associated with the frequency and voltage sources during power on process
  5. PWRT provides a fixed delay during Power on process which keeps CPU in RESET state until the power supply or voltage level stabilizes
  6. OST keeps CPU in RESET state until the crystal oscillator frequency stabilizes

Brown-Out Reset Voltage

  1. Mostly all microcontrollers have built in Brown-out detection (BOD) circuit, which monitors supply voltage level during operation. BOD circuit is nothing more than comparator, which compares supply voltage to a fixed trigger level. 
  2. Occasionaly the power source provided to the Vdd pin fluctuates causing the CPU to malfunction
  3. The PIC18 Family has a provision for this which is called brown out reset voltage
  4. BORV1-BORV0 bits in CONFIG2L register allow us to set minimum voltage to Vdd
  5. If it falls below that the CPU will go into the Reset state and stop all the activities

References

  • Notes and Edited by Prof. Sujit Wagh, SKNCOE, Pune
  • WikiNote Foundation
Tags:
Created by Sujit Wagh on 2017/11/07 17:26