Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
158
Добавлен:
11.10.2020
Размер:
2.81 Mб
Скачать

User Manual for

PLC Programming with

CoDeSys 2.3

Copyright 1994, 1997, 1999, 2001, 2002, 2003, 2004 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 24.06.2004

Document Version 3.1, CoDeSys V.2.3.3.3

Table Of Content

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

Project Components... .......................................................................................

2-1

2.2

Languages... ......................................................................................................

2-9

2.2.1

Instruction List (IL)... ..........................................................................................

2-9

2.2.2

Structured Text (ST)... .......................................................................................

2-11

2.2.3

Sequential Function Chart (SFC).......................................................................

2-16

2.2.4

Function Block Diagram (FBD)... .......................................................................

2-21

2.2.5

The Continuous Function Chart Editor (CFC)....................................................

2-22

2.2.6

Ladder Diagram (LD)... ......................................................................................

2-22

2.3

Debugging, Online Functions.............................................................................

2-24

2.4

The Standard... ..................................................................................................

2-26

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-11

4

The Individual Components

4-1

 

 

4.1

The Main Window... ...........................................................................................

4-1

 

4.2

Project Options... ...............................................................................................

4-3

 

4.3

Managing Projects... ..........................................................................................

4-17

 

4.4

Managing Objects in a Project...........................................................................

4-47

 

4.5

General Editing Functions..................................................................................

4-54

 

4.6

General Online Functions... ...............................................................................

4-59

 

4.7

Window set up... ................................................................................................

4-74

 

4.8

Help when you need it... ....................................................................................

4-75

5

Editors in CoDeSys

5-1

 

 

5.1

This is for all Editors...........................................................................................

5-1

 

5.2

Declaration Editor... ...........................................................................................

5-2

 

5.2.1

Working in the Declaration Editor ......................................................................

5-2

 

5.2.2

Declaration Editors in Online Mode ...................................................................

5-9

 

5.2.3

Pragma instructions in the Declaration Editor....................................................

5-10

 

5.3

The Text Editors.................................................................................................

5-16

 

5.3.1

Working in text editors .......................................................................................

5-16

 

5.3.2

The Instruction List Editor... ...............................................................................

5-20

 

5.3.3

The Editor for Structured Text............................................................................

5-21

 

5.4

The Graphic Editors...........................................................................................

5-21

 

5.4.1

Working in graphic editors .................................................................................

5-21

 

5.4.2

The Function Block Diagram Editor... ................................................................

5-23

 

5.4.3

The Ladder Editor... ...........................................................................................

5-28

CoDeSys V2.3

i

Table Of Content

5.4.4

The Sequential Function Chart Editor... .............................................................

5-33

5.4.5

The Continuous Function Chart Editor (CFC)... .................................................

5-41

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

6.2.3

Document Frame... ............................................................................................

6-8

6.3

Alarm Configuration ...........................................................................................

6-9

6.3.1

Overview ............................................................................................................

6-9

6.3.2

General information on alarms, Terms...............................................................

6-10

6.3.3

Alarm classes.....................................................................................................

6-10

6.3.4

Alarm groups......................................................................................................

6-14

6.3.5

Alarm saving ......................................................................................................

6-15

6.3.6

'Extras' Menu: Settings.......................................................................................

6-16

6.4

Library Manager... ..............................................................................................

6-16

6.5

Log... ..................................................................................................................

6-18

6.6

PLC Configuration..............................................................................................

6-20

6.6.1

Overview ............................................................................................................

6-20

6.6.2

Working in the PLC Configuration......................................................................

6-21

6.6.3

General Settings in the PLC Configuration ........................................................

6-22

6.6.4

Custom specific parameter dialog......................................................................

6-24

6.6.5

Configuration of an I/O Module... .......................................................................

6-25

6.6.6

Configuration of a Channel ................................................................................

6-27

6.6.7

Configuration of Profibus Modules... ..................................................................

6-28

6.6.8

Configuration of CAN modules...........................................................................

6-36

6.6.9

Configuration of a CanDevice (CANopen Slave) ...............................................

6-41

6.6.10

PLC Configuration in Online Mode.....................................................................

6-44

6.6.11

Hardware scan/State/Diagnosis information from the PLC................................

6-44

6.7

Task Configuration... ..........................................................................................

6-45

6.7.1

Working in the Task Configuration .....................................................................

6-45

6.7.2

System Events ...................................................................................................

6-48

6.7.3

Taskconfiguration in Online Mode......................................................................

6-49

6.8

Watch and Receipt Manager..............................................................................

6-51

6.8.1

Overview ............................................................................................................

6-51

