OSRegisterTimer Function (ROM Call 0xF0)

system.h

short OSRegisterTimer (short timer_no, unsigned long T);

Registers a notify (countdown) timer.

TIOS has several notify (countdown) timers. The number of timers is not the same on all AMS versions:
All AMS versions up to 2.03 6 timers (1 to 6)
AMS 2.04 and 2.05 7 timers (1 to 7)
AMS 2.07, 2.08 and 2.09 8 timers (1 to 8)

OSRegisterTimer initializes the timer which ID number is timer_no, and sets its initial value to T. Every time the Auto-Int 5 is triggered (approximatively 20 times per second if you didn't change the programable rate generator), the current value of the timer is decremented by 1. When the current value reaches zero, nothing special happens, but a flag is set which indicates that the timer is expired. This flag may be check using function OSTimerExpired.

OSRegisterTimer returns timer_no if the registration was successful, else returns zero. This happens if you give wrong parameters, or if the timer timer_no is already in use. So, you must first free the timer using OSFreeTimer.

Usual use of the timers:


Legal timer numbers (like APD_TIMER) are defined in enum Timers, to make a program more readable. See also other timer functions for more info.


Used by: cmd_cyclepic, cmd_sendcalc, cmd_sendchat, BatTooLowFlash, LIO_RecvData, GT_Trace, Regraph


See also: FiftyMsecTick, OSFreeTimer, OSTimerCurVal, OSTimerExpired, OSTimerRestart