
Chapter 7. I/O Facilities
109
7.4.3 Monitoring by the WAIT Statement
The WAIT statement monitors the input and output devices (I/Os) listed in Appendix D, "I/O
Ports." Unlike the INP function, the WAIT statement makes the I/O devices idle while no entry
occurs, thus saving power consumption.
The table below lists some examples.
WAIT Statement
I/O Devices
WAIT 0,&h01
WAIT 0,&h02
WAIT 0,&h04
WAIT 0,&h08
WAIT 0,&h10
WAIT 0,&h20
WAIT 0,&h40
Keyboard buffer & touch key buffer status
Barcode buffer status
Trigger switch status*
Receive buffer status
TIMEA function
TIMEB function
TIMEC function
* The WAIT statement can monitor the trigger switch status only when the trigger
switch function is assigned to any of the magic keys.
In a single WAIT statement, you can specify more than one I/O device if the same port
number applies. To monitor keyboard buffer & touch key buffer and the barcode buffer with
the single WAIT statement, for example, describe the program as shown below.
OPEN "BAR:"AS #10 CODE "A:"
WAIT 0,&h03
The above example sets the value of &h03 (00000011) to port 0, indicating that it keeps
waiting until either bit 0 or bit 1 becomes ON by pressing any key or by reading a bar code.
Kommentare zu diesen Handbüchern