OSRegisterTimer Function (ROM Call 0xF0)

system.h

short OSRegisterTimer (short timer_no, unsigned long T);

Registers a notify (countdown) timer.

TIOS has a 6 notify (countdown) timers, numbered from 1 to 6. 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 (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. Notify timers 2, 3, 4 and sometimes 5 are used in TIOS for internal purposes, and it seems that timers 1 and 6 are free for use (especially I expected that 6 are surely unused, and I am not so sure for timer 1). Timer 5 is sometimes used for measuring time in some TI-Basic functions like CyclePic. Timer 4 is used for cursor blinking. Timer 3 is used for link communication. Timer 2 is used for automatic power-down (APD) counting, so this is an official method to change APD rate to, for example, 100 seconds:

OSFreeTimer (APD_TIMER);
OSRegisterTimer (APD_TIMER, 100*20);
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