Sei sulla pagina 1di 24

How to get data from Festo CoDeSys controllers via OPC

To exchange data between an OPC-Client and any Festo CoDeSys controller, we will need a CoDeSys
project anyway.

So this document will tell you how to create a CoDeSys project, that is designed to exchange data
via OPC. Afterwards it will show you how to test it.

SC-ST/Wolfgang Keim 20. Juli 2009


First of all, create a new project and choose the target you got

Don„t forget to mark the


checkbox “Download
symbol file”, because
the symbol file includes
the information about
the variables.

SC-ST/Wolfgang Keim 20. Juli 2009 2


Please create the program called “main” and choose ST as language

SC-ST/Wolfgang Keim 20. Juli 2009 3


Write a little program, e.g. just as shown below

SC-ST/Wolfgang Keim 20. Juli 2009 4


We have to setup the “Task configuration”, because the program name is
not PLC_PRG. So, please change the task configuration as shown below.

SC-ST/Wolfgang Keim 20. Juli 2009 5


Then we have to do the symbol configuration. Therefore open the menu
“Options”

SC-ST/Wolfgang Keim 20. Juli 2009 6


Mark the checkbox “Dump symbol entries”, this ensures that the symbol
file will be created

Then click on “Configure symbol file ...”

SC-ST/Wolfgang Keim 20. Juli 2009 7


Make sure that all
folders are marked

Uncheck all
checkboxes
and click on
OK Button

SC-ST/Wolfgang Keim 20. Juli 2009 8


Close the menu “Options” by clicking on the OK-button. Open
the pull down menu and choose “Clean all” to make the
changes happen

Afterwards, open the


“Symbol configuration”
again

SC-ST/Wolfgang Keim 20. Juli 2009 9


Mark the parts of the tree
where the variables are
found, you want to transmit

Mark the checkboxes as


shown and close the window
by clicking the OK-button

SC-ST/Wolfgang Keim 20. Juli 2009 10


Setup the communication
parameters of your
controller you want to get
online

SC-ST/Wolfgang Keim 20. Juli 2009 11


Login and start the program.
The variable “i” has to be
integrated.

SC-ST/Wolfgang Keim 20. Juli 2009 12


Now it is time to setup the OPC-Server
Therefore, please open the “CoDeSys
OPC Configuration”.

SC-ST/Wolfgang Keim 20. Juli 2009 13


Please check the preselection of
the “PLC Default Settings”

SC-ST/Wolfgang Keim 20. Juli 2009 14


Mark this Checkbox if
you use CECX-
Controllers, because
they have a Motorola-
Processor built.

SC-ST/Wolfgang Keim 20. Juli 2009 15


Now we have to append a
PLC

SC-ST/Wolfgang Keim 20. Juli 2009 16


To choose the PLC you
want to connect, please
click on Edit and select the
corresponding PLC

Don‟t forget to save the file!

Then the OPC configuration


is completed

SC-ST/Wolfgang Keim 20. Juli 2009 17


Now, it‟s time to test the
OPC-connection…

…therefore I choose
dOPC Explorer, but you
can use any OPC client ,
you want to. If you want to
get dOPC Explorer then
you will find it via Google

SC-ST/Wolfgang Keim 20. Juli 2009 18


If you want to work with an OPC well
known by yourself then try to do similar
settings as described on the next
pages for the dOPC Explorer

First of all add a New Server and


choose “OPC Server for CoDeSys
provided by Festo V2.0”. Close the
window by clicking OK.

SC-ST/Wolfgang Keim 20. Juli 2009 19


Then connect to the server…

SC-ST/Wolfgang Keim 20. Juli 2009 20


…into “Server items” you
will find the variables
from the CoDeSys
Project…

…drag it with the mouse


pointer and drop it into
the folder “Default”

SC-ST/Wolfgang Keim 20. Juli 2009 21


To watch the data of the
variable online, please
activate it with a right
mouse click on “Default”
folder and a left mouse
click on “Active”

SC-ST/Wolfgang Keim 20. Juli 2009 22


Afterwards you will see
the value running

If you want to see the


value into a trend
graph, please activate
the checkbox “Trend
Graph”

SC-ST/Wolfgang Keim 20. Juli 2009 23


Then you will be able to see the value change over a period of time…

SC-ST/Wolfgang Keim 20. Juli 2009 24

Potrebbero piacerti anche