/* Reset.c : Restores the initial values. 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: Reset.c ..\Lib\(8000E.Lib,7188XAL.Lib,7188XBL.Lib,7188XL.Lib or 7188EL.Lib) Hardware: 7188/8000 Detail description: Restores the initial values. The time for reset 200 times is about 7 seconds. so the reset time is about 0.035 sec. (< 0.1 second) (It include the time to find files(autoexec.bat & rsttime.exe) 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 reset.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 'reset.exe' to run the demo program. (you can see prompt's message) Step5. press any key to stop to star's loop. Step6. type 'diag' in the i-7188> or i-8000> prompt. (it should shows the CPU was reset by RESET Command.) [24 May,2005] by Bill [07/Dec/2006] by Liam [July,13,2011] by Nicholas */ #include #include "..\..\lib\7188e.h" void (far *Reset_Program)(void)=0xFFFF0000L; //Program start address. void main(void) { InitLib(); Print("Press any key to begin\n\r"); Print("and press any key can reset the program.\n\r"); Getch(); for(;;) { if(Kbhit()) { Print("7188E have reseted by software."); DelayMs(10); //Delay 10 ms to wait for all data is sent to COM port. Reset_Program(); //You can call the function or //replace it by following 3 asam codes. //_asm push 0xffff //_asm push 0 //_asm retf } else Print("*"); //Print '*' while the program is running. } }