33.8.4 Clearing Watchdog Timer

Clear WDT after 300ms shows a code example to clear Run WDT Counter.
Note:
  1. If enabled, Run WDT should be periodically serviced (must be disabled within timeout) to prevent WDT Run mode NMI/Reset.
  2. Processor takes a few cycles to execute ClrWdt instruction; if this is not taken into account, Run WDT will not be cleared reliably.
  3. When Window mode is enabled, use caution when clearing WDT because this can only be done in the allowed Window. Clearing WDT in a disallowed window causes Run WDT NMI/Reset.

Clear WDT after 300ms

//code example to clear Run Counter after 300ms with WDT timeout as 1.024sec
 int main()
{
WDTCONbits.RMPS = 10;	// Run Postscaler 1024 
 WDTCONbits.ON = 1;	  // Enable WDT
__delay_ms(300);	     // 300ms delay
ClrWdt();	            // Clears Run Counter after 300ms delay

}