AMX 86 Procedures
K
A
DAK
329
ajtmcnv ajtmcnv
Purpose Convert Milliseconds to System Ticks
Used by n Task n IS P n Timer Procedure n Restart Procedure n Exit Procedure
Setup unsigned long ms;
long ntick;
.
.
ntick = ajtmcnv(ms);
DX:CX DX:CX
Where ms is the number of milliseconds.
ntick is the equivalent interval in AMX system ticks.
Results Interrupts are untouched.
ntick is the interval value in system ticks.
If the clock frequency is such that ms milliseconds requires more than 231
system ticks, ntick will be set to 231-1.
If the clock frequency is such that ms milliseconds is less than one half of
a system tick, ntick will be set to 0.
Note This procedure is frequently used when starting a timer as in the following
examples:
ajtmwr(ajtmcnv(ms));
ajwatm(ajtmcnv(ms));
Avoid using this procedure in ISPs or Timer Procedures where execution
speed is critical. For example, if an ISP must start a timer, use ajtmcnv
during initialization to derive ntick. The ISP can then use ntick to start
the timer without the execution penalty imposed by ajtmcnv.