You are on page 1of 20

355GB

High-speed, High-capacity Machine Vision System

CV-X Series
Easy Setup Guide
Control/Communication PLC-Link
(KEYENCE KV Series)
Contents

Easy Setup Guide: Control/Communication PLC-Link (KEYENCE KV Series)

1. Establishing the PLC-Link (Ethernet PLC-Link) Page 3

2. Establishing the PLC-Link (RS-232C PLC-Link) Page 6

3. Outputting the Measured Value/Judged Value (PLC-Link) Page 9

4. Controlling the Controller (PLC-Link) Page 12

Trademarks
Product names, etc. noted in this document are registered trademarks or trademarks of their respective companies.
The ™ mark and ® mark have been omitted in this manual.

KEYENCE CORPORATION. Vision System Division ‐2‐ www.keyence.com


1. Establishing the PLC-Link (Ethernet PLC-Link) [Keyence KV Series]

✎Checking the Global Settings of the CV-X Series


This section describes how to establish the PLC‐Link.

[Important] If it fails, establish a one-to-one connection between the PLC and CV-X, and follow this manual to configure the settings
and check the operations.
Confirm that it operates properly, and change settings if necessary.

1 Select [Global] > [Communications & I/O] > [Network] on the controller, and then configure the network (Ethernet)
settings for the CV-X.

Configure the network settings for CV‐X.


IP Address: 192.168.0.10
Subnet Mask: 255.255.255.0
Default Gateway: 0.0.0.0

2 Select "OK" to close the "Network Settings" screen, select [Global] > [Communications & I/O] > [PLC-Link], and then
configure the PLC-Link settings.
Configure the PLC‐Link settings.

Mode: PLC- Link (Ethernet)


PLC Type: KV Series
IP Address: 192.168.0.20
Port: 8502
Resend Time (ms): 10000

* "IP Address" above indicates the one for


the KV Series that will be connected. Set an
Be careful not to use the address whose fourth number differs from
same IP address.
that of the "Controller IP Address" set in step
1.

Decimal Point: Fixed- point


Command Execute Event: Polling
Command Complete Address (bit): 00003
Command Address: 00100
Command Result Address: 00200
Result Output Address: 00500
Result Ready Address (bit): 00000
Result Ack Address (bit): 00001
Acknowledge result output completion:
Checked
Enable Handshake: Unchecked

3 Select "OK" to close the "PLC-Link" setting screen and then restart the controller.
355GB
KEYENCE CORPORATION. Vision System Division ‐3‐ www.keyence.com
✎Configuring the KV Series Settings
1 Start KV STUDIO with the PLC connected to the computer, and select [File] > [New project].

2 Enter the "Project name", select the "PLC model", and then press "OK".

3 Select [Read unit setting] in the "Confirm unit setting information" dialog box.

4 In the workspace, click the link unit or CPU unit that will be connected to the CV-X via Ethernet to start "Unit
Editor", and set up the IP address and Port No. of the KV Series on the "Setup unit(2)" tab.

IP address: 192.168.0.20* Enter the "IP Address" set


in step 2 on the previous page.
Subnet mask: 255.255.255.0
Port No. (VT): 8502* When multiple devices are
connected to KV, they can have the same Port No.

KEYENCE CORPORATION. Vision System Division ‐4‐ www.keyence.com


5 Select [Convert] > [Auto-assign relay/DM] in the Unit Editor to assign a device.

Alternatively, you can use this icon.

6 Save the changes and exit the Unit Editor.

7 Select [Monitor/Simulator] > [Transfer to PLC] in KV STUDIO.

Alternatively, you can use this icon.

8 Restart both the CV-X Series and the KV Series.


* Start the KV Series first, and then start the CV-X Series.

If "Initializing PLC- Link..." appears on the lower left of the screen and
disappears immediately, it indicates that the link has been established
successfully.

If the link establishment has failed, the message "Initializing PLC- Link... *"
appears repeatedly, and the error message "Failed to establish a link with
the PLC" appears.
Check the settings of the CV-X Series and KV Series again.

KEYENCE CORPORATION. Vision System Division ‐5‐ www.keyence.com


