/* DEMO94.C Demonstration for use Timer functions. use 5 StopWatch channels(channel 1-5) for 5DigitalLed functions: TimerOpen,TimerClose, StopWatchStart,StopWatchReadValue. */ #include #include"..\lib\7188.h" unsigned long DelayTime[6]={ 200, 1000, /* position 1 ,update every 1 sec */ 500, /* position 2 ,update every 0.5 sec */ 400, /* position 3 ,update every 0.4 sec */ 300, /* position 4 ,update every 0.3 sec */ 200, /* position 5 ,update every 0.2 sec */ }; int Data[6]={ 0,0,0,0,0,0 }; void main(void) { unsigned long value; int quit=0,i; unsigned Ver; if(!Is7188()){ printf("\ndemo90.exe must run on I-7188"); return; } Ver=GetLibVersion(); printf("\nLib version=%d.%02d",Ver>>8,Ver&0xff); printf("\nPress 'q' to quit\n"); TimerOpen(); LedOff(); StopWatchStart(1); StopWatchStart(2); StopWatchStart(3); StopWatchStart(4); StopWatchStart(5); while(!quit){ if(kbhit4()){ switch(getch4()){ case 'q': quit=1; break; } } for(i=1;i<=5;i++){ StopWatchReadValue(i,&value); if(value>=DelayTime[i]){ StopWatchStart(i); Show5DigitLed(i,Data[i]); Data[i]++; Data[i]&=0x0F; } } } TimerClose(); LedOn(); }