On tick – Remote Processing CAMBASIC User Manual
Page 123

Comm ands - 90
ON TICK
Tasking Statement
SYNTAX:
ON TIC K n,t GOS UB line/label
ON TIC K n,t G O S U B
PURPOSE:
To cause periodic program branching.
REMARK S:
This statement is used when periodic tasks must be executed. The GO SUB is executed every t
seconds. n is the tick num ber and ranges fr om 0 to 2. Up to 3 O N TIC K subrou tines can exec ute
simultaneously.
There are three TICK timers in CAMBASIC. The parameter n ranges from 0-2. The TICK timers
are independent of each other.
The range of t is 0.005 to 327.68 seconds. The GOSU B branch occurs every t seconds unless the
second syntax is executed. Not specifying a line number or label after GOSUB disables the ON tick
subroutine.
Every t seconds an interval flag is set. At the conclusion of the current CA MBASIC command, a
GOSU B branch occur s.
See Multitasking Chapter for mor e information.
RELATED:
C L E A R T IC K , T I C K
EXAMPLE:
10 ON TICK 1, 1 GOSUB 50
20 PRINT "*"
30 FOR X=0 TO 600:NEXT
40 GOTO 20
50 PRINT TICK(1)
60 RETURN
ERROR:
< Data negative> – for t and n
< Data out of range> - if n > 2
< Time> 327.67 sec> - for t
< Can’t compile> – if line/label does not exist