Description-
This function sets the resolution of the timer tic used by the CdrvSetTime() and CdrvDelay() functions.
Syntax-
stat = CdrvSetTimerResolution(port,resolution);
On Entry-
int port;
Port previously opened with OpenComPort(). If this value is -1 then this function will not attempt to validate the port.
int resolution;
0 1/18 second per tic.
1 1/1000 second per tic(1 millisecond per tic).
On Exit-
int stat;
-1 If port was not initialized.
See Also-
CdrvCheckTime()
CdrvDelay()
CdrvSetTime()
CdrvSetTimeoutFunction()
SetTimeout()
Example-
#include
int stat; int port=0; int resolution=0; int time_interval=18; int timerblk[10];
if ((ret = CdrvSetTimerResolution(port,resolution)) == -1) { printf("Error setting timer resolution\n");
/* Take remedial action */
}
if ((ret = CdrvSetTime(port,time_interval,timerblk)) == -1) { printf("Error setting timer\n");
/* Take remedial action */
}
while(CdrvCheckTime(timerblk) != 0)
{
/* Do desired work for “timer not expired yet” */
}