/* 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) (free from http://community.borland.com/museum) MSC 6.0, MSVC 1.52. Compile mode: Large Project: DEMO90.c ..\..\Lib\7188el.Lib Hardware: 7188E 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) [07/Dec/2006] by Liam [July,13,2011] by Nicholas */ #include #include #include "..\..\lib\7188e.h" /* you must change this lib to suit the hardware that you want to use. */ void main(void) { unsigned long time, sec; unsigned sec1; int quit=0; 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(); /* sec=time/1000; sec1=time%1000; printCom3("\rTime=%05ld.%03d sec",sec,sec1); */ Print("\rTime=%8.3f sec", 0.001*time); } TimerClose(); }