/* DEMO92.C Demonstration for use Timer functions. use StopWatch channel 0 for LED ON/OFF functions: TimerOpen,TimerClose, StopWatchStart,StopWatchReadValue. */ #include #include"..\lib\7188.h" void main(void) { int LedMode=0; unsigned long value; int quit=0; 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(0); while(!quit){ if(kbhit4()){ switch(getch4()){ case 'q': quit=1; break; } } StopWatchReadValue(0,&value); if(value>=500){ StopWatchStart(0); if(LedMode){ LedMode=0; LedOff(); } else { LedMode=1; LedOn(); } } } TimerClose(); LedOn(); }