The text of a manual · part 13 of 16
BL-V35E Instruction Manual: Bar Code Display Interface: Chapter 7 Serial Communication
Pages 109 to 120 of 156, from BL-V35E Instruction Manual: Bar Code Display Interface
The original document is the PDF (1.3 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-V35E
Page 109
Chapter 7 Serial Communication This chapter describes the data send format used when a personal computer is connected to the serial interface of the BL-V35E. It also describes the command send/control method.
7.1
Serial Communication ...................................................... 100
7.1.1 Communication format of the BL-V35E ............................... 100 7.1.2 Setting the serial communication ......................................... 100 7.2
Details about Data Communication ................................ 101
7.2.1 7.2.2 7.2.3 7.2.4 7.2.5 7.2.6
Selecting communication protocols ..................................... 101 Capacity of the send buffer .................................................. 102 Send format ......................................................................... 102 Output data type .................................................................. 102 Output data when the step verification function is used ...... 103 Output data when the serial No. check function is used ...... 103
7.3
Details about Command Communication ...................... 104
7.3.1 Command communication format ........................................ 104 7.3.2 Command list ....................................................................... 104
Page 110
Chapter 7
7.1
Serial Communication
Serial Communication Using serial communication, data can be sent from the BL-V35E to a personal computer and the BL-V35E can be directly controlled by a personal computer.
7.1.1 Communication format of the BL-V35E The following two types of communication formats are available for the BL-V35E. • Data communication The bar code data (ASCII codes) read by a connected bar code reader is sent to a personal computer. •
Command communication Commands (ASCII codes) are sent from a personal computer, and the BL-V35E is controlled directly.
Note: Communication is always performed using ASCII codes.
7.1.2 Setting the serial communication Before starting serial communication, first set the same communication settings to both of the personal computer and the BL-V35E (serial port 1). ■ Settings in the BL-V35E In the communication set mode for serial port 1, set the following (➮ See p. 85). • • •
Set the baud rate, data length, parity and stop bit length. Set “Connect Unit” to “PC”. Set the send data type and send format.
■ Settings in the personal computer Set the DIP switch and memory switch in the personal computer according to the settings for the BL-V35E. Set the synchronization method to “start-stop method”. * For information about the settings in the personal computer, refer to the personal computer’s Instruction Manual.
7
100
Page 111
Chapter 7 Serial Communication
7.2
Details about Data Communication Using data communication, the readout bar code data can be sent to a personal computer.
7.2.1 Selecting communication protocols The following four types of communication protocols are available. Select any one in communication set mode for serial port 1. Typically, you should select “No handshaking”. ■ No handshaking After sending the output data, the BL-V35E does not wait for a response from the personal computer, but continues to send data. In other words, there are no communication procedures.
Output data PRESET
PRESET
DATA
COUNT
No.
BACK
ABC..
OPTION
7
8
9
SPACE
5 4 3 2 1 IN 4 3 2 1 OUT 8 7 6 5 OK 10 9
4
NG
PRESET
CANCEL
ENTER
5
6
1
2
3
0
CLEAR
KEYENCE
BL-V35E
■ PASS/RTRY protocol • After sending the output data, the BL-V35E waits for a response of “PASS [CR]” or “RTRY [CR]” from the personal computer. If neither response is given, the BL-V35E continues to wait for a response and does not send the next data. •
•
When receiving new bar code data while waiting for “PASS [CR]”, the BL-V35E stores new data in the send buffer (➮ See p. 102). If the send buffer capacity is insufficient for the data to be stored, an error message is displayed (➮ See p. 144). Even while the BL-V35E is waiting for “PASS [CR]”, command communication is enabled. Output data
PRESET
PRESET
DATA
COUNT
No.
BACK
ABC..
OPTION
7
8
9
4
5
6
1
2
3
0
CLEAR
SPACE
5 4 3 2 1 IN 4 3 2 1 OUT 8 7 6 5 OK 10 9 NG
PRESET
CANCEL
ENTER
KEYENCE BL-V35
Response (PASS CR or RTRY CR )
Response type and operation Response PASS [CR] (normal processing) RTRY [CR] (request for resend)
Operation Normal termination Next data can be sent. The BL-V35E sends the data again, and waits for a response (PASS).
■ ACK/NAK protocol • With this protocol, [ACK] (06H) is used instead of PASS [CR] which is used in the PASS/RTRY protocol, and [NAK] (15H) is used instead of RTRY [CR]. Operation is equivalent to the PASS/RTRY protocol except that different characters are used in the responses.
101
7
Page 112
Chapter 7
Serial Communication ■ RTS/CTS protocol • By setting the RTS signal to OFF via the RS-232C, data sending can be paused. When the RTS signal is set to ON, data is sent. •
When receiving new bar code data while the RTS signal is OFF, the BL-V35E stores new data in the send buffer. (For the capacity of the send buffer, refer to “Capacity of the send buffer” below.) If the send buffer capacity is insufficient for the data to be stored, an error message is displayed (➮ See p. 144).
•
Even while the RTS signal is OFF, command communication is enabled. In this case, a response (OK [CR]) to a received command is also saved in the send buffer.
7.2.2 Capacity of the send buffer The send buffer in the BL-V35E can store up to 99 pieces of data. If the amount of data is 100 or more, the message “Send Buffer Over” is displayed and operation stops (➮ See p. 144).
7.2.3 Send format The following six types of send formats are available for the output data. Select any one according to the specifications and communication program of the equipment that will receive the output data. Set the send format in “Send Form” in communication set mode for serial port 1 (➮ See p. 86). 1 2 3 4 5 6 *
7
Output data is not sent. STX Output data ETX Output data CR Output data CR LF ESC Output data CR ESC Output data CR LF
In addition to these formats, there are commands for setting the send format of the output data (➮ See p. 107).
7.2.4 Output data type The following four types of output data are available. Set the output data type in “Send Data” in communication set mode for serial port 1 (➮ See p. 86). ■ Bar code data The bar code data read by a bar code reader connected to serial port 2 is sent. When the [ENTER] key is pressed, the following data is output in serial format. •
When the [ENTER] key is pressed while the saved preset data is displayed, the displayed preset data is sent.
•
When the [ENTER] key is pressed while preset No. 0 is displayed, “Preset NG” is sent.
•
When the [ENTER] key is pressed while an unregistered preset No. is displayed, “empty” is sent.
■ Preset No. A matching preset No. is sent. • 001 to 399 When the readout data matches the preset data of a preset between No. 1 and 399. •
102
000 When the readout data does not match any preset data.
Page 113
Chapter 7 Serial Communication ■ Output No. An output No. corresponding to the matching preset No. is sent. • 001 to 399 Output No. corresponding to the matching preset No. •
999 NG output
■ Reference data The reference data is sent. If the reference data is not saved, the readout data is sent.
7.2.5 Output data when the step verification function is used When the step verification function is used, the output data is as follows. ■ When the output data is “bar code data” or “reference data” • When the first data is read “p:” is added to the head of the data. •
When the second data is read In the case of OK: “o:” is added to the head of the data. In the case of NG: “x:” is added to the head of the data.
Examples • When the first readout data matches the second readout data When the first data is read: p : 4912345 When the second data is read: o : 4912345 •
When the first readout data does not match the second readout data When the first data is read: p : 4912345 When the second data is read: x : 4912346
■ When the output data is “preset No.” or “output No.” • When the first data is read Normal data (Matching preset No. and output No. are sent.) •
7
When the second data is read In the case of OK: “400” is sent. In the case of NG: “401” is sent.
7.2.6 Output data when the serial No. check function is used When the serial No. check function is used, the output data is as follows. ■ When the output data is “bar code data” or “reference data” The readout bar code data is sent. ■ When the output data is “preset No.” or “output No.” • In the case of OK: “001” is sent. • In the case of NG: “000” is sent.
103
Page 114
Chapter 7
7.3
Serial Communication
Details about Command Communication This section describes command communication in the BL-V35E.
7.3.1 Command communication format Command communication is performed as follows.
1 Command PRESET
PRESET
DATA
COUNT
No.
BACK
ABC..
OTION
7
8
9
4
5
6
1
2
3
0
CLEAR
SPACE
5 4 3 2 1 IN 4 3 2 1 OUT 8 7 6 5 OK 10 9 NG
PRESET
CANCEL
ENTER
KEYENCE
BL-V35E
2Response
1. Send a command from the personal computer to the BL-V35E. Follow the format shown in this manual when you send the command with parameters. No space is required between the command and the parameters. 2. After receiving the command, the BL-V35E sends back a response. • When the received command is to write data to the BL-V35E or change a setting, the BL-V35E sends back “OK [CR]”.
7
•
When the received command is to read data or a setting from the BL-V35E, the BL-V35E sends back the contents of the command.
•
If the command cannot be processed, the BL-V35E sends back “NG [CR]”.
•
While the [PRESET No.], [DATA], [COUNT] or [OPTION] key is being used, the BL-V35E sends back “BUSY [CR]” and the command is not executed.
Note 1: ”[LF]” can be added to the end of a series of commands. However, “[LF]” is not added in a response. Note 2: When “[ESC]” is added to the head of a sent command, the receive buffer of the BL-V35E is cleared by the “[ESC]”. If unnecessary characters are being stored in the BL-V35E’s receive buffer due to abnormal character conversion during communication, add “[ESC]” to a command to be sent.
7.3.2 Command list The following commands are available in the BL-V35E. Manipulation of preset data These commands save and read the preset data. ■ Saving, changing and clearing the preset data Send command : PSETmmm#nnn...[CR] mmm = 001 to 399: Preset No. nnn...= Preset data (up to 32 characters) Response : OK[CR] NG[CR] BUSY[CR] Description : When “nnn...” is omitted (PSETmmm#[CR]), the preset data for preset No. mmm is cleared.
104
Page 115
Chapter 7 Serial Communication ■ Reading the preset data Send command : PREDmmm[CR] mmm = 001 to 399: Preset No. Response : nnn...[CR] nnn...= Preset data (up to 32 characters) Description : When preset data is not saved, “(empty) [CR]” is sent back. Manipulation of reference data These commands save and read the reference data. ■ Saving, changing and clearing the reference data Send command : OSETmmm#nnn...[CR] mmm = 001 to 399: Preset No. nnn...= Reference data (up to 32 characters) Response : OK[CR] NG[CR] BUSY[CR] Description : When “nnn...” is omitted (OSETmmm#[CR]), the reference data for preset No. mmm is cleared. ■ Reading the reference data Send command : OREDmmm[CR] mmm = 001 to 399: Preset No. Response : nnn...[CR] nnn...= Reference data (up to 32 characters) Description : When the reference data is not saved, “(empty) [CR]” is sent back. Parallel output setting These commands set and read an output No. corresponding to a preset No. ■ Parallel output setting Send command : WOGPmmm#nnn[CR] mmm = 000 to 999: Preset No. nnn = 000 to 399: Output No. 999: NG output Response : OK[CR] NG[CR] BUSY[CR]
7
■ Reading the parallel output setting Send command : ROGPmmm[CR] mmm = 000 to 999: Preset No. Response : nnnCR] nnn = 000 to 399: Output No. 999: NG output Manipulation of the counter These commands read and write a counter value for a specified preset No. ■ Writing the counter Send command : WRCTmmm#nnnnnn[CR] mmm = 000 to 999: Preset No. nnnnnn = 000000 to 999999: Counter value Response : OK[CR] NG[CR] BUSY[CR] ■ Reading the counter Send command : RDCTmmm[CR] mmm = 000 to 999: Preset No. Response : nnnnnn[CR] nnnnnn = 000000 to 999999: Counter value
105
Page 116
Chapter 7
Serial Communication Changing and reading the BL-V35E’s operation status These commands change the operation of the BL-V35E and read the operation status. ■ Entering preset mode Send command : SMDP[CR] Response : OK[CR] NG[CR] BUSY[CR] Description : When the serial No. check function is used, this command functions in the same way as the [PRESET] key (resets the serial No. data). ■ Entering RUN mode Send command : SMDR[CR] Response : OK[CR] NG[CR] BUSY[CR] Description : When the serial No. check function is used, this command functions in the same way as the [CANCEL] key (returns to the start value of the serial No. data). ■ Selecting a preset No. to be displayed Send command : SNUMmmm[CR] mmm = 000 to 399: Preset No. Response : OK[CR] NG[CR] BUSY[CR] Description : When the preset-active function is used, a preset No. can be selected. ■ Reading the operation mode Response command : RMOD[CR] Response : PRE[CR] RUN[CR] PRE: Preset mode RUN: RUN mode ■ Reading a displayed preset No. Send command : RNUM[CR] Response : mmm[CR] mmm = 000 to 399: Preset No. Description : When the preset-active function is used, a selected preset No. can be read.
7
Initialization and software reset of each setting These commands initialize and software-reset the settings in the BL-V35E. ■ Initializing all settings Send command : DFLT[CR] Response : OK[CR] NG[CR] BUSY[CR] ■ Initializing the preset data Send command : DFLP[CR] Response : OK[CR] NG[CR] BUSY[CR] ■ Initializing the reference data Send command : DELO[CR] Response : OK[CR] NG[CR] BUSY[CR] ■ Initializing the counter Send command : DELC[CR] Response : OK[CR] NG[CR] BUSY[CR]
106
Page 117
Chapter 7 Serial Communication ■ Initializing the parallel output setting Send command : DELG[CR] Response : OK[CR] NG[CR] BUSY[CR] ■ Software reset Send command : DLER[CR] Response : OK[CR] NG[CR] Setting the send format These commands allow you to set the desired send format. ■ Setting the send format < Setting of the header > Send command : WDC1mnnn...[CR] m = 1 to 8: Number of characters in the header nnn...= Header (up to 8 characters) Response : OK[CR] NG[CR] BUSY[CR] Description : Use ASCII codes to specify the characters to be set. < Setting of the terminator > Send command : WDC2mnnn...[CR] m = 1 to 8: Number of characters in the terminator nnn...= Terminator (up to 8 characters) Response : OK[CR] NG[CR] BUSY[CR] Description : Use ASCII codes to specify the characters to be set. ■ Setting the setting function for the send format Send command : WMDS[CR] Response : OK[CR] NG[CR] BUSY[CR] Description : After this command has been sent, the header and terminator can be set.
Example When setting the format “[S0H] 01 [Bar code data] A [CR]” [SOH] WDC1
3
0
1
2
4
WMDS
[CR]
0
3
1
[CR]
A WDC2
1
0 3
1
0
7
D
[CR]
[CR]
Send When the bar code data “12345” is read, “[S0H] 0112345A [CR]” is sent back.
■ Resetting the setting function for the send format Send command : WMDN[CR] Response : OK[CR] NG[CR] BUSY[CR] Description : When this command is sent, the setting function for the header and terminator is reset. ■ Reading the setting of the send format < Setting of the header > Send command : RDC1[CR] Response : mnnn...[CR] m = 1 to 8: Number of characters in the header nnn...= Header (up to 8 characters)
107
Page 118
Chapter 7
Serial Communication < Setting of the terminator > Send command : RDC2[CR] Response : mnnn...[CR] m = 1 to 8: Number of characters in the terminator nnn...= Terminator (up to 8 characters) LCD display control This command displays characters on the LCD display. Send command : SLCD[CR] nnn...= Characters to be displayed (up to 32 characters) Response : OK[CR] NG[CR] BUSY[CR] Description : Even while the characters specified by this command are displayed, the displayed contents will be switched when the status changes (by reading a bar code, etc.).
Example When displaying “ “ on the LCD display Send “SLCD [CR]”. Dummy bar code input This command executes a dummy bar code input. Send command : BCR#nnn...[CR] nnn...= Bar code data (up to 32 characters) Response : Not given Description : This command effects the operation performed when the readout data is sent from a bar code reader during serial communication. For this data, verification with the preset data and parallel output can be performed. Sending data to serial port 2 This command sends data to serial port 2.
7
Send command : SOUTnnn...[CR] nnn...= Data (command) to be sent to serial port 2 Response : Not given Description : This command can send a command to a bar code reader connected to serial port 2. However, a response from the bar code reader to the sent command is processed as the data read by the bar code reader. Release of parallel inputs and outputs to the outside These commands let the parallel interface be used by an external unit. When parallel inputs and outputs are released to the outside, parallel inputs and outputs of the BL-V35E can be used as external inputs and outputs of a personal computer. After releasing parallel inputs and outputs to the outside, control them using parallel I/O direct control commands (➮ See p. 109). ■ Releasing parallel inputs to the outside Send command : WINMmmmm[CR] m=0: Does not release a parallel input to the outside. 1: Releases a parallel input to the outside. Response : OK[CR] NG[CR] BUSY[CR] Description : The parallel inputs are handled in the order of “IN5, IN4, IN3, IN2, IN1”.
108
Page 119
Chapter 7 Serial Communication ■ Releasing parallel outputs to the outside Send command : WOTMmmmmmmmmmm[CR] m=0: Does not release a parallel output to the outside. 1: Releases a parallel output to the outside. Response : OK[CR] NG[CR] BUSY[CR] Description : The parallel outputs are handled in the order of “OUT10, OUT9, OUT8, OUT7, OUT6, OUT5, OUT4, OUT3, OUT2, OUT1”.
Example When releasing OUT9 and OUT4 to the outside OUT10 OUT9
W
0
T
M
0
1
0
OUT1
0
0
0
1
0
0
0
[CR]
OUT4=1
OUT9=1
Send the following command.
■ Reading the parallel input status Send command : RINM[CR] Response : mmmmm[CR] m=0: Not released to the outside. 1: Released to the outside. Description : The parallel inputs are handled in the order of “IN5, IN4, IN3, IN2, IN1”. ■ Reading the parallel output status Send command : ROTM[CR] Response : mmmmmmmmmm[CR] m=0: Not released to the outside. 1: Released to the outside. Description : The parallel outputs are handled in the order of “OUT10, OUT9, OUT8, OUT7, OUT6, OUT5, OUT4, OUT3, OUT2, OUT1”.
Example When “0010011100 [CR]” is sent back OUT1
OUT10
0
0
1
0
OUT8=1
0 1
1
1
0
0
[CR]
OUT5=1 OUT4=1 OUT3=1
It indicates that OUT8 and OUT5 to OUT3 are released to the outside.
Direct control of parallel inputs and outputs These commands directly control inputs and outputs of the parallel interface. By using the following commands, parallel inputs and outputs in the BL-V35E can be directly controlled. ■ Controlling parallel inputs directly Send command : RIND[CR] Response : mmmmm[CR] Description : The parallel inputs are handled in the order of “IN5, IN4, IN3, IN2, IN1”.
109
7
Page 120
Chapter 7
Serial Communication ■ Controlling parallel outputs directly Send command : SOTDmmmmmmmmmm[CR] m=0: OFF 1: ON Response : OK[CR] NG[CR] BUSY[CR] Description : The parallel outputs are handled in the order of “OUT10, OUT9, OUT8, OUT7, OUT6, OUT5, OUT4, OUT3, OUT2, OUT1”.
Example When turning on and off OUT10 of the BL-V35E from a personal computer • To release OUT10 to the outside, send “WOTM1000000000 [CR]”. •
To turn on OUT10 directly, send “SOTD1000000000 [CR]”. To turn off OUT10 directly, send “SOTD0000000000 [CR]”.
■ Reading the output result of parallel outputs Send command : ROTD[CR] Response : mmmmmmmmmm[CR] m=0: OFF 1: ON Description : This command reads the parallel output status without regard to whether or not it is being released to the outside. The parallel outputs are handled in the order of “OUT10, OUT9, OUT8, OUT7, OUT6, OUT5, OUT4, OUT3, OUT2, OUT1”.
7
110