Rpbasic-52 programming guide, Ontick – Remote Processing BASIC 52 User Manual
Page 96
RPBASIC-52 PROGRAMMING GUIDE
2-77
ONTICK
Syntax:
O N T I C K time,line number
Where: time = time interval from 0.01 to 327
line number = line to branch
Function:
Calls subroutine at line number every time interval.
Mode:
Run
Use:
ONTICK 1.25,500
Cards:
All
D E S C R IP T I ON
ONTICK calls a subroutine every time interva l. time ranges from 0.010 seconds to 327.7 seconds
(appro xima tely 5.5 minu tes). time c a n be s p ec i fi e d i n in c re m e n ts a s s m a ll a s 0 . 00 5 se c o nd s . O N T I C K
interrupts are turned off when time = 0. A line number must still be provided even though it is not used.
The interval period can be reset at any time in a program. When an ONTICK statement is executed, an
interrupt will occur in time seconds. Time accumulated since the last interrupt is discarded.
NOTE: Use th e RE TI com man d to ex it this su broutin e. Failu re to do so prev ents fu ture O NTI CK interrup ts.
Make sure your ONTICK subroutine can finish before the next interrupt. If the program is in the subroutine
longer than the specified time interval, the next one will be missed.
This interrupt has the highest priority of any others. ONITR can interrupt any other routine, but no other
interrupt can take over this one.
RELATED
RETI
ERRORS
B A D A R G U M E N T When time > 327.6 or negative
B A D S Y N T A X
When any parameters left out
I N V A L ID L I N E
When line number not found
EXAMPLE
The following example will interrupt 5 times before it is canceled at line 220.
10 A = .15
20 ONTICK A,200
30 IF C<4 THEN A=A+1 : GOTO 30
40 END
200 PRINT A
210 C = C + 1
220 IF C = 5 THEN ONTICK 0,200
230 RETI
>run
145.15
286.15
431.15
575.15
The IDL E com mand m ay be used to " wait" for an O NTIC K interval interrupt.