Easy Setup Guide: Control/Communication PLC-Link (SYSMAC CJ Series)
Establishing the PLC-Link (Ethernet PLC-Link)
Establishing the PLC-Link (RS-232C PLC-Link)
Outputting the Measured Value/Judged Value (PLC-Link)
Controlling the Controller (PLC-Link)
Page 3
Page
Page
Page
7
11
14
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) [SYSMAC CJ 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 PLC and CV-X, and follow this manual to configure the settings and check the
1
operations. Confirm that it operates properly, and change settings if necessary.
Select [Global] > [Communications & I/O] > [Network] on the controller, and then configure the network
(Ethernet) settings on 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: SYSMAC CJ/CS1/CP1 Series
IP Address: 192.168.0.11
hange to 9600
Port: C
Resend Time (ms): 10000
NODE No.: 001
"IP Address" above indicates the one for
Be careful not to use
the same IP address.
the KV Series that will be connected. Set an
address whose fourth number differs from
that of the "Controller IP Address" set in
step 1.
"9600" is the recommended port (as the
initial port No. of SYSMAC is "9600").
Command Address: 00100
Command Result Address: 00200
Result Output Address: 00500
Result Ready Address (bit): 00000
Result Ack Address (bit): 00001
3
Select "OK" to close the "PLC-Link" setting screen and then restart the controller.
KEYENCE CORPORATION. Vision System Division
359GB
‐ 3 ‐www.keyence.com
✎Configuring the Settings of the CJ Series (Example of CX Programmer)
1
Start CX Programmer, and select [Project] > [New project].
2
Select a model*1to use for "Device Type", and then press the "OK" button.
*1 Select a model described in the CV-X user's manual.
3
Select [PLC] > [Auto Online] > [Direct Online], and then select "Connect" - "Yes" to connect to PLC.
KEYENCE CORPORATION. Vision System Division
‐ 4 ‐www.keyence.com
4
Open [IO Table and Unit Setup] on the left side of the screen, and register the Ethernet link unit in an empty slot.
Double-click the registered Ethernet link unit (CJ1W-ETN21 in this example) to edit the parameters.
Configure the following settings in [Edit Parameters].
1. For [FINS/UDP Port], select "9600", the default value (the default value is also 9600 for CV-X).
2. Set [IP Address/Subnet Mask]. Enter the "IP Address" set in CV-X Global Settings.
3. Enter the CV-X NODE No. and IP Address into [IP Address Table] (the default CV-X NODE No. of 001 is recommended).
4. Set [Port No.] to 0.
After completing the settings, press "OK".
5
Select [PLC] > [Transfer] >[To PLC].
KEYENCE CORPORATION. Vision System Division
‐ 5 ‐www.keyence.com
6
Restart both the CV-X Series and the SYSMAC CJ Series.
* Start the SYSMAC CJ 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 SYSMAC CJ Series again.
KEYENCE CORPORATION. Vision System Division
‐ 6 ‐www.keyence.com
2. Establishing the PLC-Link (RS-232C PLC-Link) [SYSMAC CJ 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.
1
Confirm that it operates properly, and change settings if necessary.
On the "Global" menu, select [Communications & I/O] > [PLC-Link].
Configure the PLC‐Link settings.
Mode: PLC- Link (RS- 232C)
PLC Type: SYSMAC CJ/CS1/CP1 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
2
Select "OK" to close the "PLC-Link" setting screen and then restart the controller.
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
KEYENCE CORPORATION. Vision System Division
‐ 7 ‐www.keyence.com
✎Configuring the Settings of the CJ Series (Example of CX Programmer)
1
Start CX Programmer, and select [Project] > [New project].
2
Select a model*1to use for "Device Type", and then press the "OK" button.
*1 Select a model described in the CV-X user's manual.
3
Select [PLC] > [Auto Online] > [Direct Online], and then select "Connect" - "Yes" to connect to PLC.
KEYENCE CORPORATION. Vision System Division
‐ 8 ‐www.keyence.com
4
Open [IO Table and Unit Setup] on the left side of the screen, and register the serial communication unit in an
empty slot. Double-click the registered serial communication unit (CJ1W-SCU41 in this example) to edit the
【Note】
"User settings" and "Defaults" can be selected, but if you choose
"Defaults", the items below will automatically return to their default
setting (standard setting) if they are changed. Be sure to use "User
settings". These specifications only apply to CX Programer Ver. 6 (as
of November 2010).
Set the following settings to the values set
for the CV-X Series Global Settings.
Data length: 8 bits
Stop bits: 1 bit
Parity: Even
Baud rate: 115200 bps
Protocol macro Transmission method:
Full-duplex
5
Select [PLC] > [Transfer] >[To PLC].
KEYENCE CORPORATION. Vision System Division
‐ 9 ‐www.keyence.com
6
Restart both the CV-X Series and the SYSMAC CJ Series.
* Start the SYSMAC CJ 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 SYSMAC CJ Series again.
KEYENCE CORPORATION. Vision System Division
‐ 10 ‐www.keyence.com
3. Outputting the Measured Value/Judged Value (PLC-Link) [SYSMAC CJ 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 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 adding data, press "OK". Check the data to output and the data memory address.
KEYENCE CORPORATION. Vision System Division
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" in [Global] >
[Communications & I/O] > [PLC‐Link]
(Data memory 500 in the above
example).
See the next page for the output
format when storing in the data
memory.
‐ 11 ‐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‐
Link].
2
Check the example of outputting the result data to the data memory.
The CV‐X outputs the result data as follows:
- 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 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. PLC cannot detect
the update timing of the result data, but the tact is fast. Use this
option when you wish to know the latest result only.
[Data item] In parenthesis: Displayed measured value
···
Total Status Value (OK = 0/NG = 1)
···T100: Pattern Search. Pattern X Position Result (216.235)
··· T100: Pattern Search. Pattern XY Position Result
(X = 216.235/Y = 112.675)
···T101: Area. Area Result (12675)
···T102: OCR. Recognized Character (String) ("KEYENCE")
···T100: Pattern Search Judged Value (OK = 0/NG = 1)
···T101: Area Judged Value (OK = 0/NG = 1)
···Program Time (56555 ms)
···Total Count (16)
Data is output to PLC as follows (When "Fixed‐ point" is selected for "Decimal Point" on CV‐X)
* The following is the screen as viewed when "PLCメモリ" → "D" is selected, and the memory area monitor display is used in
CX Programmer.
··· Judged value: OK = 0/NG = 1 output using 2 words
···Decimal type data: Multiplied by 1,000 and output using 2 words
XY data: X is output and then Y, stored using 2 words
216.235 216235
··· Integer type data: Output as is using 2 words
Character data: 1 character output 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, "KEYENCE", consists of 7
characters, 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.
KEYENCE CORPORATION. Vision System Division
Judged value: OK = 0/NG = 1 output using 2 words
System variable: Integer type: Output as is using 2 words Decimal
type: Multiplied by 1,000 and output using 2 words
···Data output completion address (1 at data output completion)
‐ 12 ‐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 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. PLC can overwrite 1 of Result Ready Address (bit) written by CV‐X with 0 to 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 PLC cannot find the result update timing of CV‐X.
This can be used when you wish to obtain the latest result only.
KEYENCE CORPORATION. Vision System Division
‐ 13 ‐www.keyence.com
4. Controlling the Controller (PLC-Link) [SYSMAC CJ 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.
The data memory address to use can be changed.
Be careful not to specify an address of a data memory being used for another program of PLC.
3
Select "OK" to close the global "PLC-Link" settings screen.
KEYENCE CORPORATION. Vision System Division
‐ 14 ‐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 settings.
The following must be specified to execute the PW
command:
Command No. (24)
SD card No. (d) of the switch target program settings
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
‐ 15 ‐
www.keyence.com
✎ Command Processing Flow
2
Command execution procedure
There are two methods for executing 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
‐ 16 ‐
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 "Memory" → "D" is selected, and the memory area monitor display is used in CX
Programmer for confirmation (double‐click the memory area to enter a value).
Check the SS (Save Settings) command operation.
1
1. Enter "12", the SS command No., in the data memory
corresponding to the PLC Command Address (D100 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) (D002 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 the PLC Command Complete Address (bit) and
Command Result Address (D003 and D200 respectively
in this example) have changed.
Set the command parameter in 2 word display mode.
Set other settings in 1 word display mode.
When the command is successful: CV‐X writes "1" into Command
Complete Address (bit), and "0" into Command Result Address.
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: 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 "Memory" → "D" is selected, and the memory area monitor display is used in CX
Programmer (double‐click the memory area to enter a value).
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 (D100 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 number "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) (D002 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 the PLC Command Complete Address (bit) and Command
Result Address (D003 and D200 respectively in this example)
have changed.
Set the command parameter in 2 word display mode.
Set other settings in 1 word display mode.
When the command is successful: CV‐X writes "1" into Command
Complete Address (bit), and "0" into Command Result Address.
When the command fails: CV‐X writes "1" into Command Complete
Address (bit), and an error code into Command Result Address.
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 "Memory" → "D" is selected, and the memory area monitor
display is used in CX Programmer (double‐click the memory area to enter a value).
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 (D100 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 informaon about the judgment condion item ID,
→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.
Set the command parameter in 2 word display mode.
Set other settings in 1 word display mode.
2. Enter 1 in the data memory corresponding to the PLC
Command Execution Address (bit) (D002 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 the PLC Command Complete Address (bit) and Command
Result Address (D003 and D200 respectively in this example)
have changed.
When the command is successful: CV‐X writes "1" into Command
Complete Address (bit), and "0" into Command Result Address.
When the command fails: CV‐X writes "1" into Command Complete
Address (bit), and an error code into Command Result Address.
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 "Memory" → "D" is selected, and the memory area monitor display is
used in CX Programmer for confirmation (double‐click the memory area to enter a value).
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 (D100 in this
example), and enter the parameters in order.
The figure on the right shows an example of rewriting the
Registered 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)
* Specify the Command No. as 1 word, and other
parameters as 2 words.
2. Enter 1 in the data memory corresponding to the PLC
Command Execution Address (bit) (D002 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 the PLC Command Complete Address (bit) and Command
Result Address (D003 and D200 respectively in this example)
have changed.
Set the command parameter in 2 word display mode.
Set other settings in 1 word display mode.
When the command is successful: CV‐X writes "1" into Command
Complete Address (bit), and "0" into Command Result Address.
KEYENCE CORPORATION. Vision System Division
When the command fails: CV‐X writes "1" into Command Complete
Address (bit), and an error code into Command Result Address.
‐ 20 ‐www.keyence.com
Copyright (c) 2014 KEYENCE CORPORATION. All rights reserved. 124288E 1084-1 359GB Printed in Japan
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.