/* DEMO92.C Demonstration for use Timer functions. use StopWatch channel 0 for all of the LED ON/OFF functions: TimerOpen,TimerClose, StopWatchStart,StopWatchReadValue. */ #include #include"..\lib\iview.h" void main(void) { int LedMode=0; unsigned long value; int quit=0; unsigned Ver; Ver=GetLibVersion(); Print("\n\rLib version=%d.%02d",Ver>>8,Ver&0xff); Print("\n\rTest StopWatch ..."); Print("\n\rNow LED must flash once every second"); Print("\n\rPress 'q' to quit\n\r"); TimerOpen(); LedOff(); 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; outp(LED_PORT,LED_F1 | LED_F2 | LED_F3| LED_F4 | LED_PWR | LED_RUN |LED_SHIFT); } else { LedMode=1; outp(LED_PORT,0); } } } TimerClose(); LedOn(); }