Professional Documents
Culture Documents
Table of Contents
3.3 Checking the Data Output Flow Chart and Timing Diagrams 028
This chapter explains how to establish a connection between the XG-X2000 and the PLC over
PROFINET.
Use one of the following methods to connect the devices. Use a CAT5e or higher Ethernet cable.
Connecting in a 1 to 1 Configuration
XG-X2000 PLC
Ethernet cable
Ethernet cable
Other
devices
(1) At the top of the setup mode screen, click "Global," point to "Communications & I/O," and then
click "PROFINET."
(3) Click "Create GSDML File" to output the GSDML file to SD2 on the XG-X.
This file is used to configure the PLC settings, so save it on the PC.
(In advance, you have to insert the CA-SD1G or another SD card supported by the XG-X into
SD2 on the XG-X.)
(4) Click "OK" to display a confirmation dialog box for restarting the XG-X2000. Click "Restart now"
to restart the XG-X2000.
To establish a connection over PROFINET, use TIA (Totally Integrated Automation) PORTAL to set
the PLC. This manual was created with TIA version 13.
(1) Connect the PC and the PLC, start TIA PORTAL, click "Start," "Create new project," and then
click "Create."
(Set items such as "Project name" to appropriate values.)
(3) Click "Add new device," select the model of the PLC to use, and then click "Add."
For the model of the PLC to use, you have to select a PLC that is listed in the XG-X
Communication Configuration Manual.
(4) Click "Manage general station description files (GSD)" on the "Options" menu.
(5) For "Source path," specify the location on the PC where you saved the GSDML file in step (3)
under "1.1.2 Configuring XG-X2000 Settings." Select the check box for the displayed XG-X2000
GSDML file, and then click "Install."
(7) In the "Project tree" window, click "Device configuration" under the PLC, and then click
the "Network view" tab.
(8) Add the "XG-X2XXX" to the network by dragging it from the "Hardware catalog."
(11) Click the PLC image, click the "Properties" tab, click "Ethernet addresses," click "Add new
subnet," and then add "PN/IE."
Enter the IP address on the PLC side for "IP address" and "Subnet mask."
Here, enter the values shown below for "IP address" and "Subnet mask."
IP address: 192.168.0.20
Subnet mask: 255.255.255.0
Click this.
(13) Click the XG-X2000 image, click the "Properties" tab, click "Ethernet addresses," and then
select "PN/IE" for "Subnet."
Set "IP address" to the IP address of the XG-X2000.
(The IP address of the XG-X2000 will be changed to the address that you set here.)
IP address :192.168.0.10
Click this.
(14) When you click the "Network view" tab, the network of the XG-X2000 will be "Not assigned,"
so click "Not assigned" and select the PLC to communicate with (here, this is PLC_1).
(15) Right-click the PLC, point to "Compile," and then click "Hardware and software (only changes)."
(16) Right-click the PLC, point to "Download to device," and then click "Hardware and software
(only changes)."
(17) Select "PN/IE" for "Type of the PG/PC interface," the network adapter of the PC connected to
the PLC for "PG/PC interface," and the interface or subnet to which the PLC is connected
(here, select PN/IE_1) for "Connection to interface/subnet."
(18) Select the "Show all compatible devices" check box and click "Start search" to display a list of
the PLCs connected to the subnet that you selected in step (15). Select the PLC to use this
time, and then click "Load."
(19) Check that no errors have occurred in the "Load preview" window, and then click "Load."
(20) Check that no errors have occurred in the "Load results" window, select the "Start all" check
box, and then click "Finish."
(21) Switch the device displayed on the "Device view" tab to the XG-X2000, and then check
the "Device overview." You can check a list of the PLC addresses to which the various pieces
of XG-X2000 data have been assigned.
This chapter explains how to output data such as inspection results and measured values from
the XG-X2000 to the PLC over PROFINET. Before configuring the settings shown below, connect
the XG-X2000 to a PLC according to the procedure in "1. Connecting over PROFINET."
Also, if operations are performed at high speed and images must be captured in real time
(that is, a very short time between the application of the trigger and the capturing of the image is
required), use I/O (the terminal block), not PROFINET, to apply the triggers.
When controlling the image capture timing, use the data of the bit area shown below.
When seen from the XG-X2000, this data is assigned to the XG-X2000 byte addresses shown below.
When seen from the PLC, this data is assigned to the PLC addresses shown below.
The assignments shown below are examples. Use step (19) under "1.1.3 Configuring
PLC Settings" to check the PLC addresses to which the data has actually been assigned.
For the ON/OFF timing of each piece of bit data, see "2.1.2 Checking the Timing Diagram."
The timing diagram when you are controlling the image capture timing with PROFINET (when you are
applying triggers) is shown below. Use data combinations that correspond to the triggers you want to
use for Trg[n] Ready, Trg[n], and Trg[n] Ack. (For example, if you are using trigger 1, use
Trg1 Ready, Trg1, and Trg1 Ack.)
For the assignments of the addresses of the data, see "2.1.1 Checking the Address Assignments."
(1) After checking that Trg[n] Ready is ON and Trg[n] Ack is OFF, the PLC turns Trg[n] ON.
(2) After receiving the trigger input, the controller starts capturing the image and turns Trg[n] Ready OFF
and Trg[n] Ack ON.
(3) When the image capture is finished and the controller is able to start the next image capture,
the controller turns Trg[n] Ready ON.
(4) After checking that Trg[n] Ack is ON (the controller has read that Trg[n] is ON), the PLC turns Trg[n]
OFF.
(5) Linked with (4), the controller turns Trg[n] Ack OFF.
To make the PLC check that the controller has received the applied trigger, check
that Trg[n] Ack is ON, not that Trg[n] Ready is OFF.
(If you attempt to check this with Trg[n] Ready being OFF, it may not be possible
to detect Trg[n] Ready being OFF from the PLC side if the time that Trg[n] Ready is
OFF is shorter than the PROFINET communication cycle.)
As an example, this section explains how to configure the settings in order to output the data
shown below.
(2) Select the added "Data Output" to open the setup screen.
(6) Select the data that you want to output from the displayed list.
(7) Repeat steps (4) to (6) to add all the data that you want to output.
(8) When there are multiple instances of Data Output and there are duplicate output destination
addresses between these units, click "Settings" to set the output offset. (Prevent duplication
between the output destination of other Data Output instances and the byte address.)
This section explains how to check the output data on the XG-X2000.
To output data, first switch the XG-X2000 to run mode.
(Data is not output in setup mode.)
(1) Click "Go to Run Mode" at the top of the setup mode screen to switch to run mode.
(2) When a screen like the one shown below is displayed, the switch to run mode is complete.
Use the PROFINET memory monitor of the XG-X2000 to check the data output from the XG-X2000.
(3) Check that "Communication Status" is "Connected," and then select the value for
"Multi BIT Outputs" under "XG-X Implicit Output Addressing (XG-X -> PLC)."
(4) The details of the output to the PLC data memory are displayed as a list.
(In the initial values, the data is output with 120 as the leading address.)
This section explains the format of the data output from the XG-X2000 to the PLC.
As an example, this section explains the output formats when the measured values and judgment
values are as shown below with the XG-X2000 set as shown in "3.1 Configuring Output Data Settings."
XG-X2000 input
Output data (decimal) Output format
data address
120 1 The judgment value (OK = 0/NG = 1) is stored using 2 words.
Decimal fraction data is multiplied by 1000 and stored in 2 words.
124 744050 (744.050 → 744050)
128 744050 When XY data is output, it is stored in the order of X followed by Y,
132 578199 with each piece stored in 2 words.
136 249174 Integer data is stored as-is in 2 words.
140 75
144 69
148 89 Character data is stored as ASCII code with 2 words used per character.
152 69 The number of characters output is determined by the value set for the
156 78 "number of characters on line 1" for the OCR unit.
160 67 Here this is set to "10," so even though the read character string only
consists of 7 characters, 20 words are used from 140 to 179 in order to
164 69
store 10 characters.
168 0
172 0
176 0
180 0
The judgment value (OK = 0/NG = 1) is stored using 2 words.
184 1
188 96000 All local variables are multiplied by 1000 and stored in 2 words.
192 123456 (96 → 96000, 123.456 → 123456)
196 116718 Integer data system variables are stored as-is in 2 words.
Decimal fraction data system variables are multiplied by 1000 and stored
200 32 in 2 words.
The bit areas and the word areas shown below are used when outputting measured values and
judgment values. When seen from the XG-X2000, this data is assigned to the XG-X2000 byte
addresses shown below. When seen from the PLC, this data is assigned to the PLC addresses shown
below.
The assignments shown below are examples. Use step (19) under "1.1.3 Configuring PLC
Settings" to check the PLC addresses to which the data has actually been assigned.
For the ON/OFF timing of each piece of bit data and the output timing of each piece of
word data, see "3.3.2 Checking the Data Output Flow Chart" and
"3.3.3 Checking the Timing Diagrams."
Result ack flag Output data: Bit area: Address 0: Bit 3 Q1.3
Result ready flag Input data: Bit area: Address 0: Bit 3 I1.03
Result OR flag Input data: Bit area: Address 0: Bit 4 I1.04
Controller PLC
Result output
unit
★1 The flow chart shown above is from the case in which handshake is ON.
To turn handshake ON/OFF, select a value in the "Handshake" list in step (8) under
"3.1.1 Configuring XG-X2000 Settings."
When handshake is OFF, the controller overwrites data memory with the execution timing of the result output unit
regardless of the status of the Result ack flag.The Result ready flag also remains ON thereafter.
When it is necessary to check the completion of writing due to the Result ready flag changing from OFF to ON,
turn the Result ready flag OFF by turning the Result ack flag ON.
The timing diagrams for when the result output unit outputs data over PROFINET are shown below.
For the assignments of the addresses of the data, see "3.3.1 Checking the Address Assignments."
When Handshake Is ON
Result Data nnn Uncertain (1) Output data (6) Output data
★2 When you are using the Result OR flag, it is necessary for at least 1 piece of data to be set to be output from
the result output unit to PROFINET.
Result Data nnn Uncertain (1) Output data (3) Output data
★2 When you are using the Result OR flag, it is necessary for at least 1 piece of data to be set to be output from
the result output unit to PROFINET.
(1) At the top of the setup mode screen, click "Global," and then click "Custom Instruction Settings."
(2) A list of the usable custom commands is displayed. Check the "command number" and
the "execution details."
(3) In the initial values, the custom commands shown below are registered.
For example, when the command "PW, 1, 25" is executed, the program is switched to number "25,"
which is stored on SD card "1." To check the formats of the various commands, see chapter 2,
"Command Explanation" in the "XG-X2000 Series Communication Configuration Manual."
To execute a custom command over PROFINET, enter the "command number" into the address to
which"Command Number" has been assigned, enter the "command parameters" into the address
to which"Command Parameter" has been assigned, and then execute the custom command.
For the detailed procedure, see "4.2 Checking the Command Processing Flow Chart and
Timing Diagram."
The assignments shown below are examples. Use step (19) under "1.1.3 Configuring PLC
Settings" to check the PLC addresses to which the data has actually been assigned.
For the ON/OFF timing of each piece of bit data and the output timing of each piece of byte
data, see "4.3.2 Checking the Command Process Flow Chart" and
"4.3.3 Checking the Timing Diagram."
Command request flag Output data: Bit area: Address 0: Bit 0 Q1.0
Command complete flag Input data: Bit area: Address 0: Bit 0 I1.0
Command error flag Input data: Bit area: Address 0: Bit 1 I1.1
Command ready flag Input data: Bit area: Address 0: Bit 2 I1.2
The flow chart for executing custom commands over PROFINET is shown below.
For the assignments of the addresses of the data, see "4.2.1 Checking the Address Assignments."
Controller PLC
★1 For commands that have no reply data, the reply data is not output to Command Data.
The value written to Command Result is a 0 when the command processing is successful and is the error
code when the command processing fails.
The timing diagram for executing custom commands over PROFINET is shown below.
For the assignments of the addresses of the data, see "4.2.1 Checking the Address Assignments."
Command
(2) (7)
request flag
Command
(3) (7)
ready flag
Command
(5) (7)
complete flag
Command
(4) Error status (7)
error flag
Command
(1) Arbitrary value
Number
Command
(1) Arbitrary value
Parameter nnn
Command
Uncertain (4) Reply data (6) Uncertain
Data nnn
(1) The PLC stores the command number in Command Number and the command parameters in
Command Parameter.
(2) The PLC turns the Command request flag ON and executes the command.
(3) The controller turns the Command ready flag OFF.
(For this to turn OFF, at minimum, the link scan time is required after [2].)
(4) When the command is executed, the controller stores the reply data in Command Data and the error
status in the Command error flag.
(The Command error flag being ON indicates that the command processing failed. The Command error
flag being OFF indicates that the command processing was successful.)
(5) The controller turns the Command complete flag ON as the confirmation signal of command execution
completion.
(6) If there is reply data, the PLC reads the value of Command Data prior to step (7).
(7) To enable the next command execution, the PLC turns the Command request flag OFF,
and the controller turns the Command ready flag ON and the Command complete flag and
the Command error flag OFF in response.
(1) Click "Go to Run Mode" at the top of the setup mode screen to switch to run mode.
Command
Application Procedure reference
to use
history output
(4) Check that the address (I1.0) to which the Address Value
Command complete flag has been assigned I1.0 1
I1.1 0
turns ON.
Q1.0 1
PID532 0
Address Value
I1.0 1
I1.1 1
Q1.0 1
PID532 3
(5) Check that the address (I1.0) to which the Address Value
Command complete flag has been assigned I1.0 1
I1.1 0
turns ON.
When the command is successful,
(6) Check whether the address (I1.1) to which the
this remains "OFF."
Command error flag has been assigned is ON
Address Value
or OFF.
I1.0 1
If it is OFF, the command has been processed normally.
I1.1 0
If it is ON, the command processing failed, so check
the error code written to the address (PID532) to When the command fails,
which Command Result has been assigned. this turns "ON," so check the error code.
Address Value
I1.0 1
I1.1 1
Q1.0 1
PID532 3
This section explains how to use the "PR command" as an example of the commands that use
command data output. The PR command reads the current program number.
The PR command is registered as the initial value of command number 32 ("PR") of the custom
commands.
(4) Check that the address (I1.0) to which the Address Value
Command complete flag has been assigned I1.0 1
turns ON. I1.1 0
(5) Check whether the address (I1.1) to which the When the command is successful,
(6) After it can be confirmed that the command was Address Value
processed normally in step (5), the reply data is I1.0 1
output in units of 2 words into the addresses I1.1 1
Q1.0 1
(starting with PQD536) to which Command Data
PID532 3
has been assigned, so check these addresses.
PQD536 1
PQD540 5
PQD536: 1 (program SD card number)
PQD540: 5 (program number)
You can see that the current program is program number 5 on SD1.
(2) Select the judgment condition on the editing screen of the OCR unit.
(2) Enter in units of 2 words the unit ID, line number, Address Value
and character string into the addresses I1.0 0
I1.1 0
(starting with PQD532) to which Command
Q1.0 0
Parameter has been assigned. PID532 0
PQD532: 2 (unit ID) PQD528 55
PQD532 2
PQD536: 1 (line number)
PQD536 1
PQD540: 65 ("A" in ASCII code)
PQD540 65
PQD544: 66 ("B" in ASCII code) PQD544 66
PQD548: 67 ("C" in ASCII code) PQD548 67
PQD552: 68 ("D" in ASCII code) PQD552 68
PQD556: 69 ("E" in ASCII code) PQD556 69
PQD560 0
PQD560: 0 (Be sure to use "0" as
the terminator of the character string.)
(5) Check that the address (I1.0) to which the Address Value
Command complete flag has been assigned I1.0 1
I1.1 0
turns ON.
(6) Check whether the address (I1.1) to which the When the command is successful,
Command error flag has been assigned is this remains "OFF."
ON or OFF.
Address Value
If it is OFF, the command has been processed I1.0 1
normally. I1.1 0
If it is ON, the command processing failed, so
check the error code written to the address When the command fails, this turns
(PID532) to which Command Result has been "ON," so check the error code.
assigned.
Address Value
I1.0 1
I1.1 1
Q1.0 1
PID532 3
This section explains how to use the "OW command" as an example of the commands that use
character strings for the command parameters. The OW command overwrites the specified character
string of the file naming rule of the "result output unit/image output unit/history archive (*1)."
The OW command is registered as the initial value of command number 105 ("OW, *01, *02") of
the custom commands. (*1)
※1 To set the specified character string of the naming rule of the history archive file, you have to register
the new custom command "OW, HIST, *01, *02."
(2) On the editing screen of the result output unit, select the output destination,
and then click "Settings."
(3) Change "File naming" to "Fixed Name," and then click "OK" to complete the settings.
(5) Check that the address (I1.0) to which the Address Value
Command complete flag has been assigned I1.0 1
I1.1 0
turns ON.
(6) Check whether the address (I1.1) to which the When the command is successful,
Command error flag has been assigned is this remains "OFF."
ON or OFF.
Address Value
If it is OFF, the command has been processed I1.0 1
normally. I1.1 0
If it is ON, the command processing failed, so
check the error code written to the address When the command fails, this turns
(PID532) to which Command Result has been "ON," so check the error code.
assigned.
Address Value
I1.0 1
I1.1 1
Q1.0 1
PID532 3
The settings shown below are required for the image output unit that will be targeted with the OW
command.
(1) Open the editing screen of the result
output unit.
Here, edit the image output unit
with unit ID 3.
(2) On the editing screen of the result output unit, click "Settings."
(3) Change "File naming" to "Specified" or "Sequential," and then click "OK" to complete
the settings.
Address Value
I1.0 1
I1.1 1
Q1.0 1
PID532 3
The settings shown below are required for the history archive that will be targeted with the OW
command.
(2) Click the "Image Archive Settings" icon to open the Image Archive Settings screen.
(3) Select the archive condition to output. Here, select archive condition 0.
(4) Check that the "Enable" check box is selected, set "Output location" to a value
other than "None," and then click "Settings."
(5) Change "File Naming Rule" to "Sequential" or "Specified," and then click "OK" to complete
the settings.
In the default settings, the OW command for history archives is not registered to the custom
commands, so add the execution details to a command number for a command that is not being used.
(1) At the top of the setup mode screen, click "Global," and then click "Custom Instruction Settings."
(2) Select an unused command (here we select number 120); overwrite the execution details to
"OW, HIST, *01, *02;" and then click "OK."
(5) Check that the address (I1.0) to which the Address Value
Command complete flag has been assigned I1.0 1
I1.1 0
turns ON.
When the command is successful,
(6) Check whether the address (I1.1) to which the
this remains "OFF."
Command error flag has been assigned is
Address Value
ON or OFF.
I1.0 1
If it is OFF, the command has been processed I1.1 0
normally. If it is ON, the command processing
failed, so check the error code written to When the command fails,
the address (PID532) to which this turns "ON," so check the error code.
Command Result has been assigned.
Address Value
I1.0 1
I1.1 1
Q1.0 1
PID532 3
(1) At the top of the setup mode screen, click "Global," and then click "Custom Instruction Settings."
(2) Select an unused command (here we select number 120); overwrite the execution details to
"MW, (variable name), *01;" and then click "OK." Here we will add a command for changing
the value of the variable "#variable." (The variable "#variable" must be added to the setup
data in advance with the variable settings.)
(6) Check whether the address (I1.1) to which When the command is successful,
the Command error flag has been assigned is this remains "OFF."
ON or OFF.
Address Value
If it is OFF, the command has been processed I1.0 1
normally. If it is ON, the command processing I1.1 0
failed, so check the error code written to
the address (PID532) to which When the command fails, this turns
Command Result has been assigned. "ON," so check the error code.
Address Value
I1.0 1
I1.1 1
Q1.0 1
PID532 3
This section explains how to overwrite local variables "#variable1" to "123.456," "#variable2" to
"999," and "#variable3" to "987.6" at the same time.
Multiple variables are overwritten at the same time, which prevents illegal combinations from
occurring even if inspections that reference these variables are performed while the overwriting is
in progress. (It prevents illegal combinations such as the X coordinate and the Y coordinate.)
By changing "Command Execution Procedure Example (Overwriting #variable as '123')," which was
explained previously, as shown below, you can overwrite multiple variables (up to 16) at the same
time.
(1) In step (2) of "Setting the custom command," change the execution details of the custom
command to "MW, #variable1, *01, #variable2, *02, #variable 3, *03."
(The variables "#variable1," "#variable2," and "#variable3," must be added to the setup data
in advance with the variable settings.)
(3) The rest of the procedure is the same as "Command Execution Procedure Example
(Overwriting #variable as '123')."
This section explains how to use the "MWX command" as an example of the commands that must be
registered as new custom commands. The MWX command overwrites the specified scalar array
variable (global variable or local variable). In the initial values, the MWX command is not registered
in the custom commands, so you have to add a custom command.
(1) At the top of the setup mode screen, click "Global," and then
click "Custom Instruction Settings."
(2) Select an unused command (here we select number 120); overwrite the execution details to
"MWX, (array variable name [index number at which to start writing]), *01;" and then click
"OK." Here we will add a command for changing the values starting at index [0] of the array
variable "#variable[]."
(The array variable "#variable[]" must be added to the setup data in advance with
the variable settings.)