/* Watchdog.c : Enabled WDT or bypass enable watchdog. Compiler: BC++ 3.1, Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) MSC 6.0, MSVC 1.52. Compile mode: large Project: Watchdog.c ..\Lib\(8000E.Lib,7188XAL.Lib,7188XBL.Lib,7188XL.Lib or 7188EL.Lib) Hardware: 7188/8000 Detail description: When user's program call EnableWDT(), the system timer ISR will stop to refresh WDT, and user's program must do it by calling RefreshWDT(). Otherwise, the system will be reset by WDT. The timeout period of WDT is 0.8 seconds. The check what reason cause the CPU been reset, you can type 'diag' in i-7188> or i-8000> prompt. There are 3 reasons can reset the CPU 1. reset by power on 2. reset by WDT 3. reset by reset To test the program Step1. download the watchdog.exe to the controller. Step2. power off and then power on the controller. Step3. type 'diag' in the i-7188> or i-8000> prompt. (it should shows the CPU was reset by power on.) Step4. type 'watchdog.exe' to run the demo program. (you can see many "RefreshWDT" message) Step5. press any key to stop to refresh the WDT. a. you can see a message to count the time tick passed from stoping refreshing the WDT. b. The message should be stoped near 800 ms. Step6. type 'diag' in the i-7188> or i-8000> prompt. (it should shows the CPU was reset by WDT.) Hordware: 7188XA [24 May,2005] by Bill ------------------------------------------------------------------------------------------- */ #include"..\..\lib\P821.h" void main(void) { unsigned long sw; InitLib(); EnableWDT(); for(;;) { if(!Kbhit()) { Print("RefreshWDT!! Press any key to stop refreshing WatchDogTimer\n\r"); RefreshWDT(); sw=*TimeTicks; } else { Print("time: %lu\r\n",*TimeTicks-sw); } } }