Specifications

Commands - 80
ON INP
Tasking Statement
SYNTAX: ON INP n, address, mask, compare GOSUB line/label
PURPOSE: To cause an interrupt when a preset input bit pattern is detected in an input port.
REMARKS: The task is similar to ON BIT. However, you can look at any or all of the 8 bits on a port. An
interrupt occurs when the bit pattern is recognized.
The interrupt will occur on the first instance of the pattern match. It will not interrupt again until the
inputs change and then change back to match the pattern. This is sometimes called an “edge
triggered” mode.
The parameter n is the task number. It ranges from 0 to 7.
The address is the I/O address of the port to be read.
The mask parameter determines which bits are of interest. Each bit in the mask that is a “1” is a bit
of interest.
When the data at the port matches the compare parameter, an interrupt occurs and the program
branches to the line/label. Up to 8 conditions may be tested on the same port or different ports
See the Multitasking Chapter for more information.
RELATED: START INP, STOP INP
EXAMPLE: 10 ON INP 0,3,7,5 GOSUB 60
20 START INP 0
30 PRINT BIN$(INP(0))
40 DELAY .25
50 GOTO 30
60 PRINT "match"
70 RETURN
ERROR: <Data negative> – all parameters
<Data out of range> – if n>7
<Data > 255> – for mask and compare
<Data > 65,535> – for address
<Can’t compile> – if line/label not found