The text of a manual · part 10 of 16
Bulletin 2755 Hand-Held Scanner with RS-232 Option User Manual: 9 - Serial Commands
Pages 79 to 82 of 104, from Bulletin 2755 Hand-Held Scanner with RS-232 Option User Manual
The original document is the PDF (662 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 2755-G3
Page 79
Chapter
9
A–B
Serial Commands Chapter Objectives
This chapter covers serial commands that can be sent from the host to configure the scanner including:
• Serial Command Format • Manual Scanning Interaction • ACK/NAK Protocol • Power Standby and Serial Commands • Communication Parameter Changes
Serial Command Format
The format of serial commands is as follows: STX ESC LT1 LT2 <optional parameters> ETX Note: STX= Ctrl-B ETX= Ctrl-C STX, ESC, and ETX are ASCII codes whose values are 02H, 1BH, and 03H, respectively. LT1 and LT2 are uppercase ASCII letters that represent a serial command. LT1 is the first letter of the command; LT2 is the second letter of the command. Each bar code label in this manual is preceded by a two character serial command. The ESC code that follows the STX code identifies this as a command. Some commands require parameters such as minimum and maximum code lengths, and strings of hexadecimal characters. When parameters are required by the command they immediately follow LT2. Serial commands never contain spaces. Table 9.A shows some serial programming command examples and the corresponding functions. For a complete list of serial commands, see Appendix F.
9–1
Page 80
Chapter 9 Serial Commands
Table 9.A Serial Programming Command Examples Command STX ESC PC ETX STX ESC PD12 ETX STX ESC PE14 ETX STX ESC KB31323334 ETX 1
Function Enable Interleaved 2 of 5 with check digit. Set Interleaved 2 of 5 minimum length to 12. Set Interleaved 2 of 5 maximum length to 14. Set Preamble to ’1234’.
STX ESC LB6162364 ETX 1
Set Postamble to ’abcd’.
1 Each ASCII character is encoded as two hexadecimal characters. For example: 1=31, 2=32, 3=33, 4=34 and a=61, b=62, c=63, d=64.
Manual Scanning Interaction
The scanner firmware makes no attempt to resolve conflicts between serial programming commands and manually scanned menu labels. If you plan to scan menu labels, do not attempt serial programming, and vice versa. Serial commands are given priority over pending menu labels. For example, if you scan the menu label PD (which sets a minimum length for Interleaved 2 of 5 labels) and the scanner is waiting for a two-digit minimum length code when a serial command is issued, the serial command is acted upon and the pending manual command (PD – Set Interleaved 2 of 5 Minimum Length) is ignored.
9–2
Page 81
Chapter 9 Serial Commands
ACK/NAK Protocol
The scanner provides ACK/NAK protocol during serial programming to provide feedback to the host computer which is programming the scanner. ACK/NAK protocol provides two functions.
• It provides the host with positive acknowledgement that its commands are being accepted and acted upon. • It ensures the host will not issue commands to the scanner faster than the scanner can process them. For example, every time the scanner receives a correct command, it modifies its internal EEPROM, a function that takes about one second. At 9600 baud, the host can easily issue commands to the scanner faster than they can be processed. If, after issuing each command, the host waits to receive an ACK or NAK code before issuing the next command the scanner cannot be overrun. If XON/XOFF or CTS/RTS protocol is being used, the scanner cannot be overrun by programming commands. However, the host is not provided with feedback as to the outcome of its commands. The ACK/NAK Protocol is quite simple. Whenever the scanner receives a correctly formatted command, it sends a confirmation message followed by an ACK (06H) code. The following example shows the command and response for the BEEPER OFF command. Command from Host:
STX ESC AA ETX Response from Scanner:
BEEPER OFF CR–LF ACK If the scanner receives an unknown command or improperly formatted command, or if the required parameters are missing or out-of-range, it sends a NAK (15H) code.
9–3
Page 82
Chapter 9 Serial Commands
Power Standby and Serial Commands
When the scanner is programmed for standby power operation (@B), the first character of the command is used to wake-up the scanner; it will not be recognized by the scanner’s CPU. When there is any possibility that the scanner is in standby mode, an extra space code should be transmitted before STX to ensure the scanner is awake before sending commands to it. If you are not operating the scanner in standby mode, the space has no effect on commands (space prefixed commands are properly decoded). Having sent the space code to wake-up the scanner, a 150 to 200 millisecond pause must be observed to allow the scanner’s CPU to complete its initialization tasks, during which time it is unable to accept serial commands before issuing the programming command. Failure to observe this delay causes the scanner to ignore the incoming command.
Communication Parameter Changes
All commands which affect serial communication are acted upon immediately. When changing communication parameters (such as baud rate, word length, parity), the scanner will send the ACK code, using the newly implemented communication parameters. There should be a delay after the host sends a communication parameter setup command. This delay allows the host computer to modify its internal parameters and correctly receive the ACK code from the scanner. This is due to the internal, one second delay required for the scanner to update its internal EEPROM.
9–4