/* ========================================================================== */ /* wchdog.c */ /* (c) 2006 icpdas_eva_li */ /* Ex of function: /* EnableWDT() /* DisableWDT() /* RefreshWDT() Delay() */ /* ========================================================================== */ #include"iview.h" #include"mmi100.h" void main(void) { int quit=0,k; InitLib(); if(IsResetByWatchDogTimer()) /*test if reset by WDT*/ Print("reset by WatchDog timer\n\r"); EnableWDT(); /*after call EnableWDT, must call refresh in 0.8s*/ while(!quit){ if(Kbhit()) { k=Getch(); if(k=='q') { Print("quit program\r\n"); quit=1; /*quit the program*/ } else { Print("over 0.8s, Reset system\r\n"); Delay(1000); /*delay over 0.8s, reset system*/ } } RefreshWDT(); /*refresh WDT in 0.8s*/ Print("call Refresh WDT\n\r"); } DisableWDT(); /*disable WDT, system will refresh WDT*/ Print("call DisableWDT\n\r"); }