
Commands - 83
ON BIT
Tasking Statement
SYNTAX: ON BIT task numbe r,ad dress, bit GOS UB line/label
PURPOSE: To declare an I/ O line to be m onitored fo r changes in logic level.
REMARK S: Any eight I/O lines may be monitored so that a change in state causes a program branch 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 specified 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 STOP BIT
statement will disable the event.
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 any valid pr ogram line numbe r or label.
See the Multitasking Chapter for more information.
RELATED: START BIT, STOP 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/label does not exist
Komentáře k této Příručce