/* DEMO92.C Demonstration for use Timer functions. use StopWatch channel 0 for LED ON/OFF functions: TimerOpen,TimerClose, StopWatchStart,StopWatchReadValue. */ #include"..\lib\8000.h" void main(void) { int LedMode=0; unsigned long value; int quit=0; unsigned Ver; if(!Is8000()){ Print("\ndemo92.exe must run on I-8000 with MiniOS7"); return; } Ver=GetLibVersion(); Print("\n\rLib version=%01d.%02d",Ver>>8,Ver&0xff); Print("\n\rTest StopWatch ..."); Print("\n\rNow LED 'L1' must flash once every second"); Print("\n\rPress 'q' to quit\n\r"); TimerOpen(); SetLedL1(LED_OFF); StopWatchStart(0); while(!quit){ if(Kbhit()){ switch(Getch()){ case 'q': quit=1; break; } } StopWatchReadValue(0,&value); if(value>=500){ StopWatchStart(0); if(LedMode){ LedMode=0; SetLedL1(LED_OFF); Print("\rL1:Off"); } else { LedMode=1; SetLedL1(LED_ON); Print("\rL1: On"); } } } TimerClose(); LedRunOn(); }