2. Establishing the PLC-Link (RS-232C PLC-Link) [Keyence KV Series]

✎Checking the Global Settings of the CV-X Series


This section describes how to establish the PLC-Link.

[Important] If it fails, follow this manual to configure the settings and check the operations.
Confirm that it operates properly, and change settings if necessary.
1 On the "Global" menu, select [Communications & I/O] > [PLC-Link].

Configure the PLC-Link settings.

Mode: PLC- Link (RS- 232C)


PLC Type: KV-L20 Series
Baud Rate: 115200
Stop Bit: 1
Parity Bit: Even
Flow Control: None
Data Length: 8- bit (fixed)
* The above is a setting example.
Change the settings according to the
target device.

Decimal Point: Fixed- point

Command Execute Event: Polling


Command Complete Address (bit):
00003
Command Address: 00100
Command Result Address: 00200
Result Output Address: 00500
Result Ready Address (bit): 00000
Result Ack Address (bit): 00001
Acknowledge result output completion:
Checked
Enable Handshake: Unchecked

2 Select "OK" to close the "PLC-Link" setting screen and then restart the controller.

KEYENCE CORPORATION. Vision System Division ‐6‐ www.keyence.com


✎Configuring the KV Series Settings
1 Start KV STUDIO with the PLC connected to the computer, and select [File] > [New project].

2 Enter the "Project name", select the "PLC model", and then press "OK".

3 Select [Read unit setting] in the "Confirm unit setting information" dialog box.

4 In the workspace, click the link unit or CPU unit that will be connected to the CV-X via RS-232C to start "Unit
Editor", and change the "Operation mode" of "Port 1" to "KV BUILDER/KV STUDIO mode" on the "Setup
unit(2)" tab.

The following message appears. Select "Yes".

KEYENCE CORPORATION. Vision System Division ‐7‐ www.keyence.com


5 Select [Convert] > [Auto-assign relay/DM] in the Unit Editor to assign a device.

Alternatively, you can use this icon.

6 Save the changes and exit the Unit Editor.

7 Select [Monitor/Simulator] > [Transfer to PLC] in KV STUDIO.

Alternatively, you can use this icon.

8 Restart both the CV-X Series and the KV Series.


* Start the KV Series first, and then start the CV-X Series.

If "Initializing PLC- Link..." appears on the lower left of the screen and
disappears immediately, it indicates that the link has been established
successfully.

If the link establishment has failed, the message "Initializing PLC- Link...
*" appears repeatedly, and the error message "Failed to establish a link
with the PLC" appears.
Check the settings of the CV-X Series and KV Series again.

KEYENCE CORPORATION. Vision System Division ‐8‐ www.keyence.com


3. Outputting the Measured Value/Judged Value (PLC-Link) [Keyence KV Series]

✎Configuring the Output Settings


Set the measured values/judged values to output in "Output Settings". This section describes how to assign tool measurement
values/judgment values.
(In the description, the following are output: 1: Total Status Value, 2: T100: Pattern Search. Pattern X Position Result, 3: T100:
Pattern Search. Pattern XY Position Result, 4: T101: Area. Area Result, 5: T102: OCR. Recognized Character (String), 6: T100:
Pattern Search. Judged Value, 7: T101: Area. Judged Value, 8: Program Time, 9: Total Count)

1 Open "Output Settings", and select "PLC- Link".


When added, the result output unit opens.

2 Press "Select Data", and select the target data to output.

Items that can be output are


categorized into "Measured Value",
"Judged Value", and "Variables".
Select an item to output from these
categories and press "Add" to add the
item.
You can change the output order of the
added items, or delete the items.

3 After finishing data addition, press "OK". Check the data to output and the data memory address.

The added output data and the list of data


memory address to which the data is
output are displayed.

The start of the data memory address is


specified in "Result Output Address" on
[Global] > [Communications & I/O] > [PLC-
Link] (Address 500 in the above example).

See the next page for the output format


when storing in the data memory.

KEYENCE CORPORATION. Vision System Division ‐9‐ www.keyence.com


