Specifications

Event Multitasking - 7
You can try this by holding down the <ENTER> on your terminal so that it auto–repeats and enters count faster.
INP TASKING
INP tasking lets you react to a combination of on/off conditions at a digital I/O port. That is, you may want to detect when
inputs 0, 1 and 7 are high, and inputs 2 and 3 are low, while ignoring the other input lines (4, 5, 6).
There are a total of 8 tasks that can be configured. The ON INP statement sets the interrupt conditions. The START INP is
used to activate the task. STOP INP will deactivate the task. Another START INP will reactivate the task. You do not
need to execute ON INP to start the task again.
Declaring a Task
This is done with the ON INP statement. The syntax is :
ON INP n, address, mask, compare GOSUB line/label
Where:
n is the task number. The range of n is 0 to 7.
address is the I/O address of the port in interest. The port can be an actual input port like that on an
82C55, a readable latch or an internal CPU register.
mask determines which of the input bits or lines are of interest. For example, if we want to look at
lines 0, 1, 2, 3 and 7, then the mask would be:
10001111
in binary or 8F in hex or 143 in decimal. The “1” bits of the mask are the bits of interest. During
execution the mask is ANDed with the port value.
If the result is equal to the compare parameter, then a interrupt occurs. The program then branches to
the GOSUB line/label.
The inputs are checked 200 (100 in 9 Mhz systems) times per second. In most applications, the inputs will be changing
much more slowly. Thus, if a match occurred and remained the same for one second, then 200 (100 in 9 Mhz systems)
interrupts would occur.
To prevent this from happening, the ON INP operates in the “edge triggered” mode. The program branch occurs only on
the first instance of the match. All subsequent matches are ignored until at least one input changes, so that a match is not
present.
The example below will let you demonstrate the INP task, using a parallel port, a UTB terminal board and clip leads.
10 ON INP 0, 2, 7, 5 GOSUB 60
20 START INP 0
30 PRINT BIN$ (INP (2) )
40 DELAY .25
50 GOTO 30
60 PRINT "match"
70 RETURN
Line 10 defines the INP task 0 to look at address 2. The bits of interest are set by the seven