The text of a manual · part 5 of 12
BL-600 Series User's Manual: Laser Bar Code Reader, pages 41 to 50
Pages 41 to 50 of 112
The original document is the PDF (1.0 MB). 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 Keyence BL-600 and Keyence BL-601
Page 41
Chapter 7
7.2
Serial Communication
Details on Data Communication This section describes the communication protocols and data format for data communication.
Communication protocols The BL-600 supports the following four handshaking protocols (types of data communication).
T
E
S
T
B
L
-6
0
0
■ No Handshaking The BL-600 Series sends read data to the PC without any handshaking protocol. OK TI M /N G IN G
LA SE R ON
Read data
■ PASS/RTRY Handshaking 1. The BL-600 Series sends read data to the PC. 2. The BL-600 Series waits for a response from the PC (PASS: Transmission succeeded, RTRY: Request to re-send). 3. If “PASS” is sent from the PC to the BL-600 Series, the data transmission is complete. The BL-600 is ready for the next data transmission. * The BL-600 Series does not respond to the “PASS” command. 4. If the BL-600 Series receives “RTRY” from the PC while waiting for “PASS”, the BL-600 Series resends the same data and again waits for “PASS”. * Once the BL-600 Series receives a “PASS”, it will send nothing, even if “RTRY” is received from the PC.
T
E
S
T
B
L
-6
0
0
5. The BL-600 can continue to read bar codes while waiting for “PASS.” The data is stored in the BL-600’s transmission buffer. ➮ See page 112.
OK TI M /N G IN G
Read data
LA
SE
R ON
Response (PASS, RTRY)
Note: If the amount of stored data exceeds the capacity of the transmission buffer, the BL-600 Series sends “[Header] OVER [Delimiter]” to the PC, and clears all the data stored in the transmission buffer. In this case, the BL-600 Series will stop operation. Operation is resumed when the BL-600 Series receives a “PASS” in response to “[Header] OVER [Delimiter].”
111
7
Page 42
Chapter 7
Serial Communication •
PASS and RTRY can be received in either communication format PASS <CR>(RTRY<CR>) or <STX> PASS <ETX>(<STX>RTRY<ETX>). * An <ESC> can also be added to the beginning and an <LF> added to the end of the format.
Note 1: The BL-600 Series can receive all commands while waiting for a “PASS.” In this case, the BL-600 Series will send back without waiting for a response to the command (e.g. OK). Note 2: When the BL-600 Series receives the “SSET” command (➮ See page 116.) while waiting for a “PASS”, it clears all the data stored in the transmission buffer, and enters the setting mode. ■ ACK/NAK Handshaking The ACK/NAK handshaking uses <ACK> (06H) and <NAK> (15H) instead of “PASS” and “RTRY”, which are used in the PASS/RTRY handshaking. Operation is the same as that for the PASS/RTRY handshaking, except for the transmission characters. ■ RTS/CTS Handshaking • When the PC’s “RTS” (BL-600 series’ CTS) signal turns off, the BL-600 Series suspends data transmission. When the PC’s “RTS” signal turns on, the BL-600 Series sends the suspended data. •
The BL-600 Series can still read bar codes even if the PC’s “RTS” signal is off. In this case, the data is stored in the BL-600 series’ transmission buffer. ➮ See page 112 for its capacity.
Note 1: If the amount of stored data exceeds the capacity of the transmission buffer, the BL-600 sends back [Header]OVER[Delimiter] to the PC, and clears all data stored in the transmission buffer. The BL-600 stops operation while clearing data. It recovers when the RTS of the computer turns ON. Note 2: The RTS/CTS handshaking cannot be used for RS-422A communication. Note 3: The RTS/CTS protocol can be used together with other handshaking protocols. Note 4: When the PC’s RTS signal is off, the BL-600 does not sends back a response (e.g. OK [CR]) to the PC.
7
Capacity of transmission buffer The BL-600’ s transmission buffer can store 400 bytes (400 characters). The number of characters stored in the transmission buffer for each data packet is the number of characters in the data (including additional data such as the number of decoding match count) plus an additional five characters indicating the data’s attributes. When multi label reading mode 2 or 3 is used, these five attribute characters are added to each data packet.
400 ÷ (10 + 5) = 26
400 ÷ (20 + 5) = 16
Attributes of Capacity of the transmis- the data sion buffer
Attributes of Capacity of the transmis- the data sion buffer
The transmission buffer can store 26 pieces of data.
The transmission buffer can store 16 pieces of data.
112
➞
When the number of bar code digits is 20 (with no additional data)
➞
When the number of bar code digits is 10 (with no additional data)
➞
Example 2
➞
Example 1
Page 43
Chapter 7
Serial Communication
Read data format Set the data format of the Header and Delimiter, respectively. Header
Read data
Delimiter
With the setup software, the following formats can be selected. Other than the following formats, you can freely set up to 5 characters. Header: <ESC> (1BH), <STX> (02H), None Delimiter: <CR> (0DH), <CR> (0DH) <LF> (0AH), <ETX> (03H)
Read error code If the BL-600 Series fails to read a bar code, it sends back a read error code. The initial setting of the read error code is as follows: Header
ERROR
Delimiter
The read error code can be changed as desired (within 8 characters). The BL-600 can be set to send no error code. ➮ See page 43.
7
113
Page 44
Chapter 7
7.3
Serial Communication
Command Communication The BL-600 includes commands to directly operate the BL-600 (direct control commands) and the commands used to change or confirm the BL600’s settings (parameter setting commands).
7.3.1 Setup of direct control commands Communication procedure 1. Send a direct control command from the PC to the BL-600. 2. After receiving a command, the BL-600 Series sends back an OK response and executes the required operation. *
IN IM T
G N O
/N
R SE LA
OK
Command
G
T
E
S
T
B
L
-6
0
0
*
The BL-600 Series does not send back a response for the read operation and test mode control commands. When an incorrect command is sent to the BL-600, the BL-600 sends back no response.
Response
Communication format When the command format is [Command][CR], the response format is [Response][CR]. When the command format is [STX][Command][ETX], the response format is [STX][Response][ETX].
7
*
Command
Response
Command CR
Response CR
STX Command ETX
STX Response ETX
<LF> can be added after the command being sent. In this case, however, <LF> is not added to the response data.
Note 1: When <ESC> is inserted before the command being sent, characters in the BL-600’s command receiving buffer are cleared. Note 2: If the BL-600’s command receiving buffer contains erroneous characters due to data transmission error during communication, add <ESC> to the command being sent. Note 3: For command communication, set the time duration between transmission of each character (byte) to up to 30 seconds. If this duration exceeds 30 seconds, the BL-600 cancels the received characters.
114
Page 45
Chapter 7
Serial Communication
Explanation of direct control commands The following describe direct control commands in details. Read operation control This command specifies the data read timing.
● Trigger on Command: LON Response: None ● Trigger off Command: LOFF Response: None •
Even when the read operation is controlled with these commands, the BL-600 performs the same operation as with the trigger input. ➮ See pages 86 to 93. “Trigger input: on” corresponds to LON, and “trigger input: off” corresponds to LOFF.
•
The BL-600 Series starts reading bar codes on receipt of LON and stops reading on receipt of LOFF. If the bar codes are properly read and the read data is sent back, you do not need to send LOFF.
•
The command characters can be freely changed (within 8 characters). Test mode control Starts or quits the test mode.
● Reading rate check Command: TEST1 Response: None ● Tact check Command: TEST2 Response: None
7
● Resetting test Command: QUIT Response: None •
After using the test mode, be sure to reset it. OK/NG output control Directly turns on/off the OK/NG output. This enables you to easily check wiring.
● Turning the OK output on Command: OKON Response: OK ● Turning the NG output on Command: NGON Response: OK ● Turning the OK/NG outputs off Command: ALLOFF Response: OK
115
Page 46
Chapter 7
Serial Communication Online test mode Sets to online test mode. ➮ See pages 99 and 100.
● Online test ON Command: #TEST1 Response: OK ● Online test OFF Command: #QUIT Response: OK Clearing transmission buffer Clears data stored in the transmission buffer.
Command: BCLR Response: OK Shift to setting mode Enters the setting mode. ➮ See page 118.
Command: SSET Response: OK Laser off/Resetting Laser off Turns off the laser emission when the laser beam may cause injury to an operator. ➮ See page 4.
● Laser off Command: LOCK Response: OK ● Resetting Laser off Command: UNLOCK Response: OK
7
•
When the Laser off command is executed, bar code read operation (laser emission) is disabled until the Laser off command is reset by using UNLOCK command.
•
The Laser off command is retained even after the power is turned off. Reset Resets the BL-600 software.
Command: RESET Response: OK
116
Page 47
Chapter 7
Serial Communication
Readout history check Outputs the readout OK and NG counts during trigger input ON.
•
Command: NUM Response: aaaaa/bbbbb/ccccc aaaaa = 00000 to 65535: Readout OK count bbbbb = 00000 to 65535: Readout NG count ccccc = 00000 to 65535: Trigger input ON count These counts are reset to zero by turning the power OFF or sending the RESET command. Motor control Stops motor rotation.
● Motor stop Command: MOTOROFF Response: OK ● Resetting the motor stop Command: MOTORON Response: OK •
Reading is disabled for 5 seconds after the motor stop is reset. Changing the scanning width
Changes the scanning width ● Starting angle of scanning Command: SDEGa (Specify the starting angle of scanning [angle “a”] using angle “c” as a reference.) [a = 0 to 400 (Unit: 0.1°) * Initial value = 0] Response: OK ● Scanning angle Command: WDEGb (Specify the scanning angle starting from angle “a.”) [b = 400 to 600 (Unit: 0.1°) * Initial value = 600] Response: OK d c
60° b
60° a
60°
Note 1: The scanning width cannot be specified to exceed the angle range between “c” and “d” (60°). Note 2: The angle specified in the steps above should be used as a guide. If a precise setting is required, adjust the position of each bar code reader separately after installation.
117
7
Page 48
Chapter 7
Serial Communication
7.3.2 Details on parameter setting commands The following describes how to change the BL-600’s settings through command communication. You can use the setup software to change the BL-600’s settings instead of these commands.
Communication details 1. Send the direct control command SSET to the BL-600. The BL-600 will shift to setting mode. After successfully executing the command, the BL-600 sends back an OK. 2. The BL-600 Series shifts to the setting mode. If the command is successfully executed: The BL-600 Series sends back an “OK.” 3. Send the command for an item to be changed (setting change command). If the command is successfully executed: The BL-600 Series sends back an “OK.” If an error occurs: The BL-600 Series sends back an “ERR** (**: Error code).” 4. To confirm the current settings, send a setting confirmation command. If the command is successfully executed: The BL-600 Series sends back the setting data. If an error occurs: The BL-600 Series sends back an “ERR** (**: Error code).” 5. To save the settings in the EEP-ROM, send “SAVE” to the BL-600 Series. Once the settings have been saved in the EEP-ROM, the BL-600 Series will start with the new settings the next time it is turned on. If the command is successfully executed: The BL-600 Series sends back an “OK.” If an error occurs: The BL-600 Series sends back an “ERR** (**: Error code).” 6. To quit the setting mode and perform normal bar code reading, send “SEND” to the BL-600 Series. If the command is successfully executed: The BL-600 Series sends back an “OK.” If an incorrect command is sent: The BL-600 Series sends back an “ERR** (**: Error code).”
7 Communication format
When the command format is [Command][CR], the response format is [Response][CR]. When the command format is [STX][Command][ETX], the response format is [STX][Response][ETX].
*
Command
Response
Command CR
Response CR
STX Command ETX
STX Response ETX
<LF> can be added at the end of the command being sent. In this case, however, <LF> is not added to the response data.
Note 1: When <ESC> is added before the command being sent, characters in the BL-600’s command receiving buffer are cleared. Note 2: If the BL-600’s command receiving buffer contains erroneous characters due to a data transmission error during communication, add <ESC> to the command being sent. Note 3: For command communication, set the time duration between transmission of each character (byte) to up to 30 seconds. If this duration exceeds 30 seconds, the BL-600 cancels the received characters.
118
Page 49
Chapter 7
Serial Communication
Response error code When an incorrect command is sent to set parameters, the BL-600 sends back data indicating the cause of the error (error code). For the commands corresponding to the error codes, see the error code column given in the table on the following pages. Error code
Cause of error
00
Undefined command.
01
Command format is incorrect.
02
Nothing corresponds to the number in the command.
03
“m” value (codes 1 to 4) is other than 0 to 3.
04
“Bar code type setting command” was not sent first. ➮ See page 120. Sending “No. of readable digits setting command” is invalid for UPC/EAN code.
05
The number in the command is too long.
06
“hhh...” data is too short.
07
“n” value is not 0 or 1.
08
“n” value is exceeding the setting range.
09
“nnn” or “nn” value is exceeding the setting range.
10
“hhh...” is not specified in HEX (hexadecimal) code.
11
“hhh...=FF” cannot be set.
12
“hhh...” or “aaa...” contains more than the specified number of characters.
13
Characters of “aaa...” are invalid.
14
Data in the EEPROM may be damaged. Perform initial setup.
15
Error in the area storing initial settings. Settings are automatically initialized.
17
7
\ is not followed by !, ? or \ in preset data. ➮ See pages 164 and 165.
18
Two !s exist in preset data. ➮ See page 101.
99
The BL-600 may malfunction. Contact KEYENCE.
119
Page 50
Chapter 7
Serial Communication
Description of parameter setting commands ■ Saving/initializing settings/quitting setting mode Function
Command being sent
Response
Description
Error code
Saves settings in the EEP-ROM.
SAVE
OK
➮ See page 118.
–
Initializes settings.
DFLT
OK
Returns to the default-settings, and saves the settings in the EEP-ROM.
00, 05, 14, 15
Quits the setting mode.
SEND
OK
➮ See page 118.
–
■ Setting bar code type and number of readable digits for codes 1 to 4 The following describes the parameter setting commands for Codes 1 to 4. Be sure to send “Bar code type setting command” first before setting other parameters. *
When “Bar code type setting command” is newly sent, all other parameters for the specified code will return to the default settings. In this case, set all other parameters again.
Setting change commands and setting confirmation commands are described on the following pages. Function
Command being sent
Response
Description
Setting bar code type for codes 1 to 4. (Bar code type setting command)
Change
CODEm=n
OK m=0 to 3:Codes 1 to 4 00, 01,
Confirm
CODEm mn n=0: CODE 39 1: ITF
Error code 03, 05, 08, 14
2: Industrial 2 of 5 3: Codabar 4: UPC/EAN 5: CODE128
7
6: COOP2of5 7: None 8: CODE93 Setting Max. No. of Change readable digits Confirm
MAXm=nn
OK m=0 to 3: Codes 1 to 4 00, 01,
MAXm mnn nn=01 to 32
03, 04,
* For CODE39,
05, 09,
Codabar: 03 to 32
14
* For ITF: 02 to 32 * For CODE128: 01 to 64
120
Setting Min. No. of readable digits
Change
MINm=nn
OK
Confirm
MINm mnn
CODE39 Sending start/stop character.
Change
WCm00n
OK m=0 to 3: Codes 1 to 4 00, 02,
Confirm
RCm00
00n n=0: Disable
03, 04,
1: Enable
05, 07,
CODE39 Inspection of check digit (Modulus 43)
Change
WCm01n
OK m=0 to 3: Codes 1 to 4 14
Confirm
RCm01
01n n=0: Disable
Note: With EAN code, this command causes error.
1: Enable