✎Checking the Output Format/Flow for the Data Memory
1 Check the data memory and word count to use for the result output.

Use "Result Output Address", "Result Ready Address" and "Result Ack Address" in [Global] > [Communications & I/O] > [PLC-

- Result Output Address: Specify the first data memory for the
result data output by CV-X.
* The result data is stored starting from this address by 2 words per
data item (2 words per character).

- Result Ready Address (bit): Specify the data memory for CV-X to
notify when the result data has been written.
* The address to use is 1 word.

- Result Ack Address (bit): Specify the data memory for the PLC to
notify when the result data has been read.
* The address to use is 1 word.

- Acknowledge result output completion: Uncheck the checkbox to


restrict the Result Ready Address (bit) control. The PLC cannot
detect the update timing of the result data, but the tact is fast. Use
this option when you wish to acquire the latest result only.

2 Check the example of outputting the result data to the data memory.
The CV-X outputs the result data as follows:

[Data item] In parenthesis: Displayed measured value

…Total Status Value (OK = 0/NG = 1)


…T100: Pattern Search. Pattern X Position Result (284.868)

…T100: Pattern Search. Pattern XY Position Result

…T101: Area. Area Result (17839)


…T102: OCR. Recognized Character (String) ("KEYENCE")
…T100: Pattern Search Judged Value (OK = 0/NG = 1)
…Program Time (67.477 ms)
…T101: Area Judged Value (OK = 0/NG = 1)
…Total Count (24)

Data is stored in the PLC as follows (When "Fixed- point" is selected for "Decimal Point" on CV-X).
* The following screen is the "Registration monitor" function screen in KV STUDIO.

… Judged value: OK = 0/NG = 1 stored using 2 words


… Decimal type data: Multiplied by 1,000 and stored using 2 words
284.868  284868
XY data: X is output and then Y, stored using 2 words
… Integer type data: Stored using 2 words as is

Character data: 1 character stored in ASCII code using 2 words


* When "String" is output, the DM use amount varies depending on the
specified character count. In the left example, "Detected String" of the OCR
tool is output. The string consists of 7 characters "KEYENCE", but as [Block
Set] > [Characters] of the OCR tool is "10", 20 words (10 characters) of
DM510 to 529 are used. Changing the character count setting also changes
the data memory to use. If it may be changed, it is recommended that you
set it up at the end of the output settings.

Judged value: OK = 0/NG = 1 stored using 2 words


System variable: Integer type: Stored using 2 words as is Decimal type:
Multiplied by 1,000 and stored using 2 words
…Data output completion address (1 at data output completion)

KEYENCE CORPORATION. Vision System Division ‐ 10 ‐ www.keyence.com


3 Representative data output procedure

Operations of data output procedure depending on "Result Output Settings" configured in step 1

1. When both "Acknowledge result output completion" and "Enable Handshake" are checked
Follows the above procedure, and guarantees that all result data output from CV-X is sent to the PLC.
However, if the PLC repeats measurement without controlling Result Ack Address (bit), the output buffer of CV-X
overflows, and trigger input becomes impossible.

2. When "Acknowledge result output completion" is checked and "Enable Handshake" is unchecked (default)
CV-X does not check the value of Result Ack Address (bit) in  and  of the above procedure.
This speeds up the output. If the PLC overwrites the 1 of Result Ready Address (bit) written by CV-X with 0, the PLC can
find the result update timing of CV-X.

3. When "Acknowledge result output completion" is unchecked (In this case, "Enable Handshake" is also
unchecked)
CV-X neither checks the value of Result Ack Address (bit) in  and  of the above procedure nor updates the value of
Result Ready Address (bit) in  and  of the above procedure. This speeds up the output more, but the PLC cannot
find the result update timing of CV-X. It can be used when you wish to obtain the latest result only.

KEYENCE CORPORATION. Vision System Division ‐ 11 ‐ www.keyence.com


4. Controlling the Controller (PLC-Link) [Keyence KV Series]

✎Checking the Global Settings of the CV-X Series

1 On the "Global" menu, select [Communications & I/O] > [PLC-Link] to open the global "PLC-Link" settings
screen.

* The screen on the left shows that


Mode is set to "PLC- Link (Ethernet)",
but the settings (in the red frame) in this
section (Controlling the Controller) are
the same as those of "PLC- Link (RS-
232C)".

