On-gosub, Ontime, On-gosub -14 ontime -14 – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual
Page 110: Purpose, Syntax, Example

Publication 1746-RM001A-US-P
8-14 Execution Control and Interrupt Support Functions
ON-GOSUB
Purpose
Use the ON-GOSUB statement to transfer control to the line(s) specified by the
GOSUB statement when the value of the expression following the ON statement is
encountered in the BASIC program.
Syntax:
ON [expr] GOSUB [ln num], [ln num],...[ln num]
Example
>1
REM EXAMPLE PROGRAM
>10 ON Q GOSUB 100,200,300
If Q is equal to 0, control is transferred to line number 100. If Q is equal to 1,
control is transferred to line number 200. If Q is equal to 2, control is transferred
to line number 300, and so on. All comments that apply to GOSUB apply to the
ON statement. If Q is less than zero an
ERROR: BAD ARGUMENT
message is
generated. If Q is greater than the line number list following the GOSUB
statement, an
ERROR: BAD SYNTAX
message is generated. The ON-GOSUB
statement provides conditional branching options within the module program.
ONTIME
Purpose
Use the ONTIME [expr], [ln num] statement to compensate for the
incompatibility between the timer/counters on the microprocessor and the module.
Your module can process a line in milliseconds while the timer/counters on the
microprocessor operate in microseconds. The ONTIME statement generates an
interrupt every time the special function operator, TIME, is equal to or greater
than the expression following the ONTIME statement.
Only the integer portion of TIME is compared to the integer portion of the
expression that gives you seconds. This comparison is performed at the end (CR or
: ) of each line of BASIC. The interrupt forces a GOSUB to the line number [ln
num] following the expression [expr] in the ONTIME statement.
The ONTIME statement does not interrupt an input command or a CALL
routine. Since the ONTIME statement uses the special function operator, TIME,
you must execute the CLOCK1 statement for ONTIME to operate. If CLOCK1 is
not executed the special function operator, TIME, does not increment.
Syntax
ONTIME [expr], [ln num]