User Manual for PLC Programming

[Pages:172]User Manual for

PLC Programming

with

CoDeSys 2.3

Copyright ? 1994, 1997, 1999, 2001,2002, 2003 by 3S - Smart Software Solutions GmbH All rights reserved.

We have gone to great lengths to ensure this documentation is correct and complete. However, since it is not possible to produce an absolutely error-free text, please feel free to send us your hints and suggestions for improving it.

Trademark Intel is a registered trademark and 80286, 80386, 80486, Pentium are trademarks of Intel Corporation. Microsoft, MS and MS-DOS are registered trademarks, Windows is a trademark of Microsoft Corporation.

Publisher 3S - Smart Software Solutions GmbH Memminger Stra?e 151 D-87439 Kempten Tel. +49 831 5 40 31 - 0 Fax +49 831 5 40 31 ? 50

Last update 20.08.2003 Version 2.0

Content

1 A Brief Introduction to CoDeSys

1-1

1.1

What is CoDeSys .................................................................................................1-1

1.2

Overview of CoDeSys Functions... ......................................................................1-1

1.3

Overview on the user documentation for CoDeSys.............................................1-3

2 What is What in CoDeSys

2-1

2.1 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.3 2.4

Project Components.............................................................................................2-1 Languages... .........................................................................................................2-8 Instruction List (IL)... .............................................................................................2-8 Structured Text (ST).............................................................................................2-10 Sequential Function Chart (SFC).........................................................................2-16 Function Block Diagram (FBD)... .........................................................................2-20 The Continuous Function Chart Editor (CFC)... ..................................................2-21 Ladder Diagram (LD)............................................................................................2-21 Debugging, Online Functions...............................................................................2-23 The Standard... .....................................................................................................2-25

3 We Write a Little Program

3-1

3.1

Controlling a Traffic Signal Unit............................................................................3-1

3.2

Visualizing a Traffic Signal Unit............................................................................3-12

4 The Individual Components

4-1

4.1 4.2 4.3 4.3.1 4.4 4.5 4.6 4.7 4.8

The Main Window.................................................................................................4-1 Project Options.....................................................................................................4-3 Managing Projects................................................................................................4-15 'Project 'Data Base Link'.......................................................................................4-34 Managing Objects in a Project... ..........................................................................4-41 General Editing Functions....................................................................................4-48 General Online Functions... .................................................................................4-52 Window set up......................................................................................................4-62 Help when you need it... .......................................................................................4-62

5 Editors in CoDeSys

5-1

5.1 5.2 5.3 5.3.1 5.3.2 5.4 5.4.1 5.4.2 5.4.3 5.4.4

This is for all Editors... ..........................................................................................5-1 Declaration Editor... ..............................................................................................5-2 The Text Editors... ................................................................................................5-12 The Instruction List Editor... .................................................................................5-16 The Editor for Structured Text..............................................................................5-17 The Graphic Editors... ..........................................................................................5-17 The Function Block Diagram Editor... ..................................................................5-19 The Ladder Editor.................................................................................................5-24 The Sequential Function Chart Editor..................................................................5-29 The Continuous Function Chart Editor (CFC)... ..................................................5-36

Table Of Contents

6 The Resources

6-1

6.1

Overview of the Resources.................................................................................. 6-1

6.2

Global Variables, Variable Configuration, Document Frame.............................. 6-2

6.2.1 Global Variables................................................................................................... 6-2

6.2.2 Variable Configuration... ...................................................................................... 6-6

6.2.3 Document Frame... .............................................................................................. 6-7

6.3

Library Manager... ................................................................................................ 6-8

6.4

Log... .................................................................................................................... 6-10

6.5

PLC Configuration................................................................................................ 6-12

6.5.1 Working in the PLC Configuration... .................................................................... 6-13

6.5.2 General Settings in the PLC Configuration ......................................................... 6-14

6.5.3 Custom specific parameter dialog ....................................................................... 6-14

6.5.4 Configuration of an I/O Module............................................................................ 6-15

6.5.5 Configuration of a Channel.................................................................................. 6-18

6.5.6 Configuration of Profibus Modules ...................................................................... 6-18

6.5.7 Configuration of CAN modules ............................................................................ 6-26

6.5.8 Configuration of a CanDevice (CANopen Slave) ................................................ 6-30

6.5.9 PLC Configuration in Online Mode ...................................................................... 6-33

6.6

Target Settings ..................................................................................................... 6-33

6.6.1 Dialog Target Settings ......................................................................................... 6-34

6.7

Task Configuration... ............................................................................................ 6-35

6.8

Watch and Receipt Manager... ............................................................................ 6-40

6.9

Sampling Trace.................................................................................................... 6-43

6.9.1 Create a Sampling Trace..................................................................................... 6-43

6.9.2 'Extras' 'Save trace values' .................................................................................. 6-47

