EtherNet/IP communications between a WAGO 750-871 PFC and a SICK IVC-2D Camera, English Version 1.0.0
2 General Copyright 2009 by WAGO Kontakttechnik GmbH & Co. KG All rights reserved. WAGO Kontakttechnik GmbH & Co. KG Hansastraße 27 D-32423 Minden Phone: +49 (0) 571/8 87 0 Fax: +49 (0) 571/8 87 1 69 E-Mail: info@wago.com 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: support@wago.com 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.
Table of Contents 3 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...7 4.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
4 Important comments 1 Important comments 1.1 Legal principles 1.1.1 Copyright 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. 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. Nonobservance will entail the right of claims for damages. 1.1.2 Personnel qualification 1.1.3 Intended use 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. 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 nonconforming 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 Kontakttechnik GmbH & Co. KG.
Important comments 5 1.2 Range of validity 1.3 Symbols 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. 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
6 Description 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, allowing the 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 SICK IVC-2D 192.168.0.79 Programming Terminal 192.168.0.10 WAGO 750-871 192.168.0.82 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.
Solution 7 4 Solution There are three main steps in setting up the system: 1) Configure the SICK IVC 2D Camera for EtherNet/IP 2) 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 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. 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. Assembly Type Allround No strings Small Description All types Represented More room for Numbers Small set with all types Input assembly Instance (to IVC device) Output assembly Instance (from IVC device) Size 100 101 494 102 103 470 106 107 174
8 Solution The layout for each assembly type is listed below. The data is in its order of occurrence in the assembly instance. An EtherNet/IP assembly is similar to a data structure object, which is made up of various data types and lengths. Allround Assembly (100 & 101) Type No. of Camera Parameter Start Byte values Name Offset Type Size SINT 10 SINT0 9 0 1 byte INT 10 INT0 9 10 2 bytes DINT 10 DINT0 9 30 4 bytes REAL 10 REAL0 9 70 4 bytes SSTRING 6 SSTRING0 5 110 64 bytes Total Size 494 bytes No String Assembly (102 & 103) Type No. of Camera Parameter Start Byte values Name Offset Type Size SINT 50 SINT0 49 0 1 byte INT 50 INT0 49 50 2 bytes DINT 30 DINT0 49 150 4 bytes REAL 50 REAL0 49 270 4 bytes Total Size 470 bytes Small Assembly (106 & 107) Type No. of Camera Parameter Start Byte values Name Offset Type Size SINT 10 SINT0 9 0 1 byte INT 10 INT0 9 10 2 bytes DINT 10 DINT0 9 30 4 bytes REAL 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.
Solution 9 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:
10 Solution 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.
Solution 11 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 in the 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.
12 Solution 4.3 Program the 750-871 to send Explicit EtherNet/IP Messages 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 contains the 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.
Solution 13 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: END_STRUCT END_TYPE STRING(63); NOTE: To avoid typing errors, copy the above text to the Windows clipboard and then paste it into the CoDeSys project.
14 Solution 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
Solution 15 Enter the following variables in the declaration window for the function block SickIVP_UpdateSmall_Instance. VAR_INPUT stripaddress: STRING; (* IP Address for the camera*) END_VAR VAR_IN_OUT utreaddata: *) utwritedata: data*) END_VAR SmallCameraData; (* Data structure for read data SmallCameraData; (* Data structure for write VAR_OUTPUT xreaderror: BOOL; (*Status of read command - 1 = error*) xwriteerror: BOOL; (*Status of write command - 1 = error*) END_VAR VAR EthernetIpFB: 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.
16 Solution 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_IF EthernetIpFB(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 THEN IF EthernetIpFB.GEN_ERR = 0 THEN xwriteerror:=false; ELSE xwriteerror:=true; END_IF EthernetIpFB(ENABLE:=FALSE,LEN:=wLength,DATA:=aDataOut); wstep:=1; END_IF END_CASE NOTE: To avoid typing errors, copy the above text to the Windows clipboard and then paste it into the CoDeSys project.
Solution 17 When complete, the program should look similar to the screen capture:
18 Solution 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.
WAGO Kontakttechnik GmbH & Co. KG Postfach 2880 D-32385 Minden Hansastraße 27 D-32423 Minden Phone: 05 71/8 87 0 Telefax: 05 71/8 87 1 69 E-Mail: info@wago.com Internet: http://www.wago.com