When the timer is started, EndTime function can be used to check if the specified time has elapsed.
Syntax
void StartTimer(
unsigned int timevalue
);
Parameters
- timevalue
-
[in] Specifies the timeout to count.
- This is the time in steps of 20 milliseconds.
- The actual time is time x 20 milliseconds.
- The range of values is 0 to 4,294,967,294.
- Example:time = 250 will cause a delay of 20*250 = 5 seconds.
Return value
None
Remarks
Use EndTime function to check if the specified time has elapsed.Use TimerValue function to find out how much time is left before the timer elapses.
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void main(void)
{
for (;;)
{
printf("\fTick off 5 sec");
StartTimer(TIME_100MS * 50);
while(!EndTimer())
{
printf("\nTime left %d s", TimerValue() / 50);
Sound(TSTANDARD, VSTANDARD, SMEDIUM,0);
Delay(TIME_100MS*10);
}
printf("\nDone");
ResetKey();
while(!kbhit())
{
Idle();
}
}
}
Last updated: 2020/10/08