/* ========================================================================== */ /* */ /* sdwh.c */ /* (c) 2006 ICPDAS_EVA_LI */ /* */ /* stopwatch timer */ /* */ /* ========================================================================== */ #include #include void main(void) { unsigned long value; int quit=0; InitLib(); Print("\n\rTest StopWatch ..."); Print("\n\rPress 'q' to quit\n\r"); TimerOpen(); StopWatchStart(0); /*to use the StopWatchStart function*/ while(!quit){ if(Kbhit()){ switch(Getch()){ case 'q': quit=1; break; } } StopWatchReadValue(0,&value); Print("SWatch=%d \r",value); if(value==2000){ StopWatchPause(0); DelayMs(2000); StopWatchContinue(0); } if(value==4000){ StopWatchStop(0); DelayMs(2000); StopWatchReset(0); StopWatchStart(0); } } TimerClose(); }