6.9.3 'Extras' 'External Trace Configurations'............................................................... 6-48

6.10 Target Settings ..................................................................................................... 6-49

6.10.1 Dialog Target Settings ......................................................................................... 6-50

6.11 Parameter Manager ............................................................................................. 6-50

6.11.1 Activating the Parameter Manager ...................................................................... 6-51

6.11.2 Der Parameter Manager Editor... ........................................................................ 6-52

6.11.3 Parameter List Types and Attributes ................................................................... 6-52

6.11.4 Editing parameter lists ......................................................................................... 6-54

6.11.5 Export / Import of parameter lists ........................................................................ 6-56

6.11.6 Parameter Manager in Online Mode ................................................................... 6-56

6.12 PLC Browser........................................................................................................ 6-57

6.12.1 General remarks concerning PLC Browser operation ........................................ 6-57

6.12.2 Command entry in the PLC Browser................................................................... 6-58

6.12.3 Use of macros during the command entry in PLC-Browser................................ 6-59

6.12.4 Further PLC Browser options .............................................................................. 6-60

6.13 Tools..................................................................................................................... 6-60

6.13.1 Creating new Tool Shortcuts ............................................................................... 6-61

6.13.2 Properties of available Tool Shortcuts (Object Properties)................................. 6-62

6.13.3 Deleting connections............................................................................................ 6-65

6.13.4 Executing Tool Shortcuts ..................................................................................... 6-65

6.13.5 Saving Tool Shortcuts.......................................................................................... 6-65

6.13.6 Frequently asked questions on Tools .................................................................. 6-65

7 ENI

7.1.1 7.1.2 7.1.3 7.1.4

7-1

What is ENI .......................................................................................................... 7-1 Preconditions for Working with an ENI project data base................................... 7-1 Working with the ENI project data base in CoDeSys .......................................... 7-2 Object categories concerning the project data base........................................... 7-2

ii

CoDeSys V2.3

8 The License Manager

8-1

8.1.1 Creating a licensed library in CoDeSys ...............................................................8-1

9 DDE Communication with CoDeSys

9-1

9.1

DDE interface of the CoDeSys programming system... ......................................9-1

9.2

DDE communcation with the GatewayDDE Server.............................................9-2

10 APPENDIX

10-1

Appendix A: IEC Operators and additional norm extending functions

10-1

10.1 Arithmetic Operators... .........................................................................................10-1 10.2 Bitstring Operators... ............................................................................................10-4 10.3 Bit-Shift Operators................................................................................................10-6 10.4 Selection Operators..............................................................................................10-9 10.5 Comparison Operators.........................................................................................10-11 10.6 Address Operators... ............................................................................................10-13 10.7 Calling Operators..................................................................................................10-14 10.8 Type Conversions.................................................................................................10-15 10.9 Numeric Operators...............................................................................................10-19

Appendix B: Operands in CoDeSys

10-25

10.10 10.11 10.12 10.13

Constants..............................................................................................................10-25 Variables ...............................................................................................................10-27 Addresses.............................................................................................................10-28 Functions ..............................................................................................................10-29

Appendix C: Data types in CoDeSys

10-31

10.14 Standard data types .............................................................................................10-31 10.15 Defined data types................................................................................................10-33

Appendix D: CoDeSys Libraries

10-39

10.16 The Standard.lib library........................................................................................10-39 10.16.1 String functions.....................................................................................................10-39 10.16.2 Bistable Function Blocks... ...................................................................................10-43 10.16.3 Trigger... ...............................................................................................................10-44 10.16.4 Counter... ..............................................................................................................10-46 10.16.5 Timer.....................................................................................................................10-48 10.17 The Util.lib library..................................................................................................10-51 10.17.1 BCD Conversion...................................................................................................10-51 10.17.2 Bit-/Byte Functions ...............................................................................................10-52 10.17.3 Mathematic Auxiliary Functions ...........................................................................10-53 10.17.4 Controllers ............................................................................................................10-54 10.17.5 Signal Generators... .............................................................................................10-55 10.17.6 Function Manipulators... .......................................................................................10-56 10.17.7 Analog Value Processing... ..................................................................................10-58 10.18 AnalyzationNew.lib library ....................................................................................10-59 10.19 The CoDeSys System Libraries ...........................................................................10-60

Appendix E: Operators and Library Modules Overview

10-61

Appendix F: Command Line-/Command File

10-67

10.20 Command Line Commands .................................................................................10-67

Table Of Contents

10.21 Command File (cmdfile) Commands................................................................... 10-67

Appendix G: Siemens Import

10-75

Appendix H: Target Settings Dialogs in Detail

10-81

10.21.1 Settings in Category Target Platform .................................................................. 10-82 10.21.2 Target Settings in Category General ................................................................... 10-90 10.21.3 Target Settings in Category Networkfunctionality ............................................... 10-91 10.21.4 Target Settings in Category Visualisation ........................................................... 10-92

