/* DEMO90.c: A demonstration program showing how to use the Timer function. **press '0' to reset timer. **press 'q' to quit program. Compiler: BC++ 3.1, Turbo C++ 1.01(3.01) MSC 6.0, MSVC 1.52. Compile mode: Large Project: DEMO90.c ..\..\Lib\(8000e.Lib, 7188el.Lib or 7186el.Lib) Hardware: i-7188/uPAC-7186/i-8000 Note: Timer function used : TimerOpen--> begin to use 7188E timer TimerClose-->Stop to use timer TimerReadValue--> get current timer value.(unit 1ms) TimerResetValue--> reset timer value to 0. This program show the time interval from call TimerOpen or TimerResetValue to now. Max TimerValue=0xFFFFFFFF=4294967295(ms)-->4294967.295(S)-->49.7(days) [Oct 30, 2008] by Liam */ #include #include #include "..\..\lib\7186e.h" void main(void) { unsigned long time, sec; unsigned sec1; int quit=0; InitLib(); Print("cos(0)=%f sin(45)=%f", cos(0), sin(3.14159/4.0)); Print("\r\nPress any key to start timer"); Print("\r\nthen Press '0' to Reset timer, 'q' to quit\r\n"); Getch(); TimerOpen(); while(!quit) { if(Kbhit()) { switch(Getch()) { case '0': TimerResetValue(); break; case 'q': quit=1; break; } } time=TimerReadValue(); Print("\rTime=%8.3f sec", 0.001*time); } TimerClose(); }