/* 1. Compiler: TC 2.0 2. Mode: Large 3. Project: Demo90.c Demo90.prj ..\lib\8000l.lib ..\lib\tcpipl.lib 4. Explain: (1). Demonstration for use Timer. (2). To use TimerResetValue & TimerReadValue dunctions. (3). Max TimerValue=0xFFFFFFFF=4294967295(ms)-->4294967.295(S)-->49.7(days) 5. Hordware: 8831 It's compiled by Tony --------------------------------------------------------------------------------------- */ #include #include #include #include #include #include #include"..\LIB\8000.h" #include"..\LIB\vxcomm.h" /*-----------------------------------------------------------------------------------*/ void main(void) { unsigned long time,sec; unsigned sec1; int quit=0; int type; int ver; type=Is8000(); /*detect the current operation system*/ if(type) { ver=GetLibVersion(); Print("Hello 8831! (Flash memory is %d K)\n\r",type); Print("Library version is %d.%02d",ver>>8,ver&0xff); } else { Print("Hello PC!, this program is not run under I-8831."); return; } Print("cos(0)=%f sin(45)=%f",cos(0),sin(3.14159/4.0)); Print("\n\rPress any key to start timer"); Print("\n\rthen Press '0' to Reset timer,'q' to quit\n\r"); 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(); }