jpts
Joined: 08 Mar 2017 Posts: 40
|
Setting up watch dog for PIC16F18857 |
Posted: Wed Jul 12, 2017 12:02 pm |
|
|
Doubt how to config watchdog for pic16f18857. In PIC configuration has other parameter to setup, WDT_WINDOW_PERCENT that I am not sure what setup.
Idea is to set watchdog to reset each 4SEC . CCS V5.071.
The test program below should print ”RESET” after approx 4 sec…but the result is printing only “running”…does anyone have any idea what could be ?
Code: |
#include <16F18857.h>
#use delay(crystal=20M)
#FUSES NOBROWNOUT
#FUSES NOLVP
#FUSES WDT
#FUSES NOPPS1WAY
#FUSES STVREN
#FUSES NOMCLR
void main()
{
setup_wdt(WDT_ON |WDT_4S | WDT_WINDOW_100_PERCENT |WDT_CLK_31000);
printf ("RESET\r\n ");
while(TRUE)
{
delay_ms(500);
printf ("running\r\n ");
}
}
|
|
|