Appendix I: Use of Keyboard

10-93

10.22 Use of Keyboard .................................................................................................. 10-93 10.23 Key Combinations ................................................................................................ 10-93

Appendix J: Compiler Errors and Warnings

10-99

10.24 Warnings .............................................................................................................. 10-99 10.25 Errors.................................................................................................................... 10-102

11 Index

I

iv

CoDeSys V2.3

A Brief Introduction to CoDeSys

1 A Brief Introduction to CoDeSys

1.1 What is CoDeSys

CoDeSys is a complete development environment for your PLC. (CoDeSys stands for Controlled Developement System). CoDeSys puts a simple approach to the powerful IEC language at the disposal of the PLC programmer. Use of the editors and debugging functions is based upon the proven development program environments of advanced programming languages (such as Visual C++).

1.2 Overview of CoDeSys Functions...

How is a project structured? A project is put into a file named after the project. The first POU (Program Organization Unit) created in a new project will automatically be named PLC_PRG. The process begins here (in compliance with the main function in a C program), and other POUs can be accessed from the same point (programs, function blocks and functions). Once you have defined a Task Configuration, it is no longer necessary to create a program named PLC_PRG. You will find more about this in chapter 6.7, Task Configuration. There are different kinds of objects in a project: POUs, data types, display elements (visualizations) and resources. The Object Organizer contains a list of all the objects in your project.

How do I set up my project? First you should configure your PLC in order to check the accuracy of the addresses used in the project. Then you can create the POUs needed to solve your problem. Now you can program the POUs you need in the desired languages. Once the programming is complete, you can compile the project and remove errors should there be any.

How can I test my project? Once all errors have been removed, activate the simulation, log in to the simulated PLC and "load" your project in the PLC. Now you are in Online mode. Now open the window with your PLC Configuration and test your project for correct sequence. To do this, enter input variables manually and observe whether outputs are as expected. You can also observe the value sequence of the local variables in the POUs. In the Watch and Receipt Manager you can configure data records whose values you wish to examine.

Debugging In case of a programming error you can set breakpoints. If the process stops at such a breakpoint, you can examine the values of all project variables at this point in time. By working through sequentially (single step) you can check the logical correctness of your program.

Additional Online Functions Further debugging functions: You can set program variables and inputs and outputs at certain values.

CoDeSys V2.3

1-1

Overview of CoDeSys Functions...

You can use the flow control to check which program lines have been run.

A Log records operations, user actions and internal processes during an online session in a chronological order.

If activated in the target settings the Sampling Trace allows you to trace and display the actual course of variables over an extended period of time.

Also a target specific function is the PLC Browser which can serve to request certain information from the PLC.

Once the project has been set up and tested, it can be loaded down to the hardware and tested as well. The same online functions as you used with the simulation will be available.

Additional CoDeSys Features

The entire project can be documented or exported to a text file at any time.

For communication purposes CoDeSys has a symbolic interface and a DDE interface. A Gateway Server plus OPC Server and DDE Server are components of the CoDeSys-standard installation packet.

Using the appropriate target settings, which can be loaded with the aid of a target file (Target Support Package) allows to load the same CoDeSys project to various target systems.

Network global variables and a Parameter Manager might be available, if activated by the current target settings, for data exchange within a network of controllers.

ENI: The E' ngineering Interface' can be used to access any desired source code management program via the ENI Server, which is running as an independent process. CoDeSys POUs and compile files can be filed in that data base and are by that accessible also by other clients of the ENI Server. This allows multi user operation during the work on a CoDeSys project, it provides a common data pool for different tools besides CoDeSys and it makes possible a version management.

Tools: This functionality also is target dependent and allows to start target-specific executable files in a CoDeSys project. Besides that files can be defined, which should be loaded to the controller. Connections to external tools can be pre-defined in the target file or/and inserted in the project Resource tree.

A CoDeSys visualization can be processed target specifically to be available as Web-Visualization and/or Target-Visualization. This allows to run and view the visualization via Internet or on a PLCmonitor.

SoftMotion: Diese Funktionalit?t ist eine Art Basis-Werkzeugkasten zum Realisieren von Bewegungen ? von einfachen Einachs- ?ber Kurvenscheiben- bis hin zu komplexen Bewegungen in mehreren Dimensionen unter der Entwicklungsumgebung von CoDeSys. Die gesamte Programmlogik wird im SPS-Programm behandelt und nur die reine Bewegungsinformation in Bibliotheksbausteinen abgearbeitet. SoftMotion erfordert eine eigene Lizenz und muss vom Zielsystem unterst?tzt werden. (Siehe separate Anwenderdokumentation)

1-2

CoDeSys V2.3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download