Hi all,
I've been struggling with a watchdog problem on this PIC18F for a couple of days and was hoping that someone else might have some insight.
I've enabled the watchdog timer and it works great, but for some reason I'm unable to detect a timeout event after a reset using the following C18 code:
void main() {
char foo;
foo = isWDTTO();
}
This function is provided in the Microchip library, but the implementation boils down to:
char isWDTTO(void)
{
if(RCONbits.NOT_POR) // if POR is set
{
if(RCONbits.NOT_PD) // if NOT_PD is set
{
if(RCONbits.NOT_TO) // if TO is set
return 0;
return 1;
}
return 0;
}
return 0;
}
Unfortunately I don't have any 18F dev boards to double check that this should work, though something similar on a 16F works perfectly well.
I literally am checking and saving the result of isWDTTO() in the first line: definitely before re-enabling SWDTEN and before calling ClrWdt.
There's nothing in the errata about this not working
Has anyone successfully got WDT working on an 18F?