Upload
linzo75
View
238
Download
1
Embed Size (px)
Citation preview
8/18/2019 wago i/O
1/19
EtherNet/IP communicationsbetween a WAGO 750-871 PFCand a SICK IVC-2D Camera
Application note
A203600, EnglishVersion 1.0.0
8/18/2019 wago i/O
2/19
2 • General
Application noteA203600
Copyright ! 2009 by WAGO Kontakttechnik GmbH & Co. KG
All rights reserved.
WAGO Kontakttechnik GmbH & Co. KGHansastraße 27
D-32423 Minden
Phone: +49 (0) 571/8 87 – 0
Fax: +49 (0) 571/8 87 – 1 69
E-Mail: [email protected]
Web: http://www.wago.com
Technical Support
Phone: +49 (0) 571/8 87 – 5 55
Fax: +49 (0) 571/8 87 – 85 55
E-Mail: [email protected]
Every conceivable measure has been taken to ensure the correctness and
completeness of this documentation. However, as errors can never be fully
excluded we would appreciate any information or ideas at any time.
We wish to point out that the software and hardware terms as well as the
trademarks of companies used and/or mentioned in the present manual are
generally trademark or patent protected.
mailto:[email protected]://www.wago.com/mailto:[email protected]:[email protected]://www.wago.com/mailto:[email protected]
8/18/2019 wago i/O
3/19
Table of Contents • 3
Application noteA203600
TABLE OF CONTENTS
1 Important comments .................................................................................4
1.1 Legal principles......................................................................................4
1.1.1 Copyright ...............................................................................................4 1.1.2 Personnel qualification ..........................................................................4
1.1.3 Intended use ...........................................................................................4
1.2 Range of validity....................................................................................5
1.3 Symbols .................................................................................................5
2 Description..................................................................................................6
3 Reference Material ....................................................................................6
4 Solution .......................................................................................................7
4.1 Configure the SICK IVC 2D Camera for EtherNet/IP .......................... 74.1.1 SICK IVC Communication Setup Tool .................................................9
4.2 Enable the WAGO 750-871 Controller for EtherNet/IP .....................11
4.3 Program the 750-871 to send Explicit EtherNet/IP Messages............. 12
8/18/2019 wago i/O
4/19
4 • Important comments
Application noteA203600
1 Important comments
To ensure fast installation and start-up of the units described in this
manual, we strongly recommend that the following information and
explanation is carefully read and adhered to.
1.1 Legal principles
1.1.1 Copyright
This manual is copyrighted, together with all figures and illustrations
contained therein. Any use of this manual which infringes the copyright
provisions stipulated herein, is not permitted. Reproduction, translation
and electronic and photo-technical archiving and amendments require the
written consent of WAGO Kontakttechnik GmbH & Co. KG. Non-
observance will entail the right of claims for damages.
1.1.2 Personnel qualification
The use of the product detailed in this manual is exclusively geared to
specialists having qualifications in PLC programming, electrical
specialists or persons instructed by electrical specialists who are also
familiar with the valid standards. WAGO Kontakttechnik GmbH & Co.
KG declines all liability resulting from improper action and damage to
WAGO products and third party products due to non-observance of the
information contained in this manual.
1.1.3 Intended use
For each individual application, the components supplied are to work with
a dedicated hardware and software configuration. Modifications are only
admitted within the framework of the possibilities documented in the
manuals. All other changes to the hardware and/or software and the non-
conforming use of the components entail the exclusion of liability on part
of WAGO Kontakttechnik GmbH.
Please direct any requirements pertaining to a modified and/or new
hardware or software configuration directly to WAGO KontakttechnikGmbH & Co. KG.
8/18/2019 wago i/O
5/19
Important comments • 5
Application noteA203600
1.2 Range of validity
This application note is based on the stated hardware and software of the
specific manufacturer as well as the correspondent documentation. This
application note is therefore only valid for the described installation.
New hardware and software versions may need to be handled differently.
Please note the detailed description in the specific manuals.
1.3 Symbols
Danger
Always observe this information to protect persons from injury.
Warning
Always observe this information to prevent damage to the device.
Attention
Marginal conditions must always be observed to ensure smooth operation.
ESD (Electrostatic Discharge)
Warning of damage to the components by electrostatic discharge. Observe
the precautionary measure for handling components at risk.
Note
Routines or advice for efficient use of the device and software optimization.
More information
References to additional literature, manuals, data sheets and INTERNET
pages
8/18/2019 wago i/O
6/19
6 • Description
Application noteA203600
2 Description
The purpose of this document is to provide an example of interfacing a WAGO 750-871
ETHERNET Controller with a SICK IVC-2D camera using EtherNet/IP protocol. In this
example, the WAGO 750-871 communicates with the SICK IVC-2D via explicit EtherNet/IP
messaging. The SICK IVC-2 responds to messages originated by the WAGO 750-871, allowingthe 750-871 to read and write variable data from the camera.
3 Reference Material
This procedure was tested with the following hardware and software:
" SICK IVC-2 Camera
" SICK IVC Studio 2.8
" WAGO 750-871 ETHERNET Controller, Version 01.03.02(03) Firmware
" WAGO-IO-PRO CAA Programming Software, Version 2.3.9.7
System Layout
WAGO 750-871192.168.0.82
ProgrammingTerminal
192.168.0.10
SICK IVC-2D192.168.0.79
NOTE: This procedure assumes that the WAGO 750-871 has a valid IP address and is
installed on a working network along with the SICK IVC-2D camera and the
programming terminal. If necessary, please refer to WAGO’s Application Note
A202900 for assigning a static IP address to the WAGO 750-871.
8/18/2019 wago i/O
7/19
Solution • 7
Application noteA203600
4 Solution
There are three main steps in setting up the system:
1) Configure the SICK IVC 2D Camera for EtherNet/IP2) Enable the WAGO 750-871 Controller for Ethernet/IP
3) Program the WAGO 750-871 to send Explicit EtherNet/IP Messages
4.1 Configure the SICK IVC 2D Camera for EtherNet/IP
In IVC Studio 2.8 there are six EtherNet/IP assembly instances defined - three input
and three output. The assemblies are of different sizes to fit different applications.
The input and output assembly for each type contains the same number of each data
type and are of the same length. The three assemble types are named: “Allround”,
“No strings” and “Small”. This example uses the “Small” assembly.
AssemblyType
Description Input assemblyInstance (to IVC
device)
Output assemblyInstance (from
IVC device)
Size
Allround All typesRepresented
100 101 494
No strings More room forNumbers
102 103 470
Small Small set withall types
106 107 174
NOTE: This section assumes that you have an overall understanding of SICK
IVC Studio and the SICK IVC 2D camera. It only focuses on configuring
variables in the camera, so they can be accessed via EtherNet/IP from the
WAGO 750-871 controller. For more information on the SICK IVC products,
please refer to their respective manuals.
8/18/2019 wago i/O
8/19
8 • Solution
Application noteA203600
The layout for each assembly type is listed below. The data is in its order of occurrence in theassembly instance. An EtherNet/IP assembly is similar to a data structure object, which ismade up of various data types and lengths.
Allround Assembly (100 & 101)
Type No. ofvalues
Camera ParameterName
Start ByteOffset
Type Size
SINT 10 SINT0 … 9 0 1 byteINT 10 INT0 … 9 10 2 bytes
DINT 10 DINT0 … 9 30 4 bytesREAL 10 REAL0 … 9 70 4 bytes
SSTRING 6 SSTRING0… 5 110 64 bytes
Total Size 494 bytes
No String Assembly (102 & 103)
Type No. ofvalues Camera ParameterName Start ByteOffset Type Size
SINT 50 SINT0 … 49 0 1 byteINT 50 INT0 … 49 50 2 bytes
DINT 30 DINT0 … 49 150 4 bytesREAL 50 REAL0 … 49 270 4 bytes
Total Size 470 bytes
Small Assembly (106 & 107)
Type No. ofvalues
Camera ParameterName
Start ByteOffset
Type Size
SINT 10 SINT0 … 9 0 1 byte
INT 10 INT0 … 9 10 2 bytesDINT 10 DINT0 … 9 30 4 bytesREAL 10 REAL0 … 9 70 4 bytes
SSTRING 1 SSTRING0… 5 110 64 bytes
Total Size 174 bytes
NOTE: IVC Studio 2.6 SR1 uses a different Small Assembly, which is 172 bytes long.
8/18/2019 wago i/O
9/19
Solution • 9
Application noteA203600
4.1.1 SICK IVC Communication Setup Tool
The Communication Setup tool in SICK IVC Studio is used to define the variable
mapping between values in IVC studio and an internal buffer that can be accessed via
the EtherNet/IP fieldbus.
By double-clicking the Setup button an interactive setup is brought up as shown below:
8/18/2019 wago i/O
10/19
10 • Solution
Application noteA203600
In the example above three input values and four output values are mapped. The first input
value is mapped from SINT0, which is the first SINT (short integer) in the input assembly, to
table index V0. The next two are mapped from REAL0 and REAL1 to table index V1 and V2,
respectively. The output values, representing position, area and volume in this example, are
mapped from table index V9 - V12 to INT0 and INT1 (which are the first and second integers
in the output assembly), and to REAL0 and REAL1.
Type: Data type of the parameter in the assembly
Parameter: The parameter in the assembly
Destination: Destination parameter in the IVC (only table values allowed)
Source: Source parameter in the IVC (constant, table value or step result allowed)
Name: User defined name
Preview(HEX): Shows actual raw format. This column will be automatically updated
when the communication window opens and closes, but can be manually updated by
clicking the “Get preview(Hex) value” command button.
8/18/2019 wago i/O
11/19
Solution • 11
Application noteA203600
4.2 Enable the WAGO 750-871 Controller for EtherNet/IP
EtherNet/IP protocol is disabled in the 750-871 Controller by default, so it is necessary to
enable it. This is done using a web browser to access the internal webpages of the 750-871.
Run a web browser (e.g. Microsoft’s Internet Explorer) on the programming terminal.
In the address bar enter the IP address of the 750-871 ETHERNET Controller and hit
Enter.
The 750-871’s internal webpage should appear. If it does not, check that you have an Ethernet
link to the 750-871’s Ethernet port, and that the IP address of the programming terminal is inthe same subnet as the 750-871.
Click the ‘Port’ hyperlink in the left browser frame. The following dialog will appear:
Enter the following:
User Name: admin
Password: wago Click OK .
The ‘Port configuration’ frame will appear.
In this frame, you must check ‘EtherNet IP’ as enabled. You may enable or disable other
protocols at this time as well. Click ‘SUBMIT’ when finished. Perform a hardware or
software reset so the new settings take effect.
The WAGO 750-871 Ethernet Controller is now enabled for EtherNet/IP communications.
8/18/2019 wago i/O
12/19
12 • Solution
Application noteA203600
4.3 Program the 750-871 to send Explicit EtherNet/IPMessages
The 750-871 Ethernet Controller can be programmed to send explicit EtherNet/IP
messages to other devices using a CoDeSys program. The library EML.LIB containsthe function block EML_UCMM_REQ, which is used to send EtherNet/IP messages.
Make sure the CoDeSys development tool and the library EML.LIB are installed on
the programming terminal before proceeding.
1) Create a new CoDeSys project. From the top menu bar, select File..New. You
may be asked if you’d like to save your existing program. Answer accordingly.
A Target Settings dialog appears. Select the “WAGO_750-871” target. Click OK
to continue.
A New POU dialog appears.
Complete the New POU information as follows:
Name of the new POU: PLC_PRG
Type of POU: Program
Language of the POU: LD
Click OK to continue. The PLC_PRG POU should display.
2) Add the EtherNet/IP library EML.LIB to the CoDeSys project. From the top menu bar,
select Window..Library Manager. Again from the top menu bar, select
Insert..Additional Library. Select the library EML.LIB, and click Enter.
8/18/2019 wago i/O
13/19
Solution • 13
Application noteA203600
3) This program will use a user-defined data structure to organize the data between the 750-
871 controller and the SICK IVC 2D camera. Click on the Data Types tab in the lower
left-hand corner.
From the top menu bar, select Project..Object Add...
Type in the name of the new data type as SmallCameraData, and click OK
Enter the following member variables between the key words STRUCT and
END_STRUCT like below:
TYPE SmallCameraData :STRUCT
SINTx:ARRAY [0..9] OF BYTE;INTx:ARRAY [0..9] OF INT;DINTx:ARRAY [0..9] OF DINT;REALx:ARRAY [0..9] OF REAL;STRINGx: STRING(63);
END_STRUCTEND_TYPE
NOTE: To avoid typing errors, copy the above text to the Windows’ clipboard
and then paste it into the CoDeSys project.
8/18/2019 wago i/O
14/19
14 • Solution
Application noteA203600
The program code for interfacing with the camera will be put into a function block for
organization and re-usability. To create a new function block, click on the POUs tab in
the lower left-hand corner of CoDeSys and then double-click on the POUs folder in the
POU view. Select Project..Object Add.. from the top menu bar.
The New POU dialog is displayed.
Enter the information below:
Name of the new POU: SickIVP_UpdateSmall_Instance
Type of POU: Function Block
Language of the POU: ST
8/18/2019 wago i/O
15/19
Solution • 15
Application noteA203600
Enter the following variables in the declaration window for the function block
SickIVP_UpdateSmall_Instance.
VAR_INPUTstrIpAddress: STRING; (* IP Address for the camera*)
END_VAR
VAR_IN_OUTutReadData: SmallCameraData; (* Data structure for read data
*)utWriteData: SmallCameraData; (* Data structure for write
data*)END_VAR
VAR_OUTPUTxReadError: BOOL; (*Status of read command - 1 = error*)xWriteError: BOOL; (*Status of write command - 1 = error*)
END_VAR
VAREthernetIpFB: EML_UCMM_REQ;aDataIn: ARRAY [1..2000] OF BYTE;aDataOut: ARRAY [1..2000] OF BYTE; wLength: WORD;dwTimeOut: DWORD := 4000; wStep: WORD:= 1;
END_VAR
When complete, the variable declaration window should look like the screen capture
below.
8/18/2019 wago i/O
16/19
16 • Solution
Application noteA203600
Enter the structured text program below for the SickIVP_UpdateSmall_Instance
function block body in the code window.
CASE wStep OF
1: (* Read data from camera via EtherNet/IP explicit messages*) wLength:=0;EthernetIpFB(ENABLE:=TRUE, NETWORK_PATH:=strIpAddress,SRV:=EML_GET_ATTR,CLASS:=4, INST:=107, ATTR:=3, MEM:=16#FFFF,TAG:='',TAG_SIZE:=0, TOUT:=dwTimeOut,LEN:=wLength, DATA:=aDataIn);IF EthernetIpFB.CONFIRM = TRUE THEN
IF EthernetIpFB.GEN_ERR = 0 THEN(*Comms good - copy data to utReadData data structure. Copy data by array*)(* An extra byte is sometimes inserted between array types in a structure*)SysMemCpy(ADR(utReadData.SINTx[0]), ADR(aDataIn[1]), 10);SysMemCpy(ADR(utReadData.INTx[0]), ADR(aDataIn[11]), 20);SysMemCpy(ADR(utReadData.DINTx[0]), ADR(aDataIn[31]), 40);SysMemCpy(ADR(utReadData.REALx[0]), ADR(aDataIn[71]), 40);SysMemCpy(ADR(utReadData.STRINGx), ADR(aDataIn[111]), 64);xReadError:=FALSE;
ELSE
xReadError:=TRUE;END_IFEthernetIpFB(ENABLE:=FALSE,LEN:=wLength,DATA:=aDataIn); wStep:=2;END_IF
2:(* Write data to camera via EtherNet/IP explicit messages*) wLength:=174;SysMemCpy(ADR(aDataOut[1]), ADR(utWriteData.SINTx[0]), 10);SysMemCpy(ADR(aDataOut[11]), ADR(utWriteData.INTx[0]), 20);SysMemCpy(ADR(aDataOut[31]), ADR(utWriteData.DINTx[0]), 40);SysMemCpy(ADR(aDataOut[71]), ADR(utWriteData.REALx[0]), 40);SysMemCpy(ADR(aDataOut[111]), ADR(utWriteData.STRINGx), 64);EthernetIpFB(ENABLE:=TRUE, NETWORK_PATH:= strIpAddress,
SRV:=EML_SET_ATTR, CLASS:=4, INST:=106, ATTR:=3, MEM:=16#FFFF,TAG:='',TAG_SIZE:=0, TOUT:=dwTimeOut,
LEN:=wLength,DATA:=aDataOut);IF EthernetIpFB.CONFIRM = TRUE THENIF EthernetIpFB.GEN_ERR = 0 THEN
xWriteError:=FALSE;ELSE
xWriteError:=TRUE;END_IFEthernetIpFB(ENABLE:=FALSE,LEN:=wLength,DATA:=aDataOut); wStep:=1;
END_IFEND_CASE
NOTE: To avoid typing errors, copy the above text to the Windows’ clipboard
and then paste it into the CoDeSys project.
8/18/2019 wago i/O
17/19
Solution • 17
Application noteA203600
When complete, the program should look similar to the screen capture:
8/18/2019 wago i/O
18/19
18 • Solution
Application noteA203600
4) The following screen capture shows how to call the SickIVP_UpdateSmall_Instance
function block from a ladder program. The data read from the camera’s “Small”
assembly instance is placed into the CoDeSys variable utReadData. The data that is to be
written to the camera is put in the variable utWriteData. Both variables utReadData and
utWriteData are defined as a type SmallCameraData.
Additionally, this program shows how to access Boolean variables that are linked to the
camera.
8/18/2019 wago i/O
19/19
WAGO Kontakttechnik GmbH & Co. KGPostfach 2880 • D-32385 MindenHansastraße 27 • D-32423 MindenPhone: 05 71/8 87 – 0Telefax: 05 71/8 87 – 1 69E-Mail: [email protected]
Internet: http://www.wago.com
mailto:[email protected]://www.wago.com/http://www.wago.com/mailto:[email protected]