C Language Development Kit/Functions/StartTimer
From OptiWiki
< C Language Development Kit | Functions(Redirected from C Language Development Kit/Functions/Starttimer)
| Description | This function starts the time-out timer. This function can be used to implement time-outs in an application. When the timer is started, endtimer() can be used to check if the specified time has elapsed. |
| Syntax | void starttimer(unsigned int timevalue); |
| Arguments | This is the time in steps of 20 milliseconds. For example, time = 50 refers to one second.
unsigned int timevalue |
| Returns | None |
| Remarks | Use endtimer() to check if the specified time has elapsed.
Use timervalue() to find out how much time is left before the timer elapses. The maximum time-out value that can be set is about 22 minutes (65535*20ms). |
| Example | #include "lib.h" #include <stdio.h> void main( void ) { while( 1 ) { printf("\fTick off 5 sec"); starttimer( 255 ); while( !endtimer()) { printf("\nTime left %d s", timervalue()/50); sound( TSTANDARD, VSTANDARD, SMEDIUM, 0); delay( 50 ); } printf("\nDone"); resetkey(); while( !kbhit()) idle(); } } |
