- 53 -
ON TIMER
Function Declares an interrupt which occurs at specified intervals, and the line number from
which the execution of the subroutine is started by the interrupt.
Format ON TIMER ( <n> ) GOSUB <line number>
Term <n>: The time interval at which an interrupt occurs should be specified in units of
100 ms. (Range: 1 to 32767)
<line number>: The line number from which the subroutine for the interrupt process
is started should be specified.
Explanation The ON TIMER statement only declares the interrupt process; it does not execute the
process.
When the ON TIMER statement is executed, it counts down the specified time by
using the system timer. When it reaches the specified time, the interrupt process
routine is executed if an interrupt is enabled by the TIMER ON statement. When “0”
is specified in <line number>, the interrupt process is disabled. To prevent another
interrupt process from being received during the execution of the first interrupt
process, the TIMER STOP statement is automatically executed if the interrupt
process is being executed. If there is no TIMER STOP statement during the
execution of this process, the TIMER ON statement is automatically executed by the
RETURN statement for terminating the subroutine, and an interrupt is received.
An interrupt occurs only when the program is executed.