1.5.1 Watchdog Timer Reset
The Watchdog Timer (WDT) Reset feature may not work properly outside of Sleep mode. Reliance on WDT Reset while executing a program is not recommended. Operation in Sleep is not impacted by this errata.
Work around
Use an independent timer to emulate a watchdog feature, outside of Sleep mode, using
the following steps:
- Configure the chosen timer for the desired timeout period.
- Enable the timer interrupt.
- Enable Peripheral and Global interrupts.
- Enable the timer, which starts the count.
- At the end of the Main loop, restore the timer values.
- If the timer interrupt
occurs, issue a
RESET
command.
A code example using Timer1 is shown below.
void __interrupt() isr(void) { if( TMR1IF && TMR1IE ) { asm("RESET"); } } void main(void) { configure_TMR1(); GIE = 1; PEIE = 1; T1CONbits.ON = 1; while(1) { // user code here restore_TMR1(); } }
Affected Silicon Revisions
B0 | B1 | B2 | B3 | B4 | |||
X | X |