6.8.2

Watch and Receipt Manager in the Offline Mode ..............................................

6-51

6.8.3

Watch and Receipt Manager in the Online Mode ..............................................

6-52

6.9

The Sampling Trace...........................................................................................

6-54

6.9.1

Overview and Configuration...............................................................................

6-54

6.9.2

Display of the Sampling Trace ...........................................................................

6-55

6.9.3

'Extras' 'Save Trace'...........................................................................................

6-57

6.9.4

'Extras' 'External Trace Configurations'..............................................................

6-57

6.10

Workspace .........................................................................................................

6-58

6.11

Parameter Manager .. ........................................................................................

6-58

6.11.1

Overview, Activating...........................................................................................

6-60

6.11.2

The Parameter Manager Editor, Overview.........................................................

6-60

6.11.3

Parameter List Types and Attributes..................................................................

6-61

6.11.4

Managing parameter lists...................................................................................

6-63

6.11.5

Editing parameter lists........................................................................................

6-64

6.11.6

Parameter Manager in Online Mode ..................................................................

6-65

6.11.7

Export / Import of parameter lists .......................................................................

6-66

6.12

Target Settings...................................................................................................

6-67

6.13

The PLC-Browser...............................................................................................

6-68

ii

CoDeSys V2.3

Table Of Content

 

6.13.1

General remarks concerning PLC-Browser operation .......................................

6-68

 

6.13.2

Command entry in the PLC-Browser .................................................................

6-68

 

6.13.3

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

6-70

 

6.13.4

Further PLC-Browser options ............................................................................

6-70

 

6.14

Tools ..................................................................................................................

6-71

 

6.14.1

Properties of available Tool Shortcuts (Object Properties) ................................

6-71

 

6.14.2

Managing Tool Shortcuts ...................................................................................

6-74

 

6.14.3

Frequently asked questions on Tools ................................................................

6-75

7

ENI

 

 

7-1

 

 

 

7.1

What is ENI........................................................................................................

7-1

 

 

7.2

Preconditions for Working with an ENI project data base..................................

7-1

 

 

7.3

Working with the ENI project data base in CoDeSys.........................................

7-2

 

 

7.4

Object categories concerning the project data base..........................................

7-2

 

8

DDE Interface

8-1

 

 

 

8.1

DDE interface of the CoDeSys programming system........................................

8-1

 

 

8.2

DDE communcation with the GatewayDDE Server... ........................................

8-2

 

9 The License Management in CoDeSys

9-1

 

 

 

 

 

 

 

 

 

 

9.1

The License Manager ........................................................................................

9-1

 

 

9.1.1

Creating a licensed library in CoDeSys .............................................................

9-1

 

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-8

 

10.5

Comparison Operators.......................................................................................

10-10

 

10.6

Address Operators.............................................................................................

10-13

 

10.7

Calling Operators...............................................................................................

10-14

 

10.8

Type Conversions..............................................................................................

10-14

 

10.9

Numeric Operators.............................................................................................

10-19

Appendix B:

 

Operands in CoDeSys

10-25

 

10.10

Constants...........................................................................................................

10-25

 

10.11

Variables............................................................................................................

10-27

 

10.12

Addresses..........................................................................................................

10-29

 

10.13

Functions ...........................................................................................................

10-30

Appendix C:

 

Data types in CoDeSys

10-31

 

10.14

Standard data types...........................................................................................

10-31

 

10.15

Defined data types .............................................................................................

10-33

Appendix D:

 

The CoDeSys Libaries

10-39

 

10.16

The Standard.lib library......................................................................................

10-39

 

10.16.1

String functions... ...............................................................................................

10-39

 

10.16.2

Bistable Function Blocks....................................................................................

10-42

 

10.16.3

Trigger................................................................................................................

10-44

 

10.16.4

Counter... ...........................................................................................................

10-45

CoDeSys V2.3

iii

Table Of Content

10.16.5

Timer... ...............................................................................................................

10-47

10.17

The Util.lib library ...............................................................................................

10-50

10.17.1

BCD Conversion ................................................................................................

10-50

10.17.2

Bit-/Byte Functions .............................................................................................

10-50

10.17.3

Mathematic Auxiliary Functions .........................................................................

10-51

10.17.4

Controllers..........................................................................................................

10-53

10.17.5

Signal Generators... ...........................................................................................

10-54

10.17.6

Function Manipulators........................................................................................

10-56

10.17.7

Analog Value Processing... ................................................................................

10-57

10.18

The AnalyzationNew.lib library...........................................................................

10-58

10.19

The CoDeSys System Libraries .........................................................................

10-59

