Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

Archive for February, 2008

How to Increment the nominal value of the Watchdog timer of PIC16F8xx

Posted by Circuit Negma on February 22, 2008


The most obvious reason of increasing the nominal value of WDT is to accommodate the complete code execution of your firmware including the use of Interrupt service subroutines.

The WDT has a nominal time-out value of 18ms. That is, the PIC will reset/restart the firmware execution from beginning (origin) every 18ms.

The purpose of WDT is to restart the microprocessor operations incase the microprocessor stop executing instructions due to internal hardware conflicts or infinite loop within the Firmware code.

To increment the nominal value of the WDT, one must assign the prescaler of TMRO (timer zero) to WDT. This is done be setting bit 0 of OPTION_REG register (aka. PSA bit) to 1.

PSA = 1;

Next, you need to set bits 0, 1, 2 of the OPTION_REG register (aka. PS0, PS1, and PS2). To do so, you need to look at the POSTSCALER rate select bits table in the PIC manual.

Ex: In this example I am going to assign TMR0 postscaler to WDT with a ration of 1:128.

PSA = 1; // assign prescaler to WDT

PS0 = 1; // select 1:128 scaler

PS1 = 1; // select 1:128 scaler

PS2 = 1; // select 1:128 scaler

WDT output result:

WDT timer-out = nominal value * prescaler

WDT time-out = 18ms * 128

WDT time-out = 2304 ms

WDT time-out ~= 2.3 sec

Thus, the PIC will reset every 2.3 sec.

Posted in C++, Electronics | Leave a Comment »

Inexpensive MCU Replaces Dedicated Backup-Power Controller

Posted by Circuit Negma on February 21, 2008


By: Ashish Aggarwal, Dhananjay V. Gadre  |   ED Online ID #18098  |   February 14, 2008

Posted in Electronics | Leave a Comment »