The text of a manual · part 14 of 16
BL-V35E Instruction Manual: Bar Code Display Interface: Chapter 8 PLC Link
Pages 121 to 132 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 121
Chapter 8 PLC Link This chapter describes the operating procedure and setting procedure used when the BL-V35E is used in the PLC link.
8.1
PLC Link ............................................................................ 112
8.1.1 PLC link ............................................................................... 112 8.1.2 List of available PLC units ................................................... 112 8.1.3 Available devices ................................................................. 113 8.2
Setting ................................................................................ 114
8.2.1 Settings in the BL-V35E ....................................................... 114 8.2.2 Settings in the PLC .............................................................. 114 8.3
Assigning Devices ............................................................ 116
8.3.1 Data write area .................................................................... 116 8.3.2 Detailed description on assignment ..................................... 116 8.3.3 Details of assignment when the step verification function is used .............................................................................. 120 8.3.4 Details of assignment when the serial No. check function is used .............................................................................. 120 8.4
PLC Link Error .................................................................. 121
8.4.1 Troubleshooting of PLC link error ........................................ 121 8.5
Communication Time ....................................................... 122
Page 122
Chapter 8
8.1
PLC Link
PLC Link This section provides an overview of the PLC link.
8.1.1 PLC link Using the PLC link, the data read by a bar code reader connected to serial port 2 of the BL-V35E can be directly written to the internal memory of a programmable controller (PLC) connected to serial port 1. Because the BL-V35E handles the memory of the PLC directly, communication programs are not required in the PLC and the program creation process can be reduced. While the BL-V35E is used in the PLC link, the following restrictions are imposed compared to when serial communication is performed using a computer. •
Because the PLC cannot send commands to the BL-V35E, neither preset data nor reference data can be saved. However, the read control address is provided to start and end reading by a connected bar code reader.
•
The test mode cannot be started up in a bar code reader connected to serial port 2.
Note: The read control address is available only when a BL series bar code reader is connected. When any other bar code reader (manufactured by KEYENCE or another company) is connected, the read control address is not available but other PLC link control is available.
8.1.2 List of available PLC units The BL-V35E can be linked to any of the following PLC units.
8
112
KEYENCE KV series
(CPU built-in port) KV-10/16/24/40/80, KV-300, Visual KV Series (Personal computer link unit) KV-L2
Mitsubishi Electric Corporation MELSEC-A series
(CPU built-in port) A2CCPUC24, A2CCPUC24-PRF (Computer link unit) AJ71C24, AJ71C24-S❒, AJ71UC24, AOJ2-C214-S1, A1SJ71(U)C24-R2/PRF
OMRON SYSMAC-C series
(CPU built-in port) C20H/28H/40H/60H, C200HS(CPU21/23/31/33), C200HE(CPU42), C200HG(CPU43/63), C200HX(CPU44/64) (Host link unit) C200H-LK201(-V1), C500-LK203, C500-LK201-V1, C120-LK201-V1 (Communication board) C200HW-COM02/COM04/COM05/COM06
OMRON SYSMAC-CQM1 series
(CPU built-in port) CQM1(CPU21/41/42/43/44)
OMRON SYSMAC-CV series
(CPU built-in port) CV500, CV1000, CV-M1 (Host link unit) CV500-LK201
Page 123
Chapter 8 PLC Link
8.1.3 Available devices The list below shows PLC devices supported by the BL-V35E. In the MELSEC-A, either data register or file register should be selected. In the MELSEC-A and the SYSMAC-A, the available range may be narrower in some models. For details, refer to the PLC’s Instruction Manual. PLC
Device name
Available range
KV-10/16
Data memory
DM0000 to DM0999
KV-24/40/80, Visual KV
Data memory
DM0000 to DM1999
KV-300 MELSEC-A SYSMAC-C
Data memory
DM0000 to DM8999
Data register
D0000 to D8191
File register
R0000 to R8191
Data memory
DM0000 to DM6143
In the MELSEC-A, extended file registers are also supported. When the block No. is set in communication set mode for serial port 1 in the BLV35E, the specified extended file register can be used. •
When the block No. is set to “0”, extended file registers of the block Nos. specified by a PLC program are used.
•
If the block No. is not set (in the setting in the BL-V35E or a PLC program), file registers inside the CPU are used.
8
113
Page 124
Chapter 8
PLC Link
8.2 Setting This section describes the settings for the BL-V35E and the PLC.
8.2.1 Settings in the BL-V35E In the set mode of the BL-V35E, set serial port 1 as follows. For differences in the settings due to the link unit and PLC type, refer to “Settings in the PLC” on the next page. Set the following in communication set mode for serial port 1. • • • • • • •
Align the settings of “Port 1 Baud” and “Port 1 Form” (data length, parity and stop bit length) to those in the PLC. Set “Connect Unit” to “PLC Link”. Select the PLC model to be connected. When using the KV-L2 in link mode, select “SYSMAC-C”. Set the PLC unit No./station No. Set “Support Unit” to “Data Register” or “File Register”. (This parameter can be set only when the MELSEC-A is used.) Set “DM Address”. Set “PLC Tim Area”.
Note: Never change the setting of the timing ON/OFF command (LON/LOFF) in a connected BL series bar code reader. If it is changed, the read timing cannot be controlled in the PLC link.
8.2.2 Settings in the PLC Set the following according to the PLC unit or link unit to be used (➮ See p. 88). ■ Settings in the MELSEC-A Series • Align the baud rate, data length, parity and stop bit length to those in the BLV35E. • Align the station No. to that in the BL-V35E. • Set the mode to the protocol mode of format 4. • Set the main channel to “RS-232C”. • Select “with sum check”. • Select “write enabled in RUN”. • Set “computer link/multi-drop selection” to “computer link” (in the AJ71UC24 only).
8
■ Settings in the SYSMAC-C Series • Align the baud rate, data length, parity and stop bit length to those in the BLV35E. • Align the unit No. to that in the BL-V35E. • Set the command level to “Levels 1, 2 and 3 are valid.” • Set the “1:1/1:N” procedure to “1:N”. • Set the I/O port selection to “RS-232C”. • Set the synchronization setting to “internal”. • Set absence/presence of 5 V supply to “5 V not supplied”. • Set the CTS selection to “0 V (always ON)”. * Some of the settings such as “I/O port selection”, “synchronization setting”, “absence/presence of 5 V supply” and “CTS selection” may not be available in some link units.
114
Page 125
Chapter 8 PLC Link ■ Settings in the KV series serial port In the KV series serial port, the communication condition is fixed as follows. • Baud rate: 9600 bit/s • Data length: 8 bits • Parity: Even • Stop bit length: 1 bit Align the settings in the BL-V35E to those above. Set “Connected PLC” in the BLV35E to “KEYENCE KV”. No other settings are required. ■ Settings in the KV-L2/KV mode • Set the communication mode in the KV-L2 to “KV mode”. Set “Connected PLC” in the BL-V35E to “KEYENCE KV”. • In the KV mode, the communication condition is fixed as follows. Baud rate: 9600 bit/s Data length: 8 bits Parity: Even Stop bit length: 1 bit Align the settings in the BL-V35E to those above. • Set the station No. to “00”. • When using port 2 of the KV-L2, set the port 2 selector switch to “RS-232C”. ■ Settings in the KV-L2/link mode • Set the communication mode in the KV-L2 to “link mode”. Set “Connected PLC” in the BL-V35E to “SYSMAC-C”. • Align the baud rate, data length, parity and stop bit length to those in the BLV35E. • Align the unit No. to that in the BL-V35E. • When using port 2 of the KV-L2, set the port 2 selector switch to “RS-232C”.
8
115
Page 126
Chapter 8
8.3
PLC Link
Assigning Devices This section describes assignment of devices.
8.3.1 Data write area The data area used to control the BL-V35E is provided in the memory area (D area or DM area) inside the PLC. When the DM head address is set in communication set mode for serial port 1 in the BL-V35E, the data write head area is automatically assigned from that area (➮ See p. 88). ■ Data write head area The area “set head address + 00” specifies the area in which data is to be written. The area “set head address + 01/02” is used to give a read timing from the PLC to a BL series bar code unit connected to serial port 2 of the BL-V35E. This area is not assigned when “PLC Tim Area” is set to “OFF” in the BL-V35E. (In this case, this area can be used for another purpose.) Address
Description
Reference page
+00
Data write head address p. 118
+01
Read timing area p. 117
+02
Read timing response area p. 117
+03 to +04
Reservation area
––
■ Data write destination area In this area, the bar code data read by the BL-V35E is written from the data write head address set by address “+00” (when the data write head address is set to “A”). Address
8
Description
A + 00
Data write flag area
A + 01
Counter value
A + 02
Reservation
A + 03
Preset No.
A + 04
Output No.
A + 05
Number of digits
A + 06
1st digit of bar code data
A + 07
2nd digit of bar code data
A + 08
3rd digit of bar code data
:
Reference page p. 118 p. 119 p. 119
:
A + 37
32nd digit of bar code data
8.3.2 Detailed description on assignment Address
+00
Description
Data write head address
This area specifies the head address of the area in which the readout data is written. (Write it as binary data.) Head address000
DM000
100
DM000
Flag
DM101
Counter value
DM102
Reservation
DM103
Preset No.
DM104
Output No.
:
116
Page 127
Chapter 8 PLC Link Address
+01 to +02
Description
Read timing/timing input response area
This area is used to give a read timing to a BL series bar code reader connected to serial port 2. Never use this area when a photoelectric sensor, etc. is connected to the BL-V35E to provide a timing input. This area is not assigned when “PLC Tim Area” is set to “OFF” in the BL-V35E. (In this case, this area can be used for another purpose.) Note: The read control address is available only when a BL series bar code reader is connected. While any other bar code reader (manufactured by KEYENCE or another company) is connected, the read control address is not available but other PLC link control is available. The read timing area (address “+01”) is used to start reading (turn on the laser) in a BL series bar code reader. The read timing input response area (address “+02”) is used to confirm whether the address “+01” is normally transferred to the BL series bar code reader. When the BL series confirms the address “+01” (that is, when processing is completed), the address “+02” becomes “1”. Address
Description
+01
Read timing area
+02
Timing input response area
Reference page 1: Timing ON 0: Timing OFF 1: Processing completed 0: Processing not completed
Operating procedure 1. Set the address “+02” to “0”. 2. Set the address “+01” to “1” when causing a BL series bar code reader connected to the BL-V35E to start reading (that is, when setting the reading timing to ON). 3. When the BL-V35E has recognized a change in the address “+01”, the address “+02” becomes “1” and reading starts. 4. When the address “+02” becomes “1”, it means that the timing ON has functioned normally in the BL-V35E. If the address “+02” does not become “0”, it means that the BL-V35E has not recognized the address “+01” yet. Never perform processing that changes the address “+01” to “0” immediately. Ensure that the address “+02” has changed to “1”, and then return it to “0”. 5. When a bar code is read, new data is written to addresses “A+05” to “A+37”. 6. To set the read timing to OFF, set the address “+01” to “0”. 7. When the BL-V35E has recognized a change in the address “+01”, the address “+02” becomes “1” and the read timing is turned OFF. 8. When the address “+02” becomes “1”, it means that the timing OFF has functioned normally in the BL-V35E. If the address “+02” does not become “1”, it means that the BL-V35E has not recognized the address “+01” yet. Never perform processing that changes the address “+01” to “0” immediately. Ensure that the address “+02” has changed to “1”, and then return it to “0”. 9. When a read error has occurred, a read error code (ERROR) is written to addresses “A+05” to “A+37”.
117
8
Page 128
Chapter 8
PLC Link Note: The address “+02” monitors whether or not the BL-V35E has recognized the address “+01” normally. When the read timing is set to ON and OFF at high speed using the address “+01”, the BL-V35E may not recognize a change in the address “+01” and the read timing may not turn ON or OFF. In such a case, make a program that forces the address “+02” to confirm whether the BL-V35E has recognized the address “+01”. When the above recognition error does not occur, monitoring by the address “+02” (1, 3, 4, 7 and 8 above) is not required. Address
A+00 (“A” is the data write head address specified by “+00”)
Description
Data write flag area
This area is used as a flag to indicate that bar code data has been written. This area can be used in the following two methods. ■ Real-time processing • Write a number “1” or “0” here. •
While a bar code reader connected to the BL-V35E is reading a bar code and the BL-V35E is writing the data to the PLC, “1” is set.
•
When the data has been written, the flag becomes “0” to indicate that new data has been written to addresses “A+05” to “A+37”. In other words, the data is valid while the A+00 address is “0”.
•
If the timing at which a bar code reader connected to the BL-V35E reads a bar code is faster than communication in the PLC link, unwritten data is stored in the send buffer of the BL-V35E (See “Capacity of the send buffer” p. 102). If the data to be stored exceeds the capacity of the send buffer, a buffer overflow error occurs and an error message is displayed.
Use example 1: Normally set the address “A+00” to “0”. While data is being written, the address “A+00” is “1”. When it becomes “0” (at the rising edge), process the data written in addresses “A+05” to “A+37” using a program. Use example 2: Normally set the address “A+00” to “1”. When data has been written, the address “A+00” becomes “0”. Process the data written in addresses “A+05” to “A+37” using a program. As soon as processing is completed, set the address “A+00” to “1”. Using this setting, the time at which the address “A+00” becomes “0” can be used as the timing point at which new data is written.
8
Note: When bar codes are read consecutively, new data may be overwritten during real-time processing before processing of data by a program inside the PLC is completed. In this case, use sequence processing. ■ Sequence processing • Write a number “2” or “3” here.
118
•
While the address “A+00” is “2”, new data is written.
•
When the data has been written, the flag becomes “3” to indicate that new data has been written to addresses “A+05” to “A+37”.
•
As soon as processing by a program is completed, set the address “A+00” to “2”. If it is not set to “2”, new data cannot be written.
•
Unwritten data is stored in the send buffer of the BL-V35E. If the data to be stored exceeds the capacity of the send buffer, a buffer overflow error occurs and an error message is displayed.
Page 129
Chapter 8 PLC Link Address
A+01 to A+04
Description
Diversified data area
This area is used to write a counter value, matched preset No. and corresponding output No. when the counter function (See p. 42) is used. (If the counter function is not used, the counter value is not written.) Address
Description
A + 01
Counter value
A + 02
Reservation area
A + 03
Preset No.
A + 04
Output No.
Reference page 0 to 65535 (binary) * Data larger than “65536” cannot be written. –– 1 to 399 (binary): Preset No. 0: Verification NG 1 to 399 (binary): Output No. 999 (binary): NG output
Address
A+05 to A+37
Description
Data (number of digits and data) write area
•
In the address “A+05”, the number of digits of data is written.
•
In addresses “A+06” to “A+37”, the readout bar code data is written in ASCII codes (2-digit hexadecimal) one digit at a time.
•
If a read error has occurred in a connected bar code reader, a read error code (ERROR in a BL series bar code reader) is written. Address
Description
Reference page
A + 05
Number of digits of data (1 to 32) 1 to 32 (binary): Number of digits
A + 06
1st digit of readout data
One ASCII code
A + 07
2nd digit of readout data
One ASCII code
: A + 37
:
:
32nd digit of readout data
One ASCII code
Note: While the BL-V35E is set to monitor mode, data is not written.
Example 1 When a bar code reader has read “KE12” A + 05
4
A + 06
$004B
A + 07
$0045
A + 08
$0031
A + 09
$0032
8
← Number of digits
← Written in ASCII codes (hexadecimal)
Example 2 When a read error (ERROR) has occurred in a BL series bar code reader A + 05
5
A + 06
$004B
A + 07
$0052
A + 08
$0052
A + 09
$004F
A + 10
$0052
← Number of digits
← Written in ASCII codes (hexadecimal)
119
Page 130
Chapter 8
PLC Link
8.3.3 Details of assignment when the step verification function is used When the step verification function is used, addresses are assigned as follows. •
When the first data is read Same as in normal operation
•
When the second data is read Address
Description
A + 03
Preset No.
A + 04
Output No.
Reference page 400 (binary): OK 401 (binary): NG 400 (binary): OK 401 (binary): NG
Other addresses are equivalent to those in normal operation.
8.3.4 Details of assignment when the serial No. check function is used When the serial No. check function is used, addresses are assigned as follows. Address
Description
A + 03
Preset No.
A + 04
Output No.
Reference page 1: OK 0: NG 1: OK 0: NG
Other addresses are equivalent to those in normal operation.
8
120
Page 131
Chapter 8 PLC Link
8.4 PLC Link Error When a communication error has occurred in the PLC link, communication is aborted.
8.4.1 Troubleshooting of PLC link error When a communication error occurs, check the following items. •
Check whether the baud rate, data length, parity and stop bit length are the same in the BL-V35E and the PLC (link unit).
•
Check whether “Connect Unit” in the settings for serial port 1 is set to “PLC Link”.
•
Check whether the settings in the PLC are correct (➮ See p. 114).
•
Check whether the cable wiring is correct, whether disconnection is not being detected and whether the cable is connected to serial port 1 of the BL-V35E. ➮ See pp. 28 to 30, and confirm the wiring using testers.
•
Check whether the device range has exceeded the allowable range. If the area occupied by the BL-V35E set by the head address is not present in the PLC, communication is disabled.
•
Check whether the status of the link unit is normal.
To restart the BL-V35E, press the [CLEAR] key. For the settings in the link unit, refer to the link unit’s Instruction Manual.
8
121
Page 132
Chapter 8
8.5
PLC Link
Communication Time This section describes communication time in the BL-V35E. ■ Communication time required to send data The table below shows the time required to send data from the BL-V35E to the PLC. The time shown below may change depending on the scan time and PLC type. •
When the RS-232C baud rate is set to 9600 bits/s Number of digits of data
MELSEC-A
SYSMAC-C
KV (KV mode)
10
Approx. 390 ms
Approx. 410 ms
Approx. 920 ms
20
Approx. 450 ms
Approx. 460 ms
Approx. 1260 ms
32
Approx. 510 ms
Approx. 540 ms
Approx. 1650 ms
■ Communication time required to start reading in the read timing area When reading by a BL series bar code reader is controlled using the read timing area, provide a timing ON command to the PLC and obtain the communication time between when the command is sent and when it is received by the BL series bar code reader. •
8
122
When the RS-232C baud rate is set to 9600 bits/s MELSEC-A
SYSMAC-C
KV (KV mode)
Approx. 220 ms
Approx. 280 ms
Approx. 210 ms