24.01.2015 Views

PLC Programming

  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A Brief Introduction to CoDeSys<br />

1 A Brief Introduction to CoDeSys<br />

1.1 What is CoDeSys<br />

CoDeSys is a complete development environment for your <strong>PLC</strong>. (CoDeSys stands for Controlled<br />

Developement System).<br />

CoDeSys puts a simple approach to the powerful IEC language at the disposal of the <strong>PLC</strong><br />

programmer. Use of the editors and debugging functions is based upon the proven development<br />

program environments of advanced programming languages (such as Visual C++).<br />

1.2 Overview of CoDeSys Functions...<br />

How is a project structured<br />

A project is put into a file named after the project. The first POU (Program Organization Unit) created<br />

in a new project will automatically be named <strong>PLC</strong>_PRG. The process begins here (in compliance with<br />

the main function in a C program), and other POUs can be accessed from the same point (programs,<br />

function blocks and functions).<br />

Once you have defined a Task Configuration, it is no longer necessary to create a program named<br />

<strong>PLC</strong>_PRG. You will find more about this in chapter 6.7, Task Configuration.<br />

There are different kinds of objects in a project: POUs, data types, display elements (visualizations)<br />

and resources.<br />

The Object Organizer contains a list of all the objects in your project.<br />

How do I set up my project<br />

First you should configure your <strong>PLC</strong> in order to check the accuracy of the addresses used in the<br />

project.<br />

Then you can create the POUs needed to solve your problem.<br />

Now you can program the POUs you need in the desired languages.<br />

Once the programming is complete, you can compile the project and remove errors should there be<br />

any.<br />

How can I test my project<br />

Debugging<br />

Once all errors have been removed, activate the simulation, log in to the simulated <strong>PLC</strong> and "load"<br />

your project in the <strong>PLC</strong>. Now you are in Online mode.<br />

Now open the window with your <strong>PLC</strong> Configuration and test your project for correct sequence. To do<br />

this, enter input variables manually and observe whether outputs are as expected. You can also<br />

observe the value sequence of the local variables in the POUs. In the Watch and Receipt Manager<br />

you can configure data records whose values you wish to examine.<br />

In case of a programming error you can set breakpoints. If the process stops at such a breakpoint,<br />

you can examine the values of all project variables at this point in time. By working through<br />

sequentially (single step) you can check the logical correctness of your program.<br />

Additional Online Functions<br />

Further debugging functions:<br />

You can set program variables and inputs and outputs at certain values.<br />

CoDeSys V2.3 1-1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!