watchdog timer

Status
Not open for further replies.

Anderson_87

New Member
Hi,
I would like to know about the watchdog Timer.
I am working on CCS compiler and i want to know at what time the reset occurs. My code is


#include <16F877A.h>
#fuses WDT,XT

int8 i,j;

void main()
{
TRISA=0x00;
TRISB=0x00;
TRISC=0x00;
TRISD=0x00;
TRISE=0x00;

PORTA=0x00;
PORTB=0x00;
PORTC=0x00;
PORTD=0x00;
PORTE=0x00;

OPTION_REG=0X88;
INTCON=0XE0;
T0IE=1;

switch(restart_cause())
{
case WDT_TIMEOUT:
lcd_putc("\fwatch timeout");
break;
case NORMAL_POWER_UP:
lcd_putc("\fnormal time out");
break;
}

setup_wdt(WDT_2304MS);

while(true)
{
lcd_putc("\fnormal operation");
while(1);

}

}
 
From the datasheet the WDT period is from 7 to 33 mS (typically 18 mS) with no prescaler, but it looks as though your code assumes 18 mS and sets the prescaler to 128 to give a period of 2304 mS. In reality the period could be anywhere from 896 to 4224 mS.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…