Anda di halaman 1dari 19

EtherNet/IP communications

between a WAGO 750-871 PFC


and a SICK IVC-2D Camera

Application note

A203600, English
Version 1.0.0

2 General

Copyright 2009 by WAGO Kontakttechnik GmbH & Co. KG


All rights reserved.

WAGO Kontakttechnik GmbH & Co. KG


Hansastrae 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.

Application note
A203600

Table of Contents

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

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

Application note
A203600

4 Important comments

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. Nonobservance 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 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.

Application note
A203600

Important comments

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

Application note
A203600

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 WAGOs Application Note
A202900 for assigning a static IP address to the WAGO 750-871.

Application note
A203600

Solution

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

Description

Allround

All types
Represented
More room for
Numbers
Small set with
all types

No strings
Small

Application note
A203600

Input assembly
Instance (to IVC
device)
100

Output assembly
Instance (from
IVC device)
101

Size

102

103

470

106

107

174

494

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)
No. of
Type
values
SINT
10
INT
10
DINT
10
REAL
10
SSTRING
6

Camera Parameter
Name
SINT0 9
INT0 9
DINT0 9
REAL0 9
SSTRING0 5

No String Assembly (102 & 103)


No. of
Camera Parameter
Type
values
Name
SINT
50
SINT0 49
INT
50
INT0 49
DINT
30
DINT0 49
REAL
50
REAL0 49

Small Assembly (106 & 107)


No. of
Type
values
SINT
10
INT
10
DINT
10
REAL
10
SSTRING
1

Camera Parameter
Name
SINT0 9
INT0 9
DINT0 9
REAL0 9
SSTRING0 5

Start Byte
Offset
0
10
30
70
110
Total Size

Start Byte
Offset
0
50
150
270
Total Size

Start Byte
Offset
0
10
30
70
110
Total Size

Type Size
1 byte
2 bytes
4 bytes
4 bytes
64 bytes
494 bytes

Type Size
1 byte
2 bytes
4 bytes
4 bytes
470 bytes

Type Size
1 byte
2 bytes
4 bytes
4 bytes
64 bytes
174 bytes

NOTE: IVC Studio 2.6 SR1 uses a different Small Assembly, which is 172 bytes long.

Application note
A203600

Solution

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:

Application note
A203600

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.

Application note
A203600

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. Microsofts 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-871s internal webpage should appear. If it does not, check that you have an Ethernet
link to the 750-871s 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.

Application note
A203600

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 youd 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.

Application note
A203600

Solution

13

3) This program will use a user-defined data structure to organize the data between the 750871 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_STRUCT
END_TYPE

NOTE: To avoid typing errors, copy the above text to the Windows clipboard

and then paste it into the CoDeSys project.

Application note
A203600

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

Application note
A203600

Solution

Enter the following variables in the declaration window for the function block
SickIVP_UpdateSmall_Instance.
VAR_INPUT
strIpAddress:
END_VAR
VAR_IN_OUT
utReadData:
*)
utWriteData:
data*)
END_VAR
VAR_OUTPUT
xReadError:
xWriteError:
END_VAR

STRING;

(* IP Address for the camera*)

SmallCameraData; (* Data structure for read data


SmallCameraData; (* Data structure for write

BOOL;
BOOL;

(*Status of read command - 1 = error*)


(*Status of write command - 1 = error*)

VAR
EthernetIpFB:
aDataIn:
aDataOut:
wLength:
dwTimeOut:
wStep:
END_VAR

EML_UCMM_REQ;
ARRAY [1..2000] OF BYTE;
ARRAY [1..2000] OF BYTE;
WORD;
DWORD := 4000;
WORD:= 1;

When complete, the variable declaration window should look like the screen capture
below.

Application note
A203600

15

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.

Application note
A203600

Solution

When complete, the program should look similar to the screen capture:

Application note
A203600

17

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 cameras 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.

Application note
A203600

WAGO Kontakttechnik GmbH & Co. KG


Postfach 2880 D-32385 Minden
Hansastrae 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

Anda mungkin juga menyukai