On com – Remote Processing CAMBASIC User Manual

Page 117

Advertising
background image

Comm ands - 84

ON COM$

Tasking Statement

SYNTAX:

ON C OM$ n GOS UB line/label
ON C OM$ n G O S U B

PURPOSE:

To define a program branch when a task defined by the CON FIG C OM$ statement becom es valid.

REMARK S:

After defining all the parameters with CONFIG C OM$ the ON C OM$ activates the task. You can
deactiv ate the tas k by exe cuting the same statem ent but w ithout a line numb er aft er G OSU B.

n = legal serial port number.

See the Multitasking Chapter for more information.

RELATED:

C L E AR C O M $, C O M $, C O N F IG C O M $

EXAMPLE:

10 CONFIG COM$ 2,0,8,0,1
20 ON COM$ 1 GOSUB 80
30 'your program goes here
.

80 PRINT COM$(2)
90 RETURN

In this example the program will branch when 8 char acters have been received. The XON and
XOF F protocol functions are disabled via CONF IG COM $ statement. All characters w ill be echoed.

ERROR:

< Data negative> – n
< Data out of range> – if n is not a legal serial port number
< Can’t compile> – if line/label does not exist

Advertising