void wdtClear()
Resets the watchdog timer back to 0.
In the following program the watchdog timer is set to approximately 6.5 seconds. The first for-loop will be able to count to 10 because the watchdog timer is being cleared after each iteration. The second for-loop, however, will not be able to finish counting because the watchdog timer will reset the CPU after 6.5 seconds.
#include "moacon500.h" void cmain(void) { printf("Start Program\r\n"); wdtOn(4); //Set watchdog timer to 6.5 seconds int i = 0; for(i=1; i<=10; i++) //Count to 10 { printf("%d\r\n", i); //Print count to debug console delay(1000); //Wait for 1 second wdtClear(); //Clear the watchdog timer } for(i=1; i<=10; i++) //Try to Count to 10 { printf("%d\r\n", i); //Print count to debug console delay(1000); //Wait for 1 second } }