On bit – Remote Processing CAMBASIC User Manual

Page 116

Advertising
background image

Comm ands - 83

ON BIT

Tasking Statement

SYNTAX:

ON BIT task numbe r,ad dress, bit GOS UB line/label

PURPOSE:

To decla re an I/ O line to be m onitored fo r chang es in logic level.

REMARK S:

Any eight I/O lines may be monitored so that a change in state causes a program br anch to the
specified subroutine.

The I/O lines may be located on any parallel port. A change of state is either a low to high or a high
to low transition.

The spec ified line is sam pled at each tick of the system clock. When the ON BIT statement is
executed, the specified line is sampled for the current state.

The task does not become active until the START BIT statement is executed. The ST OP BIT
statemen t will disable the ev ent.

The BIT task number ranges from 0 to 7. address ranges from 0 to 65, 535. bit ranges from 0 to 7.
line/label may be a ny valid pr ogram line numbe r or la bel.

See the Multitasking Chapter for more infor mation.

RELATED:

START BIT, ST OP BIT

EXAMPLE:

10 ON BIT 0,0,0 GOSUB 60
20 START BIT 0
30 PRINT "waiting..."
40 DELAY .5
50 GOTO 30
60 IF BIT(0,0) = 1 THEN PRINT "closed" ELSE PRINT"open"
70 RETURN

ERROR:

< Data negative> – for task, address, bit
< Data out of range> – if bit,task or bit > 7
< Data> 65,535> – for address
< Can’t compile> – if line/labe l does not exist

Advertising