2 Check the setting items necessary for controller control.


Select the Command Execute Event.
Select Polling for Command Execute Event.

Check the data memory to use for the following three


items.
- Command Address
- Command Complete Address (bit)
- Command Result Address
The data memory address to use can be changed.
Be careful not to specify an address of the data memory used for another program of the PLC.

3 Select "OK" to close the global "PLC-Link" settings screen.

KEYENCE CORPORATION. Vision System Division ‐ 12 ‐ www.keyence.com


✎Command Processing Flow
To control the controller via PLC-Link, use the number-specified commands.

1 Refer to "Control/Data Output via Commands" in the user's manual to check the commands to use and the
formats of the number-specified commands.
Here is an example of using the PW command (command No. 24) that switches the program setting.

The following must be specified to execute the PW


command:
Command No. (24)
SD card No. (d) of the switch target program setting
Setting No. (nnn)
Specify 2-word integer values from the data memory
specified as the "Command Address" in order.

The command processing result is stored to the


address specified as the "Command Result Address".

KEYENCE CORPORATION. Vision System Division ‐ 13 ‐ www.keyence.com


✎Command Processing Flow

2 Command execution procedure


There are two methods to execute a command: "PLC Terminal" and "Polling". If "Polling" is selected, terminal control is not
required but the communication for polling is required, and the command execution may be slower than "PLC Terminal".

"PLC Terminal"
Executes a command when the input terminal IN15 "PLC Terminal" is set.
"Polling"
Always monitors (polls) the data memory specified in "Command Execute Address (bit)", and executes a command when it
is set.

KEYENCE CORPORATION. Vision System Division ‐ 14 ‐ www.keyence.com


✎ Command Execution Procedure Example: Save Settings (SS Command)
Here is an example of a representative command execution procedure. This section explains an example of executing the
SS (Save Settings) command, which does not use a command parameter, with Command Execute Event set to "Polling". The
screens with blue frames show when the "Registration monitor" function of KV STUDIO is used for confirmation.

1 Check the SS (Save Settings) command operation.

1. Enter "12", the SS command No., in the data memory


corresponding to the PLC Command Address (DM100 in
this example).
* The address to use is 1 word.

2. Enter 1 in the data memory corresponding to the PLC


Command Execution Address (bit) (DM002 in this
example).
* The address to use is 1 word.

3. The command is executed.

4. Check if the values of the data memory When the command is successful: CV-X writes "1" into Command
corresponding to the PLC Command Complete Address Complete Address (bit), and "0" into Command Result Address.
(bit) and Command Result Address (DM003 and DM200
respectively in this example) have changed.

When the command fails: CV-X writes "1" into Command Complete
Address (bit), and an error code into Command Result Address.

KEYENCE CORPORATION. Vision System Division ‐ 15 ‐ www.keyence.com


✎Command Execution Procedure Example: Switch Program Setting No. (PW)
Here is an example of a representative command execution procedure. This section explains an example of executing the PW
(Switch Program Setting No.) command, which uses a command parameter, with Command Execute Event set to "Polling". The
screens with blue frames show when the "Registration monitor" function of KV STUDIO is used for confirmation.

1 Check the PW (Switch Program Setting No.) command operation.

1. Enter "24", the PW command No., in the data memory


corresponding to the PLC Command Address (DM100 in this
example), and the parameters switch target SD drive No. and
program No. The figure on the right shows an example of
switching to program No. "23" on "SD1".
* The address to use is 1 word for Command No. and 2 words
for other parameters.

2. Enter 1 in the data memory corresponding to the PLC


Command Execution Address (bit) (DM002 in this example).
* The address to use is 1 word.

3. The command is executed.

4. Check if the values of the data memory corresponding to When the command is successful: CV-X writes "1" into Command
the PLC Command Complete Address (bit) and Command Complete Address (bit), and "0" into Command Result Address.
Result Address (DM003 and DM200 respectively in this
example) have changed.

