You are on page 1of 23

How to get data from Festo CoDeSys v3.

5 controllers via OPC


This document will tell you how to create a CoDeSys V3.5 project, that is designed to exchange data
via OPC. Afterwards it will show you how to test it and connect to Rensen OPC Office link to forward
the data to an excel spreadsheet.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Open CoDeSys V3.5 and start a new CECC project. Once open right click on application in the
device tree and goto Add Object -> Symbol configuration. Click on Symbol configuration and then
Click OPEN. Symbol configuration will be added to the device tree.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Double click on Device in the Device tree to access communication settings. Scan the network
to add Available PLCs. The default names will be CECC1, CECC2, etc. It is important to know the
names of the PLCs for the configuration of the OPC server later.

The name of the PLC can be changed


by right clicking on the PLC and
selecting Network properties.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

In POU PLC_PRG write a simple program.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Double click on Symbol configuration. You may have to click the refresh button to update the
variables.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Add the variables that you want to access via the OPC by highlighting them and click the arrow

Click this icon to change


between Read-Only,
Write-Only or Read &
Write.

The variables listed here


are the variables that will
be accessible by the OPC
server.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Go online and download. Make sure to run the PLC and check the program is running.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Now we must configure the OPC server. The OPC configurator is not located in the Start menu. It is
located in the program files of CoDeSys V3.5. Navigate to the OPC configurator and run it.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Right click on Server and select Append PLC

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Leave the default settings for PLC1 as they are.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Selection Connection and click edit to change the PLC connection settings

Enter the name of the PLC to be accessed here.


This should be the same name as shown in the
Communication settings in CoDeSys V3.5.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Click OK and DONT FORGET TO SAVE. NOT SAVE AS


You can now exit the Configurator. The OPC server will automatically open in the background as
soon as an OPC client wants to access it.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

We will now test the OPC server using a simple client called dOPC explorer http://www.dopc.kassl.de/
Download and run dOPC.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Right click on OPC Server and select New Server Ins.


Choose CoDeSysOPCDA from available servers.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Double click on CoDeSysOPCDA to connect to it. This will start the OPC server and upload the
Sybol configuration file from the PLC. Expand the server tree until you find the tag Count

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

To monitor the value of the tag, drag the tag into Groups -> Default.
open the Default folder to see the tags live values.
Make sure the Default folder is active by right clicking on it and selecting Active

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

We will now configure Rensen OPC office link to show tag values in excel.
Open Rensen OPC office link. All available OPC servers will appear including CoDeSysOPCDA

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Make sure CoDeSysOPCDA is highlighted and add a new data group.

New Data group

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Expand the CoDeSysOPCDA tree to locate the tag Count.


Drag the tag into the data group you just created.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Open the Data Group and right click on the tag and select Copy Live

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Open up a new excel spreadsheet. Select a cell and right click on it. Select paste special.
Under Paste link select Unicode Text and click OK.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Go back to Rensen OPC Office Link.


Highlight the Data Group and select the Start sampling button.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

Go back to the Excel Spreadsheet and you see the value LIVE.

IM-CRC/Alexander Weinhard

Hallo Welt!

5. April 2011

gendert: 7. April 2011, LPK

Entwurf

Vertraulich

You might also like