Appendix E:

 

Operators and Library Modules Overview

10-61

 

10.20

Operators in CoDeSys: ......................................................................................

10-61

10.21

Elements of the Standard.lib: .............................................................................

10-64

10.22

Elements of the Util.lib: ......................................................................................

10-64

Appendix F:

 

Command Line-/Command File

10-67

 

10.23

Command Line Commands ...............................................................................

10-67

10.24

Command File (cmdfile) Commands..................................................................

10-67

Appendix G:

 

Siemens Import

10-75

 

10.25

Import from a SEQ Symbol File .........................................................................

10-75

10.26

Import from a S5 Project File .............................................................................

10-76

10.27

Converting S5 to IEC 61131-3 ...........................................................................

10-76

Appendix H:

 

Target Settings in Detail

10-81

 

10.28

Settings in Category Target Platform .................................................................

10-81

10.28.1

Target system Intel 386 compatible, Category Target Platform.........................

10-81

 

10.28.2

Target system Motorola 68K, Category Target Platform....................................

10-82

10.28.3

Target system Infineon C16x, Category Target Platform...................................

10-83

10.28.4

Target systems Intel StrongARM und Power PC, Category Target Platform.....

10-84

 

10.28.5

Target system MIPS, Category Target Platform ................................................

10-85

10.28.6

Target system 'Hitachi SH', Category Target Platform.......................................

10-86

10.28.7

Target system '8051 compatible', Category Target Platform .............................

10-87

 

10.28.8

Target system Infineon C16x, Category Target Platform...................................

10-87

10.29

Target Settings for Category Memory Layout ....................................................

10-89

 

10.30

Target Settings in Category General..................................................................

10-90

10.31

Target Settings in Category Networkfunctionality ..............................................

10-92

10.32

Target Settings in Category Visualization ..........................................................

10-93

Appendix I: Use of Keyboard

10-95

 

Appendix J:

 

Compiler Errors and Warnings

10-99

 

10.33

Warnings ............................................................................................................

10-99

10.34

Errors .................................................................................................................

10-103

11 Index

 

 

I

 

 

 

 

 

 

 

iv

CoDeSys V2.3

1 - A Brief Introduction to CoDeSys

1 A Brief Introduction to CoDeSys

1.1What is CoDeSys

CoDeSys is a complete development environment for your PLC. (CoDeSys stands for Controlled Development 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.2Overview 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 the Task Configuration chapter.

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 'Engineering 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.

1-2

CoDeSys V2.3

1 - A Brief Introduction to CoDeSys

1.3Overview on the user documentation for CoDeSys

Module

Docu Contents

 

 

Name of File

 

 

 

CoDeSys Programming

On hand manual and online help via help

CoDeSys_V23_E.pdf

System

menu in the programming system

 

First Steps with CoDeSys V23.pdf

 

First steps with the CoDeSys Programming

 

 

 

system (sample)

 

 

 

 

 

 

Gateway Server

Concept, installation and User Interface;

Gateway Manual.pdf

 

Online Help for the User Interface via

 

 

Gateway menu (can be opened by a mouse-

 

 

click on the gateway symbol in the system

 

 

tray)

 

 

 

 

 

 

OPC Server

OPC-Server V2.0, Installation and Use

OPC_20_How_to_use_E.pdf

 

 

 

CoDeSys Visualization

Manual for the CoDeSys Visualization incl.

CoDeSys_Visu_E.pdf

 

CoDeSys HMI, Targetand Web-Visualization

 

 

 

 

SoftMotion

How to use, description of the main

SoftMotion_Manual_V23_E.pdf

 

SoftMotion library modules

 

 

 

 

 

Bibliotheken

Standard.lib and Util.lib are described in the

<SysLib-Name>.pdf

 

on hand manual.

 

 

CoDeSys_V23_E.pdf

 

For each of the CoDeSys System Libraries

 

 

 

there is a document <library name>.pdf

 

 

SoftMotion libraries:

see

SoftMotion-

 

 

documentation.

 

 

 

 

 

 

ENI Server

Installation and configuration of the ENI

EniServerQuickstart_E.pdf

 

Servers concerning the

source

control of a

CoDeSys_V23_E.pdf

 

CoDeSys project in an external data base.

 

 

 

Configuration of ENI in CoDeSys: see the on

 

 

hand manual.

 

 

 

 

ENI Admin, ENI Control and ENI Explorer:

 

 

see the referring online help.

 

 

 

 

 

 

 

CoDeSys V2.3

1-3

Overview on the user documentation for CoDeSys

1-4

CoDeSys V2.3

Соседние файлы в папке 759-333