When the command fails: CV-X writes "1" into Command


Complete Address (bit), and an error code into Command Result

KEYENCE CORPORATION. Vision System Division ‐ 16 ‐ www.keyence.com


✎ Command Execution Procedure Example: Rewrite Judgment Conditions (DW)
Here is an example of a representative command execution procedure. This section explains an example of executing the DW
(Rewrite Judgment Conditions) command, which specifies numeric values as command parameters, with Command Execute
Event set to "Polling". The screens with blue frames show when the "Registration monitor" function of KV STUDIO is used for
confirmation.
1 Check the DW (Rewrite Judgment Conditions) command operation.

1. Enter "45", the DW command No., in the data memory


corresponding to the PLC Command Address (DM100 in
this example), and enter the parameters in order. The
figure on the right shows an example of rewriting the upper
limit of the area of "T101" to "12345".
- Parameter 1 101 (Tool ID: 101)
- Parameter 2 105 (judgment condition item ID for "Area")
→For information about the judgment condition item ID,
refer to the user's manual.
- Parameter 3 0 ("0" represents the upper limit)
- Parameter 4 12345000 (value)
→If "Decimal Point" is set to "Fixed- point", specify the
value multiplied by 1000 (12345000).
→If "Decimal Point" is set to "Floating- point", specify
a single precision floating point number (12345.000).
* The address to use is 1 word for Command No. and 2
words for other parameters.

2. Enter 1 in the data memory corresponding to the PLC


Command Execution Address (bit) (DM002 in this
example).
* The address to use is 1 word.

3. The command is executed.

4. Check if the values of the data memory corresponding to When the command is successful: CV-X writes "1" into Command
the PLC Command Complete Address (bit) and Command Complete Address (bit), and "0" into Command Result Address.
Result Address (DM003 and DM200 respectively in this
example) have changed.

When the command fails: CV-X writes "1" into Command


Complete Address (bit), and an error code into Command Result
Address.

KEYENCE CORPORATION. Vision System Division ‐ 17 ‐ www.keyence.com


✎Command Execution Procedure Example: Rewrite Registered String (CW)
Here is an example of a representative command execution procedure. This section explains an example of executing the CW
(Rewrite Registered String) command, which specifies a string for the command parameter, with Command Execute Event set
to "Polling". The screens with blue frames show when the "Registration monitor" function of KV STUDIO is used for
confirmation.
1 Check the CW (Rewrite Registered String) command operation.

1. Enter "43", the CW command No., in the data memory


corresponding to the PLC Command Address (DM100 in
this example), and enter the parameters in order. The
figure on the right shows an example of rewriting the
judgment string of "T102: OCR tool" to "ABCDE".
- Parameter 1 102 (Tool ID: 102)
- Parameter 2 1 (In the case of "OCR": Always 1)
- Parameter 3 1 (Specify in string)
- Parameter 4 65 (ASCII code for "A")
- Parameter 5 66 (ASCII code for "B")
- Parameter 6 67 (ASCII code for "C")
- Parameter 7 68 (ASCII code for "D")
- Parameter 8 69 (ASCII code for "E")
- Parameter 9 0 (Always 0 at the end of the string)

* The address to use is 1 word for Command No. and 2


words for other parameters.

2. Enter 1 in the data memory corresponding to the PLC


Command Execution Address (bit) (DM002 in this
example).
* The address to use is 1 word.
3. The command is executed.

4. Check if the values of the data memory corresponding to When the command is successful: CV-X writes "1" into Command
the PLC Command Complete Address (bit) and Command Complete Address (bit), and "0" into Command Result Address.
Result Address (DM003 and DM200 respectively in this
example) have changed.

When the command fails: CV-X writes "1" into Command Complete
Address (bit), and an error code into Command Result Address.

KEYENCE CORPORATION. Vision System Division ‐ 18 ‐ www.keyence.com


Copyright (c) 2014 KEYENCE CORPORATION. All rights reserved. 124284E 1084-1 355GB Printed in Japan

You might also like