On key press – Rockwell Automation GMLC Reference Manual User Manual
Page 458

Publication GMLC-5.2 - November 1999
On Key Press
421
Clearing the Input Buffer
Selecting Clear Input Buffer from the Type menu immediately clears the
input buffer of serial port B, discarding any characters therein. You can
use this function at any time to clear the serial port buffer, but that you
should first clear the serial buffer before requesting any data from the
operator. This guarantees that the only those characters you want—and
not any extraneous ones—are evaluated by subsequent If Key blocks.
Getting the Next Key
Selecting Get Next Key from the Type menu loads the ASCII value of the
next key in the buffer into the Last_Keypress system variable. The key (or
character) can then be evaluated and a decision made using an If Key
block. If no character has been received yet, or there are no more
characters in the buffer, Last_Keypress is zero.
Getting the Previous Key
Selecting Get Previous Key from the Type menu loads the ASCII value of
the previous key into the Last_Keypress system variable. The key (or
character) can then be evaluated and a decision made using an If Key
block. While it is not usually necessary to go backwards in the serial port
input buffer using this function, it can be useful in some situations.
On Key Press
Use the On Key Press block to:
•
Pause the program until serial port B receives a character (Wait for
Key type).
•
Check serial port B for the presence of a received character (If Key
type).
If you selected DH-485 in the General page of the Configure Control
Options dialog box, the On Key Press block cannot be used, because
serial port B on the motion controller is used for DH-485 communication.
The On Key Press block resides on the RS-232/422 Palette.