Sie sind auf Seite 1von 434

infoteam OpenPCS Programming System

Version 4.1 English

User Manual
1. Edition

1 OpenPCS 4.1 - Overview

Contents
1 2 3 4 5 6 7 8 9 10 11 12 13 OpenPCS 4.1 - Overview Introduction The Project Manager The POU-Editor ControlX Editor Ladder Diagram Editor The SFC-Editor The CFC-Editor Introduction into IEC1131 Forms Editor FXF Import/Export IEC1131-3 Compliance Statement Index 3 15 44 82 160 197 246 263 290 391 393 399 421

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

1 OpenPCS 4.1 - Overview


You are holding in your hands the user manual to the software OpenPCS, version 4.1. This first chapter will give you an overview over the structure and contents of this manual. This manual consists of individual chapters: Overview This chapter, describing contents and structure of the manual Introduction A short introduction into the most important tools of OpenPCS, using a short sample. The Project Browser Manual for the tool Project Browser. POU-Editor Manual for the tool POU-Editor for programming languages IL, LD, FBD and ST. SFC-Editor Manual for the tool SFC-Editor for the programming language Sequential Function Chart. OpenCFC Manual for the tool OpenCFC for the programming language Continuous Function Chart. Introduction to IEC1131-3 If you never worked with IEC1131 before, consult this chapter. Forms Editor Manual for the tool forms editor. FXF Import/Export Manual for the FXF import- and export-utility. Compliance Statement IEC1131-3 compliance statement.

1.1 More information


You cant find what youre looking for in this manual? There are other sources you can use: OpenPCS provides a help function. In each tool, there is a menu item help. It is easier to search for items in the electronic help than in this printed manual There are several books on the market, dealing with IEC1131. We recommend the german book. "SPS-Programmierung mit IEC 1131-3" from Springer Verlag, ISBN 3-540-62639-5. Training on IEC1131 is available from different sources. To get training covering the special features of your hardware, consult the vendor of your hardware. The provider of OpenPCS, infoteam Software GmbH, does offer in-house training seminars on IEC1131 and OpenPCS. 3

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

If you want to keep track of current developments in IEC1131, think about a membership with PLCopen: http://www.plcopen.org/. Assistance with individual problems related to the use of OpenPCS is offered by the manufacturer of OpenPCS, infoteam Software GmbH, solely after advance agreement This is the user manual. For manufacturers of programmable controllers, more documentation covering internal details, interfaces etc. is available. This additional documentation is not made available to end-users.

1.2 Comprehensive Table of Contents


1 OpenPCS 4.1 - Overview 1.1 1.2 2 More information Comprehensive Table of Contents 3 3 4 15 15 15 15 16 17 18 19 19 21 22 23 24 25 25 26 26 26 28 29 30 31 31 33 33 33 33 35 35 37 37
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

Introduction 2.1 2.2 2.3 2.4 2.5 2.6 Styles and Symbols Installation Hardware and Software Requirements Programming Example Starting OpenPCS Create a new project

2.7 Creating a Program 2.7.1 The Program Organisation Unit (POU) 2.7.2 The POU-Editor 2.7.3 Syntax controlled declaration editor 2.7.4 Declaring in syntax controlled mode 2.7.5 Entering the Program in IL 2.7.6 Syntax check 2.7.7 Error correction 2.7.8 Print a Program 2.8 Defining the Resource 2.8.1 Overview 2.8.2 Adding a resource 2.8.3 Defining a Task 2.8.4 Create the executable program 2.9 Test and Commissioning 2.9.1 Overview, SmartSIM 2.9.2 Starting and Stopping the Program 2.9.3 Testing the program 2.9.4 Variable Status 2.9.4.1 Watching variables 2.9.4.2 Setting a Variable 2.9.5 Program Status 2.10 Other Features of OpenPCS 2.10.1 Other programming languages 4

1 OpenPCS 4.1 - Overview

2.10.1.1 LD Ladder Diagram 2.10.1.2 FBD Function Block Diagram 2.10.1.3 Structured Text ST 2.10.1.4 CFC 2.10.2 Block Types 2.10.2.1 FUNCTION 2.10.2.2 FUNCTION_BLOCK 2.10.2.3 PROGRAM 2.10.3 Free Declaration Editor 2.10.4 Additional Features of the project browser 2.10.4.2 Libraries 2.10.5 Conclusion 3 The Project Manager 3.1 3.2 Introduction Start of the project browser

37 38 38 39 39 39 39 41 41 42 42 42 44 44 45 46 46 46 48 48 49 50 50 51 51 51 52 53 53 54 54 55 55 56 56 56 57 58 58 60 60 62 62 62 62 63 65 65 65 65 5

3.3 Managing projects 3.3.1 Create a new project 3.3.2 Open an existing project 3.3.3 Copying a project 3.3.4 Create a backup copy 3.3.5 Restore a project 3.3.6 Deleting projects 3.3.7 Rename project 3.4 The project tree 3.4.1 Libraries 3.4.2 The project directory 3.5 3.6 Creation of POU- and CFC-Modules Editing of POU- and CFC-Modules

3.7 Global resource variables 3.7.1 Creation of [direct] global variables 3.7.2 Editing of [direct] global variables 3.8 Type definitions 3.8.1 Creation of new type definitions 3.8.2 Editing of type definitions 3.9 Resources 3.9.1 Creation of a resource 3.9.2 Edit a resource 3.9.3 Adding a task 3.9.4 Adding of [direct] global variables 3.9.5 Adding type definitions 3.9.6 Generate executable code 3.10 The Connection Setup tool 3.10.1 About Connection Setup 3.10.2 Components of a connection 3.10.3 Run Connection Setup 3.10.4 Create a new connection 3.10.5 Edit connection properties 3.10.6 Delete a connection 3.10.7 Finish Connection Setup 3.10.8 Select a connection in the browser
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

3.11 Libraries 3.11.1 Create a library 3.11.2 Installing a library 3.11.3 Adding a library to a project 3.11.4 De-Install a library 3.12 Registration of foreign files

66 66 68 69 69 70 71 71 71 73 73 73 74 75 75 76 77 78 78 80 82 82 83 83 83 84 84 87 88 89 89 89 92 93 93 95 96 96 97 97 98 99 100 100 102 103 103 104 105 105

3.13 Test and commissioning 3.13.1 Start of the SmartSIM32 3.13.2 Go online 3.13.3 Download of a resource 3.13.4 Up load of a resource 3.13.5 The Test and commissioning 3.13.6 Watching variables 3.13.7 Set variables 3.13.8 The online-editor 3.13.9 Hardware info 3.13.10 Resource info 3.14 Configuration of the project manager 3.14.1 Settings 3.14.2 Printer set up 4 The POU-Editor 4.1 Overview 4.1.1 Program overview 4.1.2 Function blocks overview 4.1.3 Functions overview 4.2 Declaration part 4.2.1 Sections of variables 4.2.2 Elements of a declaration of variables 4.2.3 Variable-editor 4.2.4 Variable-editor: Syntax-mode 4.2.4.1 Selection of the variable-section 4.2.4.2 Entry of lines 4.2.5 Variable-editor: Free mode 4.2.5.1 Variable-sections 4.2.5.2 Declaration lines 4.3 Instruction part

4.4 The instruction part in IL 4.4.1 The structure of an IL-line 4.4.2 Input helps 4.4.2.1 Insert of variables and instance-calls 4.4.2.2 Insert operators 4.4.2.3 Insert functions 4.5 The instruction part of the programming in LD 4.5.1 Overview 4.5.2 Create the POU in LD 4.5.2.1 Display and Accept operators 4.5.2.2 Create new network 4.5.2.3 Insert function blocks 4.5.2.4 Insert function 4.5.2.5 Edit a POU in LD 6

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

4.5.2.6 4.5.2.7 4.5.2.8 4.5.2.9 4.5.2.10 4.5.2.11 4.5.2.12 4.5.2.13 4.5.2.14 4.5.2.15 4.5.2.16 4.5.2.17 4.5.2.18

Mark a network as branch label Edit logical operation Insert of an AND-operation Insert of an OR-operation Insert of a conditional termination Modify an expression Negate a contact or an output Delete elements Name elements Name a label Enter a network-comment Create function blocks in LD Create functions in LD

106 107 107 107 108 109 110 111 111 112 113 113 113 114 114 115 115 115 116 118 119 119 121 122 122 122 123 123 123 124 124 126 128 129 130 132 134 135 136 138 139 140 140 140 141 141 142 143 143 144 144 145 145 145 146 7

4.6 The instruction part on programming in FBD 4.6.1 Overview 4.6.1.1 Network label 4.6.1.2 Network comment 4.6.1.3 Network graphic 4.6.2 Create a POU in FBD 4.6.2.1 Operators 4.6.2.2 Create new network 4.6.2.3 Insert a function block 4.6.2.4 Insert function 4.6.2.5 Delete function block or function 4.6.2.6 Edit a POU in FBD 4.6.2.7 Mark POU-elements 4.6.2.8 Insert a network 4.6.2.9 Delete network 4.6.2.10 Mark a network as a branch label 4.6.2.11 Edit a network 4.6.2.12 Insert a circuit symbol 4.6.2.13 Delete circuit symbol 4.6.2.14 Insert input 4.6.2.15 Delete input 4.6.2.16 Insert output 4.6.2.17 Delete output 4.6.2.18 Negate input 4.6.2.19 Negate output 4.6.2.20 Name element 4.6.2.21 Enter a label for a jump instruction 4.6.2.22 Enter network-comment 4.7 The instruction part in ST 4.7.1 Create ST-POU 4.7.2 Instructions in ST 4.7.3 Assignments 4.7.4 Conditional instructions 4.7.4.1 IF-instruction 4.7.4.2 CASE-instruction 4.7.5 Repetitions 4.7.5.1 WHILE-loop 4.7.5.2 FOR-loop 4.7.5.3 REPEAT-loop 4.7.5.4 EXIT 4.7.6 Cyclic Execution and Structured Text 4.7.7 Calling function block instances
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

4.7.8 RETURN 4.7.9 Expressions and operators 4.7.10 Function call as operator 4.7.11 Comments 4.7.12 Input helps 4.7.12.1 Calling function block instances 4.7.12.2 Calling functions 4.8 Switching Programming Languages 4.8.1 Conditional function block call 4.8.2 Intermediate Stores 4.8.3 Line comments 4.9 4.10 4.11 4.12 4.13 4.14 Editor for global types Syntax check and error correction Create cross-reference list Edit POU Save POU Change POU-Type

146 147 147 148 148 148 148 150 150 152 153 154 155 156 157 157 157 158 158 160 160 160 160 160 160 161 161 162 162 163 165 165 166 166 167 167 167 167 167 168 168 168 168 169 169 169 172 176

4.15 Printing 4.15.1 Print a POU 5 ControlX Editor 5.1 Survey 5.1.1 The standard IEC-61131-3 5.1.2 General Information 5.1.3 Components 5.1.3.1 Output Window 5.1.3.2 Variable Editor 5.1.3.3 Instruction Editor 5.2 Output Window 5.2.1 Presentation 5.2.2 Function of the Output Window 5.3 Variable Editor 5.3.1 Introduction 5.3.2 Available variable types 5.3.3 Declarations 5.4 Menus 5.4.1 Basic Commands 5.4.1.1 Restore 5.4.1.2 Move 5.4.1.3 Change Size 5.4.1.4 Minimize (Basic Commands) 5.4.1.5 Maximize (Basic Commands) 5.4.1.6 Close (Basic Commands) 5.4.1.7 Next (Basic Commands) 5.4.2 Menus in the SFC Editor 5.4.2.1 Survey of menus (SFC Editor) 5.4.2.2 Commands "File" Menu 5.4.2.3 Commands "Edit" Menu 5.4.2.4 Commands "Insert" Menu 8

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

5.4.2.5 Commands "View" Menu 5.4.2.6 Commands "Online" Menu 5.4.2.7 Commands "Window" Menu 5.4.2.8 Commands "Help" Menu 5.4.3 Menus in the Ladder Editor 5.4.3.1 Survey of Menus (Ladder-Editor) 5.4.3.2 Commands "File" Menu 5.4.3.3 Commands "Edit" Menu 5.4.3.4 Commands "Insert" Menu 5.4.3.5 Commands " View" Menu 5.4.3.6 Commands "Options" Menu 5.4.3.7 Commands "Online" Menu 5.4.3.8 Window (Ladder) 5.4.3.9 Help (Ladder) 6 Ladder Diagram Editor 6.1 Introduction 6.1.1 General information on Ladder Logic 6.1.2 General Information on Ladder Diagram Editor 6.1.3 Informations on handling 6.1.3.1 Menu 6.1.3.2 Toolbar 6.2 Quickstart 6.2.1 Create Ladder Diagramm 6.2.2 Create Ladder Logic 6.2.3 Save 6.2.4 Syntax Check 6.2.5 Online 6.3 Working on Ladder Diagrams 6.3.1 Ladder Diagram 6.3.2 Comments 6.3.3 Network 6.3.4 Instructions 6.3.4.1 Operators 6.3.4.2 Functions and Function Blocks 6.3.4.3 Logical Connections 6.4 Ladder Logic 6.4.1 Operators 6.4.1.1 Contacts 6.4.1.2 Coils 6.4.1.3 Control Relays 6.4.2 Blocks 6.4.2.1 Function Blocks 6.4.2.2 Functions 6.4.3 Combinations 6.4.3.1 AND 6.4.3.2 OR 6.4.3.3 Mixed combinations 6.5 Online 6.5.1 General Information on the Online Editor 6.5.2 Using the Online Editor 7 The SFC-Editor

178 182 183 184 185 185 185 189 192 195 195 195 196 196 197 197 197 197 197 197 198 198 198 198 199 200 200 201 201 202 202 203 203 204 204 205 205 205 205 206 207 207 218 241 241 242 243 244 244 244 246 9

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

7.1 7.2

Elements of Sequential Function Chart A program example

246 248 249 249 250 250 251 251 251 251 251 251 251 252 252 252 252 253 253 253 253 254 254 255 255 256 256 256 256 260 260 263 263 263 266 266 267 268 269 272 272 277 278 279 279 279 280 281 282 283 283

7.3 Use of the SFC-Editor 7.3.1 Start of the editor from the browser 7.3.2 SFC-Editor User Interface 7.3.3 Creation of a new document 7.3.4 Opening a chart 7.3.5 Saving 7.3.6 Printing 7.3.7 Form 7.3.8 Page view 7.3.9 Setting of marks 7.3.9.1 Single marks 7.3.9.2 Region marks 7.3.10 Editing of the graph-layout 7.3.10.1 Cut to the clipboard 7.3.10.2 Copy into the clipboard 7.3.10.3 Insert of elements from the clipboard 7.3.10.4 Deleting of the marked region 7.3.10.5 Divergence of sequence selection branches shift left/right 7.3.10.6 Replacing of the mark by a steptransitionpair 7.3.10.7 Insert a jump 7.3.11 Declaration of variables 7.3.12 Exception handling 7.3.13 Editing of the program blocks 7.3.13.1 Transitions 7.3.13.2 Steps and initial steps 7.3.13.3 Jumps 7.3.14 Syntax control 7.3.15 The SFC-editor in online-mode 7.4 8 The buttons of the toolbar

The CFC-Editor 8.1 Styles and Symbols

8.2 Structure of the OpenCFC-Editor 8.2.1 Creating a Program 8.2.1.1 Creating a new CFC program 8.2.1.2 Show/Hide Grid 8.2.1.3 Adding Blocks to a Function Chart 8.2.1.4 Connecting Blocks in a Function Chart 8.2.1.5 The Connection Tool 8.2.1.6 The Margin Bar 8.2.1.7 Assigning a Constant to an Input Connector 8.2.1.8 Zooming in and out 8.2.2 Editing a Program 8.2.2.1 Opening a program 8.2.2.2 Moving a block to an empty block field 8.2.2.3 Dragging a block to an empty field 8.2.2.4 Shifting a Group of blocks 8.2.2.5 Copying or Shifting Blocks Using the Clipboard 8.2.2.6 Deleting a Block 8.2.2.7 Changing Connections

10

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

8.2.2.8 Saving a program 8.2.2.9 Documenting a Program 8.2.2.10 Using the help function 8.3 Advanced Topics 8.3.1 Online Debugging Programs 8.3.2 Execution Sequence 8.3.3 Modifying a block interface 8.3.4 Using forms for printing 8.3.5 Compound Blocks 8.3.5.1 Compound Blocks: Introduction 8.3.5.2 Insert a new empty Compound Block 8.3.5.3 Converting Blocks to a Compound Block 8.3.5.4 Adding an input or output to a Compound Block 9 Introduction into IEC1131 9.1 Program Structure

285 285 285 285 285 286 286 288 288 288 289 289 289 290 290 291 291 295 298 298 298 301 302 304 307 309 311 312 313 314 314 315 316 317 319 319 319 320 324 328 377 388 390 391 391 391 392 11

9.2 Declarations 9.2.1 Datatypes 9.2.2 Variables 9.2.3 Instantiating Function blocks 9.3 Instruction part of a POU 9.3.1 Instructions 9.3.1.1 Load Instructions 9.3.1.2 Assignments 9.3.1.3 Logical Operations 9.3.1.4 Arithmetic Operations 9.3.1.5 Comparisons 9.3.1.6 Conditional and unconditional Jump 9.3.1.7 Conditional and unconditional Return 9.3.1.8 Function block invocation 9.3.1.9 Calling Functions 9.3.2 Constants 9.3.3 Program 9.3.4 Functions 9.3.5 Function blocks 9.4 Other Programming Languages 9.4.1 Other Programming Languages 9.4.2 LD and FBD: Introduction 9.4.3 Programming in Ladder Diagram 9.4.4 Programming in Function Block Diagram 9.5 9.6 9.7 9.8 10 10.1 10.2 10.3 Functions (IEC1131) Function blocks (IEC1131) Functions (OpenPCS) Language Extensions Forms Editor Overview Design a form Using fixed text in a form

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

10.4 10.5 11 11.1 11.2 12

Form preview Editing elements FXF Import/Export Export to FXF Import from FXF IEC1131-3 Compliance Statement

392 392 393 393 397 399 400 400 400 400 400 401 401 401 402 402 403 403 403

12.1 Common Elements 12.1.1 Table 1: Character set features 12.1.2 Table 2: Identifier features 12.1.3 Table 3: Comment features 12.1.4 Table 4: Numeric Literals 12.1.5 Table 5: Character string literal features 12.1.6 Table 6: Two character combinations in character strings 12.1.7 Table 7: Duration literal features 12.1.8 Table 8: Date and time of day literals 12.1.9 Table 10: Elementary data types 12.1.10 Table 12: Data type declaration feature 12.1.11 Table 13: Default initial values 12.1.12 Table 14: Data type initial value declaration features 12.1.13 Table 15: Location and size prefix features for directly represented variables 404 12.1.14 Table 16: Variable keywords for variable declaration 12.1.15 Table 17: Variable type assignment features 12.1.16 Table 18: Variable initial value assignment features 12.1.17 Table 19: Graphical negation of Boolean signals 12.1.18 Table 20: Use of EN input and ENO output 12.1.19 Table 21: Typed and overloaded functions 12.1.20 Table 22: Type conversion function features 12.1.21 Table 23: Standard functions of one numeric variable 12.1.22 Table 24: Arithmetic standard functions 12.1.23 Table 25: Standard bit shift functions 12.1.24 Table 26: Standard bitwise Boolean functions 12.1.25 Table 27: Standard selection functions 12.1.26 Table 28: Standard comparison functions 12.1.27 Table 29: Standard character string functions 12.1.28 Table 30: Functions of time data types 12.1.29 Table 31: Functions of enumerated data types 12.1.30 Table 33: Function block declaration features 12.1.31 Table 34: Standard bistable function blocks 12.1.32 Table 35: Standard edge detection function blocks 12.1.33 Table 36: Standard counter function blocks 12.1.34 Table 37: Standard timer function blocks 12.1.35 Table 39: Program declaration features 12.1.36 Table 40: Step features 12.1.37 Table 41: Transitions and Transition conditions 12.1.38 Table 42: Declaration of actions 12.1.39 Table 43: Step/action association 12.1.40 Table 44: Action block features 12.1.41 Table 45: Action qualifiers 12.1.42 Table 46: Sequence evolution

404 404 405 405 405 405 405 406 406 406 406 407 407 407 408 408 409 409 409 409 410 410 411 411 411 412 412 412 412

12

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

1 OpenPCS 4.1 - Overview

12.2 IL Language Elements 12.2.1 Table 52: Instruction list (IL) operators 12.2.2 Table 53: Function block invocation feature for IL language 12.3 ST Language Elements 12.3.1 Table 55: Operators of the ST language 12.3.2 Table 56: ST language statements 12.4 Common graphical Elements 12.4.1 Table 57: Representation of lines and block 12.4.2 Table 58: Graphic execution control elements 12.5 LD language Elements 12.5.1 Table 59: Power rails 12.5.2 Table 60: Link Elements 12.5.3 Table 61: Contacts 12.5.4 Table 62: Coils 12.6 FBD language elements

413 413 414 414 414 414 415 415 416 416 416 416 416 417 417 417 417 419 419 421 421 426

12.7 Annex D Implementation-dependent parameters 12.7.1 Table D.1: Implementation-dependent parameters 12.8 Appendix E (normative): Error conditions 12.8.1 Table E.1: Error conditions 13 13.1 13.2 Index Table of figures Keywords

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

13

1 OpenPCS 4.1 - Overview

14

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

2 Introduction
This manual will give you an introductory overview over OpenPCS. With a simple example, you will learn how to create own projects, own programs, down to the very test with your controller or SmartPLC. A basic knowledge of Microsoft Windows and PLC programming is assumed.

2.1 Styles and Symbols


The notation Project New is used to denote the selection of item New in menu Project. The arrow is used to mark individual steps you should follow. OpenPCS is a portable, configurable programming system. You should be aware that not all functions, data types, instructions and features described here are available with all controllers. If you are in doubt, ask the vendor of the PLC that you are using OpenPCS with.

2.2 Installation
OpenPCS is delivered on CD-Rom. Start the installation as you are used to with most Windows programs by launching SETUP.EXE. If the CD contains more than one language version of OpenPCS, select the proper language version by launching the SETUP.EXE from its subdirectory, e.g. ENGLISH\SETUP.EXE. When installing OpenPCS, you will be asked to enter your licence information. If you bought OpenPCS, you will have a licence information sheet giving you the requested information. If you do not have a licence, just keep the default information provided (i.e. serial number DEMO and licence code DEMO). This will give you 30 days to evaluate OpenPCS, after which OpenPCS will cease to work.

2.3 Hardware and Software Requirements


As a programming system, you will need an IBM compatible PC with 1) At least an 80486 microprocessor (we recommend at least a Pentium 166) and a CD-ROM-drive 2) A hard disk drive with at least 25 Mbytes of free space 3) At least 8 Mbytes of RAM (we recommend 32MB), and 4) A VGA graphics card 5) As with any Windows application, a mouse will be helpful Besides OpenPCS, you will need an operating system as: 6) Windows 95/98 or 7) Windows NT 4.0

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

15

2 Introduction

To support your specific PLC, more requirements may hold (e.g. more memory), and you may need additional hard- or software (e.g. interface cards, cables). If in doubt, consult the vendor of your PLC.

2.4 Programming Example


To introduce you to OpenPCS, we will use a simple example. This chapter will describe the problem and the solution. The rest of this manual will then implement the solution with OpenPCS. Problem: A robot arm shall be moved into position A when button START is being pressed. Another button HALT shall interrupt that movement anytime. Solution The solution might look like:
PROGRAM position VAR initial AT %I0.0 : BOOL; (*initial state *) key_start AT %I0.1 : BOOL; (*key start*) key_halt AT %I0.2 : BOOL; position_A AT %I0.3 : BOOL; (*Position A reached*) motor AT %Q0.0 : BOOL; END_VAR initial LD AND key_start S motor (*switch motor on *) LD key_halt OR position_A R motor (*switch motor off*) END_PROGRAM

The program starts with the keyword PROGRAM, and ends with the other keyword END_PROGRAM. When working with OpenPCS, you will not type in these keywords, but rather the editor will create them automatically for you. OpenPCS will prompt you for the name of the program when you create a new program In contrast to traditional PLC programming languages, IEC1131 requires that you declare all variables that you use. This line declares a variable of name initial of data type BOOL, to be mapped to hardware address %I0.0, i.e. this variable shall denote the lowest bit of the first input byte. Almost everywhere in IEC1131 you can use comments to describe your programs. The instruction part of the program starts with a load-instruction. As you will notice, most instructions (all in this simple program) will consist of a one-word instruction followed by an operand. In this sample program, we have instructions LD (load current result with operand), OR (orconnect operand to current result), AND (and-connect operand to current result), S (set operand to 1 if current result is 1), and R (set operand to 0 when current result is TRUE). Please note: which hardware addresses are valid is strongly dependent on the PLC you are using.

16

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

2.5 Starting OpenPCS


Start Windows and choose start programs OpenPCS OpenPCS in the start-menu; the window project browser will be opened: In general, one project was pre-selected, otherwise you see an empty window:

fig. 1:Project management (demo-project pre-selected)

(See chapter 3 for a more detailed description of the browser). With OpenPCS, you will structure your work in projects. It is very easy to reuse software within one project, and this is one of the great advantage of OpenPCS. Be sure to structure your work in a way to take best advantage of this feature: - avoid to use more than one project for related work. One machine, one network of CANopen nodes, or even one plant might be one project - Use separate projects for unrelated work; this increases your overview and prevents you from mistakenly modifying wrong code. The Project Browser is the File Manager of OpenPCS. When you create files within an OpenPCS project, internal information is kept on these files. You cannot replace the Project Browser with a standard Windows File Manager (like the Windows Explorer).

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

17

2 Introduction

2.6 Create a new project


Create a new project by selecting Project New. A dialogbox will be shown to prompt you for the name and directory path of this new project:

fig. 2:Dialogbox New Project

You may use a path on a non-local, networked drive, but you cannot use this to work with more than one copy of OpenPCS at once with the same project! The length of a project path is limited, try to use as few characters for the directory name as possible. You will see an error message if the name is too long. Select directory C:\OpenPCS and enter bsp as the project name: bsp

Close the dialogbox with OK. The path c:\OpenPCS\bsp will be created and the minimum project structure will be shown:

18

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

fig. 3: Minimum Project Structure

With a new, empty project, only the three default entries Forms, Libraries and the project (in this case Bsp) will exist. In the project, you will find the branches Configuration and Project Files, a file Usertype.typ already existing under Project Files. During the course of this manual we will create more entries to be shown in this tree.

2.7 Creating a Program


2.7.1 The Program Organisation Unit (POU)
At first, create a new POU Select the action File New .

Choose the program organisation unit which you want to create. The keywords POU function or POU function block are selected for program parts which are used more often. For our example, you need an executable program. Therefore, the type POU program must be selected. The following dialog box is opened:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

19

2 Introduction

fig. 4: Creating a new POU

In the right part of the window you can select the path under which the POU should be saved. This one must always be located under the project folder. In our case, the right path, c:\openpcs\bsp, is already selected. Pre-selected is always this project which has been opened or created last. Use position as file name ( the file extension POU can be omitted ) and confirm the selection by the OK"-button. The POU Position.poe will be added to the project structure under Project Files. Note the plus- or minus sign ahead of the word project files. Press this one with the mouse to see the effect.

20

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

fig. 5: Project structure after insert of a POU

2.7.2 The POU-Editor


The POU position does not have source code yet. This will be written with the POU-editor. The POU-editor is open after the creation of a new program. To open the POU-editor later you have to double click on Position.poe. The window POU-editor appears on the screen which you will need for program development. There are two more windows, the so-called syntax controlled declaration editor (upper part) for the declaration of variables, and the IL-editor (lower part) for the instruction part (If the syntax controlled declaration editor is on the left side and the IL-editor is on the right side You can rotate them with Window Rotate) :

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

21

2 Introduction

fig. 6: POU-editor with syntax driven declaration editor, and IL-editor

2.7.3 Syntax controlled declaration editor


You will enter your program in two stages. First, declare all variables you are going to use. You have two options to do so: 1. The syntax controlled declaration editor, using a comfortable, guided interface. 2. The free declaration editor, giving you much less guidance but more liberty; this is more suited to the experienced programmer and will not be covered in this chapter. If you are new to programming, IEC1131 and/or OpenPCS, we recommend that you use the syntax controlled editor first. Then, enter the instructions of your program in Instruction List. It is just for this manual that we enter declarations first, and then instructions. You may do this in any order, switching back and forth as you like.

22

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

2.7.4 Declaring in syntax controlled mode


To declare a variable in syntax controlled mode, first select the proper type of declaration: Select the type of declaration you want to do. If, e.g. you want to declare a local variable, select local declarations by pressing button local.

Declare all variables of this type, then choose another type of declaration if necessary. Watch the set of edit fields change as you select different types of variables.

fig. 7: Buttons to select declaration types (from function blocks)

In our example, we will only need local declarations. This is the default, but to be sure, select Local again.

fig. 8: Declaration Edit Fields

To declare the first variable, enter information as follows in the edit fields provided in the top part of the syntax controlled declaration editor (use TAB or your mouse to get there).

Name: initial. If the name is too long to be shown, it will be shifted accordingly. Use POS1 to see the first part again. Type: Select BOOL from the drop-down list, or just type in BOOL. Initial value: You need not enter a value here, because the default initial value 0 is ok for our example. Attribute: Do not enter a value here. Address: enter I0.0 here, which is the physical address this variable shall be mapped to. In the syntax controlled editor the address will be entered without %-sign, but if you switch to the free editor, this sign will be added automatically. Comment: Enter a comment to describe the usage of this variable. Enter: robot arm in initial state Finish this declaration with "Return".

Declare the remaining variables of this example program by the same manner as shown in the figure below. If you make a typing mistake, you can delete this mistake with the DEL-button or the backspace until you change to the next input field. If you want to correct a field later, you only need to place the cursor by mouse accordingly. Now, the declaration list is complete.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

23

2 Introduction

fig. 9: Declaration list

2.7.5 Entering the Program in IL


After declaring all variables, we will now start to enter the program into the lower part of the window ( that is the IL-editor). One IL line can consist of operator, operand, comment; between them a tabulator or a blank. Start each instruction on a new line. Use (* and *) to enclose your comments, and insert the comment between them. Under the menu item Insert Operators ... you find a list of available operators. From this list you can put an operator directly into your program by marking and confirming the selection with the button OK. The operator will be inserted at the current cursor position. With some experience you will find it much faster to key in operator names directly. During the input of the program you can switch between the declaration-editor and the IL-editor by selecting with the mouse button. Now, for our example, enter the IL program as follows. If you mistype, use the backspace key or the DEL-button to correct: LD AND S LD OR R initial key_start motor key_halt position_A motor

(*switch motor on *)

(*switch motor off*)

As you see, valid instructions are marked by colours, easing understanding of the program structure. After the program input, the window IL-editor has following content:

24

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

fig. 10 The completed sample program

Save the completed program by the action File Save.

2.7.6 Syntax check

Select File Syntax Check to invoke a syntax check on your program. If you modified the POU since you last saved it, you will be asked to save it again, as the syntax check will always work on the saved version of the POU. If you typed in the program properly, you will just see a message No syntaxerror . If you accidentally introduced errors, you will be informed. See the next chapter on how to use the information provided to correct the errors.

2.7.7 Error correction


Should you receive error messages, these are displayed in the window Error Messages:

fig. 11:Dialog box Error Messages

This dialog box lists one error in each line, displaying (from left to right): Location of the error ( In this case Instruction part ) Line number Row number Short error description
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

25

2 Introduction

Double-click the line displaying the error message to be transferred into the editor close to the erroneous line Detailed error information are available by selecting the error message and pressing F1.

2.7.8 Print a Program


Select in the POU-editor File Print, or if the selected file is in the branch Project Files, click with the right mouse button on it, and select in the context menu Print. The print dialog will be opened. Accept by the OK-button. The use of forms is not supported currently!

2.8 Defining the Resource


2.8.1 Overview
You use the editor to create POUs of different types (PROGRAM, FUNCTION_BLOCK, FUNCTION) in different languages. To have these POUs running on your controller, you will need a resource definition: Resource is an abstract term defined by IEC1131. In general, you can substitute PLC or controller for resource. The definition of a resource consists of A name, identifying the resource. You may freely choose this name A hardware description, telling OpenPCS about the properties of the hardware of the controller. Depending on your controller, this will be a fixed list of controllers available, or you might have a tool to define your own controller. A communication definition, telling OpenPCS how to communicate with this controller. For CANopen, e.g. this could be a node ID, or for V24 it could be a COM port. A list of tasks to be run on that controller. Task is another abstract term defined by IEC1131. In general, you can assume a task to be equivalent to a program plus information telling the controller how to run that program. The definition of a task consists of: A name, identifying the task. Again, you may freely choose that name. Information about how to execute that task (cyclically, interrupt driven the choices you have strongly depend on your controller. A POU of type PROGRAM which defines the program which is executed in that task. OpenPCS delivers to you the freedom of IEC1131 in defining resources and tasks. If you have experience in programming traditional PLCs, or with other IEC1131 systems, you might not be aware of this freedom: One project may contain more than one resource. This is extremely useful if your problem requires more than one controller. Re-use of software among these controllers is intuitive.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

26

2 Introduction

A program (more precisely: a POU of type PROGRAM), can be linked to more than one resource. This means that this one source will be compiled more than once in this project, first for controller one, second for controller two. The same is true, of course, for POUs of types FUNCTION and FUNCTION_BLOCK. Reuse of such blocks in one task, different tasks in one resource, or in different resources is strongly encouraged. One controller can use more than one resource. If you want to have different versions of your project readily at hand, another resource for the same controller can be a convenient way.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

27

2 Introduction

2.8.2 Adding a resource


To define a resource, switch back to the Project Browser. Select File New Resource. A dialog box similar to the following will be shown, prompting you for the properties of the new resource.

fig. 12: Definition of a resource

In the field "name", enter a name for the new resource. In our example, enter BSP_RES. In the combobox at the right top, select the hardware to describe your controller. In our example, select SmartPLC.

Now, your project browser should look like:

28

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

fig. 13: Project Tree with a resource

The branch Configuration has a new entry representing the resource we just defined.

2.8.3 Defining a Task


To add a task, you have two options: a) Select the resource and select File New Task b) Or, Select the POU of type PROGRAM you want to have executed in the new task, drag it with the mouse button pressed and drop it onto the resource node (Drag-and-Drop).

We will employ the second option: select POU Position.poe with your mouse, keep the mouse button pressed and drag the POU onto the node Bsp_res, releasing the mouse button there. A dialogbox will be shown, prompting you for the properties of the task to create. In our example, we are happy with the defaults, so just close this dialog by pressing OK.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

29

2 Introduction

fig. 14: Task Properties

To delete a task or resource, have it selected and press the DEL key. To later see or modify the properties of a task or resource, double-click it

2.8.4 Create the executable program


To compile your program into executable code, select the node of the resource and press the Generate Code button in the toolbar:

The compiler output window will be shown, displaying progress information. If your program is free from errors, the last line will read All in all 0 errors occured while compiling !. With most errors, a double-click on the line displaying the error message will transfer you into the editor to the very location of the error.

30

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

fig. 15: Compiler-Messages

The icon of the resource is marked by green colour which indicates that this is the "active" resource. For the most errors, a double click by mouse on the error messages is enough to open the editor at the incorrect place.

2.9 Test and Commissioning


2.9.1 Overview, SmartSIM
In order to test a program, you need a PLC. You can use the real control system which you bought together with OpenPCS. To be independent of the different control systems in this manual, with which OpenPCS is distributed, we use only the SmartSIM32 here. The SmartSIM32 is an easy simulation of a PLC under Windows. Start the SmartSIM32 with the SmartSIM in the project manager. menu item Tools

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

31

2 Introduction

fig. 16: The SmartSIM32

To switch digital inputs, click them with the mouse. Outputs are just displayed and activated by the application program. The program will be stored on disk and re-loaded automatically at startup of SmartSIM. To prevent SmartSIM from loading the program stored on disk, keep CTRL and SHIFT pressed at start of SmartSIM.

For the transformation and the commissioning of the executable program, you use the tool test and commissioning: Select the resource Bsp_res in the project management. Go Online . Select now the menu item Online The window Test and Commissioning will be opened now

32

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

fig. 17: Test and Commissioning

After that you will be asked, if you want download the program to the PLC. Accept it with the Yes-button.

Messages of the PLC are displayed in the lower part of the project browser.

Fig 18: Messages of the PLC

2.9.2 Starting and Stopping the Program


You may remote-control the program running in the PLC with the following commands: PLC STOP PLC Coldstart PLC Warmstart PLC Hotstart Select PLC Stop to immediately stop the program Select PLC Coldstart to perform a cold start. All variables will be initialised to the initial value as programmed. Select PLC Warmstart to initialise all normal variables, but keep the values of all variables programmed as RETAIN. Select PLC Hotstart to continue execution where it stopped, not initialising any variable.

2.9.3 Testing the program


OpenPCS provides two major ways of testing your program: Variable status: watching variables, setting variables, Program status: in IL, LD, FBD, and CFC

2.9.4 Variable Status 2.9.4.1 Watching variables


To display and periodically update the value of selected variables, use the watch window in T+C:

Open the branches BSP_res and POSITION of the T+Cs instance tree in the project browser. There you can find the variables which you want to monitor. Mark the variable which you want to monitor Select Online Watch variable (or click the variable with the right mouse button and select Watch variable). The variable appears in the T+C-window.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

33

2 Introduction

fig. 20: TUI window with watch variables

34

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

2.9.4.2 Setting a Variable


In the T+C-window double-click the variable which you want to set. The window Set variable is opened. Enter the new value into the input field Value.

fig. 21: Set variable

In the project browser select Online Go Offline to finish the online-mode.

2.9.5 Program Status


Within the browser's treeview of the resource in the configuration branch, select not a variable, but rather a function, an instance of a function block, or the program itself. Go Online by selection of the menu item Online Go Online . Mark the program POSITION in the instance window of the project browser.

fig. 22: POSITION marked

Select the menu item Online Online Editor or click with the right mouse button on the program and select Online Editor. The online editor will be opened.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

35

2 Introduction

fig. 23: Online editor

Activate the status display in the menu Online Status display. The current results (CR) appear in the lower left window which result after the execution of the command of the respective line.

36

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

2.10 Other Features of OpenPCS


This short introductory manual is not meant to cover all details and features of OpenPCS. To preserve readability and conciseness, many things have been left out. Consult the other chapter to get more information.

2.10.1 Other programming languages


In this chapter, we only used instruction list (IL). OpenPCS comes with a variety of other programming languages: Ladder Diagram (LD) - Function Block Diagram (FBD), - Structured Text (ST)), - Continuous Function Chart (CFC) The following chapters will give you just an impression of these languages, see the in-depth chapters for a deeper coverage. In the symbol board of the POU-editor you can select the language which you want to use for the programming: IL LD FBD ST You can edit or print a POU with a language of your choice even if it was created with another language. In contrast to the other programming languages ( IL, LD, FBD ) you cant switch to ST later.

2.10.1.1 LD Ladder Diagram


An application can be represented by LD as follows:

fig. 24: Programming Language LD

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

37

2 Introduction

2.10.1.2 FBD Function Block Diagram


Our previous example can also be represented by FBD as follows:

fig. 25: Programming Language FBD

2.10.1.3 Structured Text ST


Our previous example would look like this if you wrote it in ST:
PROGRAM position VAR initial key_start key_halt position_A motor END_VAR

: AT %I0.1 AT %I0.2 : AT %I0.3 : AT %Q0.0 :

AT %I0.0

BOOL; : BOOL; BOOL; BOOL;

(* robot arm in initial state *) BOOL; (* start key *) (* stop key *) (* Position A *)

if (initial AND key_start) then motor := TRUE; end_if; if (key_halt OR position_A) then motor := FALSE; end_if; END_PROGRAM

Remark: Every ST-program can be transformed into the other languages, but not vice versa.

38

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

2.10.1.4 CFC
While all other languages are meant to be used for programming, CFC is intended to configure functionality encapsulated in already pre-programmed blocks. Use the IEC1131 languages (IL, LD, FBD and ST) to build a library of function blocks. Use CFC to interconnect these blocks to implement your application without having to go into the details of programming. A sample CFC is:

fig. 26: Programming Language CFC

2.10.2 Block Types


In the simple example of this manual, we only used one POU, which was of type PROGRAM. Besides a PROGRAM, OpenPCS offers POU types FUNCTION and FUNCTION_BLOCK. To get the best of OpenPCS, it is essential that you understand these block types. The block type is completely independent of the programming language.

2.10.2.1 FUNCTION
A function, as defined by IEC1131, has the following characteristic properties: - It has one or more inputs (but no input is not allowed) - It has exactly one output value (which may be a structure) - A function has no memory from one call to the next, and it will return always the same output when given the same inputs - On every call to a function, all inputs have to be supplied - A function may use local variables for intermediate storage, but the value of these local variables will not be kept from one call to the next - A function may call other functions, but it is not allowed to call instances of function blocks

2.10.2.2 FUNCTION_BLOCK
A function block, as defined by IEC1131, has the following characteristic properties: - It may have one, more than one, or no inputs - It may have one, more than one, or no outputs - Multiple instances can be created of a function block, and each instance will keep a private copy of all data associated with that function block (input, output, intermediate data); a function block cannot be called, only instances can be called. - The function block has a memory, i.e. all data (input, output, local) will keep its value from one call to the next. - On a call, it is not necessary to supply all input data; those not provided will simply keep the value from the previous call (or the default value if there was no call before).
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

39

2 Introduction

A function block can call functions and instances of other function blocks.

40

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

2.10.2.3 PROGRAM
A program in OpenPCS has the following characteristic properties, as defined by IEC1131: - Only the program is allowed to declare variables to be mapped to physical addresses - A program is allowed to call functions and instances of function blocks.

2.10.3 Free Declaration Editor


In this manual, we only used the syntax controlled declaration editor, but OpenPCS provides another declaration editor, called the free declaration editor. The free declaration editor presents a line-oriented text edit window. To a beginner, this is rather unsuited as you would have to know and remember the exact syntax of each flavour of declaration by heart. To the experienced programmer, the free declaration editor has some benefits: - You can see multiple declaration sections (INPUT, OUTPUT, LOCAL) at once - Some advanced features, like initialised structures, are not possible in the syntax controlled mode - The clipboard allows more intuitive copy and paste operations for more than one variable at a time in the free mode. You may always switch between the free mode and the syntax controlled mode, just select Extras Variable Editor Free Mode, or Extras Variable Editor Syntaxcontrolled Mode. In those rare cases where the syntax controlled mode cannot be used, you are just given an error message.

fig. 27: Free Declaration Editor

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

41

2 Introduction

2.10.4 Additional Features of the project browser 2.10.4.2 Libraries


Libraries allow you to write and distribute re-usable code. Write and test your functions and function blocks, then distribute them to other users of OpenPCS and allow them to re-use your code. See chapter 3 for more details.

2.10.5 Conclusion
This concludes our short trip through the most notable features and tools of OpenPCS. Be sure you didnt see everything, and have a look at the more detailed manuals to learn about more features.

42

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

2 Introduction

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

43

3 The Project Manager

3 The Project Manager 3.1 Introduction


The tool Project manager is used for the management of projects and the files belonging to projects. It is similar to the well-known Windows-Explorer, but has some additional functionality required by OpenPCS. This is why you should not try to replace the Project Manager by another file management tool; internal links are generated by the project manager automatically which are absolute necessary for a correct work with OpenPCS. With the project manager you can structure your work into projects. A great advantage of OpenPCS is the reuse of blocks in other projects. Please note the following hint: Avoid to create several OpenPCS-projects for related work. One machine, one network of CANopen nodes, or even one plant might be one project. Use separate projects for unrelated work; this increases your overview and prevents you from mistakenly modifying wrong code.

Overview: The project management window consists of four parts:

4 3

fig. 28: The project manager

44

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

(1) The project tree All parts of a project are combined in a tree here. Further details in chapter 3.4. (2) The menu panel and the toolbar The toolbar: Create new project Open an existing project Generate executable code Add file Edit resource Edit the task properties Add task to the selected resource Separate the desktop for applications (3) The output window: Output of the compilation or the online operation are shown here. (4) The Application Bar Click one of the icons to start the respective application. The Editors will be launched with the file currently selected in the browser's tree. In the following chapters the functionality of the project management should be explained in detail.

3.2 Start of the project browser


Start OpenPCS from the start menu: Select Start Programs OpenPCS OpenPCS.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

45

3 The Project Manager

3.3 Managing projects


3.3.1 Create a new project
If you have opened the project browser, you can start with the work. The first step is the creation of a new project. This can be done by two ways: By the toolbar: Click on the button New project: By the menu: Click in the file menu on Project New Project.

Please note: The project name has a maximum length of eight characters. If you try to enter a name with more characters, the cursor will jump to the initial position again. You can create the project in any directory, but it is recommended to hold the projects in your OpenPCS-directory. A subdirectory, which has the same name as your project, will be created automatically. This directory contains all files which belong to your project.

fig. 29: Dialog box Create new project

3.3.2 Open an existing project


You have three possibilities to open a project: In the File-menu: Here you find a list of the last opened project; the file, which you are looking for, could be contained in this list.

46

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

By the toolbar: Click on the button Open Project: By the menu: Click on Project Open Project in the main menu.

fig. 30: Open project

In the dialog box you can see a list of the last opened projects. If you cant find the searched project in this list, you can search for it with the button Browse. The project files have the suffix .var. Not used projects can be removed from the list with the button Remove from list. The list contains only references to the projects, therefore, the remove means not that the project will be deleted from the hard disk drive. If the Checkbox Show full path is activated, the entire project path will be shown in the list, through projects with the same name can be distinguished:

fig. 31: Display of entire paths

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

47

3 The Project Manager

3.3.3 Copying a project


For different reasons, it could be that you want to copy all files of a project to another place. To do this, select the menu item Project Copy Project in the project browser. Then you get the following dialog box:

fig. 32: Copying a project

Enter the destination path, and start with the button Copy.

3.3.4 Create a backup copy


Select the menu item Project Backup Project to create a safe copy of the current project. Following dialog appears:

fig. 33: Create backup copy

Enter the name of your safe copy in the field File name, or select an existing safe copy from the list which will be overwritten then. Select the folder in which the file will be created. Accept your entry by the OK- button.

48

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

The safe copy will be created.

3.3.5 Restore a project


If you created a safe copy, you have the possibility to restore your project. Select the menu item Project Restore project. Enter the name of your safe copy into the field File name, or select a name from the list below:

fig. 34: Selection of the safe copy of a project which must be restored

Accept by the OK- button. A dialog box will be opened in which you can select the target directory:

fig. 35: Selection of the project directory

Select a project directory in which you want to restore your project. Accept your selection by the OK- button. The project is restored. Messages will be displayed in the output part of the project browser window.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

49

3 The Project Manager

3.3.6 Deleting projects


You can delete the current project by the menu item Project Delete Project.

fig. 36: Additional accepting for deleting the project

3.3.7 Rename project


If you want to give the current project another name, select the menu item ProjectRename Project.

fig. 37: Rename project

Hint: When renaming a project, please consider the restrictions given in chapter 3.3.1 for names and paths of projects.

50

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

3.4 The project tree


The project tree is generated automatically for the project.

fig. 38: Project tree of the project Bsp

Hint: Only the variables of compiled resources can be displayed. The individual branches of the project tree will be described in the following chapters.

3.4.1 Libraries
Libraries are a way to redistribute re-usable blocks of software. In the library branch, the Project Manager will display all libraries which are used with the current project. See chapter 3.10 for details.

3.4.2 The project directory


A project (in this case Bsp) consists of two subdirectories:

fig. 39: Subdirectory of a project (in this case Bsp)

These subdirectories are the same for all projects, and are generated automatically together with the project. The resources of the project are in the branch Configuration. We examine the subject Resources more closely in the chapter 3.9: Resources.

fig. 40: The branch Configuration consists the resources of the project

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

51

3 The Project Manager

The files, e.g. POUs, CFCs, variable- or type declarations, can be found under Project files. We examine these in the chapters 3.5: Creation of POU- and CFC-Modules and 3.8: Type definitions:

fig. 41: The branch Project files

3.5 Creation of POU- and CFC-Modules


The different types of POU- and CFC-files (CFC = Continuous Function Chart) can be created by the project browser as follows: Select FileNew from the menu, and select the type of module which you want to create: POU-Program, POU-Function block, POU-Function, CFC-Program, CFC-Function block or CFC-Function. Enter in the next dialog the name of your module:

fig. 42: Create new module

Hint: The window region Format is only available in CFC-Modules, there, the sheet size (A4/A3) and the orientation (Portrait/Landscape) can be selected. The new module is added to the project tree under Project files:

52

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

fig. 43: POU-and CFC- Modules in the branch Project files

3.6 Editing of POU- and CFC-Modules


Modules can be edited as follows: Double click the module or Right click on the module and select Open from the context menu or Mark the module and select the menu item File Open. The corresponding editor will be opened according to the type of the file. You can graphically create programs by the CFC-editor. See the chapters on the respective editors for more details on how to edit files.

3.7 Global resource variables


Variables are names which are used to represent memory locations holding data. Variables can be classified as follows: Variables, which are assigned to physical input- or output-locations, or PLC-memories. Variables, which are only used internally to store intermediate results. Global resource variables are accessibly from all locations of the resource. In OpenPCS, there are two kinds of global resource variables: Global variables: These are variables without hardware-addresses, e.g. for intermediate results. Direct global variables: These are variables with direct hardware-addresses together with the IO-declarations. These represent the interface to the hardware.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

53

3 The Project Manager

3.7.1 Creation of [direct] global variables


Select the menu item File New [Direct] Global Variables

fig. 44: Creation of a new declaration of global variables

Enter the name of the variable declaration, and accept by the OK- button. The new declaration appears in the branch Project files of the project tree:

fig. 45: Declaration of variables in the branch Project files

3.7.2 Editing of [direct] global variables


You have three possibilities to edit [direct] global variables: Double click on the declaration in the branch Project files. Right click on the declaration, and select Open from the context menu. Mark the declaration, and select the menu item File Open. The POU-editor will be opened, and you can declare your variables. Only variables of type GLOBAL can be declared. We refer for detailed information to the chapter 4.

54

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

3.8 Type definitions


Data types can be either elementary or derived. Elementary data types are defined either in the IEC 1131 or by the manufacturer of the control system. On the other hand, derived data types are defined by the programmer or by the manufacturer. By creation of the project, a standard type definition Usertype.typ will be generated. This one cant be deleted and is assigned to all resources:

fig. 46: Standard-type definition Usertype.typ

3.8.1 Creation of new type definitions


Select a menu item File New Type definition :

fig. 47: Create new type definition

Enter the name of the type definition and accept by OK- button. The new type definition will be located in the project tree under Project files:

fig. 48: Type definitions in the branch Project files

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

55

3 The Project Manager

3.8.2 Editing of type definitions


You have three possibilities to edit a type definition: Double click on the definition in the branch Project files. Right click on the definition, and select Open from the context menu. Mark the definition, and select the menu item File Open. The POU-editor will be opened, and you can declare your types.

3.9 Resources
If a POU was created, you must define a resource in order to execute it on your control system. In general, a resource is equivalent to a PLC or a micro controller. A resource definition consists of the following: 1. 2. 3. 4. A name for identification. The hardware description: Information about the properties of your PLC which will be used by OpenPCS. Information about the kind of communication between OpenPCS and the control system. A list of tasks which are to be run on the control system.

3.9.1 Creation of a resource


In order to create a new resource, click on File New Resource in the menu. A dialog box appears in which you can define the properties of the resource.

fig. 49: Create new resource

56

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

You can select a resource name with a maximum size of eight characters. In this version, the default-Hardware type is the SmartPLC, but you can add further modules. In this case, you can select that module which describes your control system. If you select the checkbox Enable Upload, additional information will be transferred to the control system to allow the re-compilation.

3.9.2 Edit a resource


Right click on the resource, and select Open from the context menu Or Mark the resource, and select the menu item File Open Or Mark the resource, and click in the toolbar on the icon Edit resource:

The dialog Editing Resource properties will be opened:

fig. 50: Editing resource

To change the network settings, click on the button Network settings. The following dialog will appear:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

57

3 The Project Manager

fig. 51: Define a network protocol of a resource

Select in this dialog box the communication protocol of the control system.

3.9.3 Adding a task


In general, a task is equivalent to a program plus the information how the program can be executed. The definition of a task consists of: The name The Information about the execution of the task A POU of type PROGRAM which should be executed in this task You can add a task in different ways: By Drag and Drop: Click on the block and hold pressed the mouse button, and put it to the resource Mark the resource, and select the menu item File New Task Right click on the resource, and select context menu item New task Mark the resource, and click on the icon Add task to the selected resource bar: After adding of the task, the task-properties-window will be opened: of the tool-

fig. 52: Task properties

Note that the task name depends on the program name, and cant be changed. To complete the task definition, you must specify the information, how the task can be executed: Cyclic Timer controlled Interrupt controlled

3.9.4 Adding of [direct] global variables

58

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

Global variables, which are added to a resource by this form, are global for resources. These can be added by different ways: Drag and Drop: Click on the icon of the [direct] global variable definition, hold pressed the mouse button, and put it to the resource to which it should be added. From the Edit-menu: Mark the resource, and select the menu item Edit Add [Direct] Global Variables.

fig. 53: Selection of the files which will be added

Select the file which you will assign to the resource, and accept this by the button Open.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

59

3 The Project Manager

3.9.5 Adding type definitions


Type definitions are added as follows: Per Drag and Drop: Click on the icon of the type definition, hold pressed the mouse button, and put it to the resource to which it should be added. By the Edit-menu: Mark the resource, and select the menu item Edit Add Typedef.

fig. 54: Selection of the type definition file

Mark the type definition, which you want to add to the resource, and accept by Open-button.

3.9.6 Generate executable code


You have three possibilities to generate executable code of a resource: Mark the resource, and click on the icon Generate code in the toolbar. Mark the resource, and select the menu item Project Build [All]. Right click on the resource, and select Build [All] from the context menu.

The menu item Build All will recompile even unmodified portions of your application. The compiler messages can be read in the lower window of the project browser.

60

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

fig. 55: Compiler messages during the compilation of the resource Bsp_res

If errors occurs, they will be displayed:

fig. 56: Error messages during compilation

If you double click on an error messages, the corresponding editor will be opened, and the cursor is placed at the line at which the error occurred.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

61

3 The Project Manager

3.10 The Connection Setup tool


3.10.1 About Connection Setup
Connection Setup enables configuring connections from OpenPCS to a PLC. Connection Setup provides three options for you: You can ... create new connections on your own. change connection properties. delete connections.

3.10.2 Components of a connection


A connection is a particular composition of a connection name, a driver and the drivers settings. Connection Setup shows not only the connection name, the driver and the drivers settings, but also the file path called Code-Repository path - of the .PCD file loaded in the PLC during the last session.

If a .PCD file has not already been loaded via a particular connection, a question mark (?)will appear as Code-Repository path.

3.10.3 Run Connection Setup


Open Connection Setup by left-clicking on the corresponding icon from the browser. 62
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

Note: Click in the following text means if not otherwise specified left-click. Then the Connection Setup window containing the list of available connections appears.

3.10.4 Create a new connection


When the Connection Setup window appears, click on the new button. The Connection Properties dialog box opens:

Now enter the name of the connection to be created. Take care that the connection name has not got any spaces in it. Use the underscore (_) instead of space. Select a driver by clicking on the select button, the Driver Select window showing driver settings opens:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

63

3 The Project Manager

Click the desired driver and then the OK button. The Connection Properties window now becomes active again. Click the settings button. The Drivers Settings dialog box opens:

You can modify the settings individually. When you agree with the adjusted settings, just click OK, otherwise click cancel. If you want to place a remark, you can do this at the Connection Properties window.

64

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

Finally, click OK from the Connection Properties window.

3.10.5 Edit connection properties


By clicking on the connections name from the Available Connections List, it will become selected. Click on the Properties button and the Connection Properties dialog box appears. Go on like as creating a new connection (see above).

3.10.6 Delete a connection


Select a connection by clicking on the connections name from the Available Connections list. If you then click the delete button, the selected connection is deleted and disappears from the list.

3.10.7 Finish Connection Setup


Click the Exit button from the Connection Setup window.

3.10.8 Select a connection in the browser


Double-click the resource icon from the browser, the Edit Resource Specifications dialog box opens:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

65

3 The Project Manager

To select the current connection, click Network Settings from the Edit Resource Specifications windows, the Select Connection window opens.

Select the desired connection by clicking its name and then click OK. Back in the Edit Resource Specifications window, click OK to apply the modified settings.

3.11 Libraries
The Project Browser features functions required to use libraries, so you can re-use commonly used functionality by putting functions and function blocks into a library of POUs.

3.11.1 Create a library


To create a library, proceed just like creating any normal OpenPCS project. Be sure to perform a syntax check when finished creating POUs (functions or function blocks) in your library project. If you receive a library from your supplier, you will not have to "create" that library. Proceed with "installing" this library instead!

Example: Start the Browser and create a new project named "MyLib" using Project New... Create a function block named "det_edge" (for edge detection). Implement this function block as shown below:

VAR_INPUT input : END_VAR VAR_OUTPUT output : END_VAR VAR tempvar : END_VAR LD ANDN 66 input tempvar

BOOL ;

BOOL ;

BOOL ;

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

ST LD ST

output input tempvar Syntaxcheck .

Invoke a syntax check in the POU editor with File

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

67

3 The Project Manager

3.11.2 Installing a library


Before you can use a library, you have to install it on your PC. Use Library Browser: Install within the

fig. 57: Install Library

Use the browse-button to locate the .VAR file representing your project. If you created the library yourself, this will be in the directory you specified when creating the library project with Project New. If you received the libary on a disk, this can be something beginning with "A:\". During installation, the library project will be copied into a sub-directory of <windows>\ openpcs.401\Lib. Example: Create a new project in the Browser using Project New.... Name that new project "TEST". Select Library Install. Now use the browse-button to locate the MyLib-project you created just before and press "Install".

68

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

3.11.3 Adding a library to a project


After installation, all files needed for the library will be present on your computer. But the functions and function blocks in that library will not be automatically available in your projects. You have to "add" the library to the project first using Library Add. Example: Select Library Add,and in the dialog shown find your library "MyLib", then press OK. Create a new POU of type PROGRAM, named "main". Select Insert User Functionblocks.... Press "Update" to see your library functions. To use your function block DET_EDGE, implement program "main" as shown below: VAR sig1 AT %I0.0 : BOOL ; anEdge : DET_EDGE; count : UINT ; END_VAR CAL anEdge ( input := sig1 | :=output

) LDN JMPC LD ADD ST ende: Compile that program, add it to a resource of your choice and execute it. Change input %i0.0 and see variable count incremented anEdge.output ende count 1 count

3.11.4 De-Install a library


If you want to get rid of a library installed on your PC, select Library shown, select the library to get rid of and press OK. Example: Select Library Uninstall. In the dialog, select <Windows>\ openpcs.401\MyLib. Press OK, and "MyLib" is no longer available as a library Uninstall. In the dialog

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

69

3 The Project Manager

3.12 Registration of foreign files


Files, which you have written with the editors of OpenPCS ( IL, LD, FBD, ST, CFC), will be registered and displayed automatically by the browser. You can register files in one project, even if they were created by other programs, for example by: Microsoft Word Microsoft Excel Microsoft Project AutoCAD They will be displayed in the browser, and can be edited by a double click. To register a file, which was created by a tool, you can do as follows: Save the file under the root directory of the current project. Files, which are not saved under the root directory of the current project, can not be registered. Select Project Add file or click on the icon Add file Mark the file which you want to add. Accept by the OK-button. from the toolbar.

70

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

3.13 Test and commissioning


To check a program, you need a PLC. You can use the real control system which you bought together with OpenPCS. But in this manual, we will give a general example, and for that purpose we use a simulator ( the SmartSIM32 ) which is distributed with OpenPCS.

3.13.1 Start of the SmartSIM32


The SmartSIM32 is a simple simulation of a PLC under Windows. Start the SmartSIM32 by selection of the menu item Tools SmartSIM in the project browser. The SmartSIM32 will be started:

fig. 58: The SmartSIM32

3.13.2 Go online
Before you go into the online-mode, you must assure that a PLC is running, e.g. the SmartSIM32, to which you want to create the connection. You have two possibilities to go online: Mark the resource which you want to test, and select menu item Online Go online Or Right click on the resource, and select Go online from the context menu. The window Test and commissioning will be opened:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

71

3 The Project Manager

fig. 59: Test and commissioning

72

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

3.13.3 Download of a resource


If you have changed your resource and the Test and commissioning-window is open, you can transfer the resource to the PLC by: Mark the resource which you want to download, and select the menu item Online PC>PLC Or Right click on the resource, and select Download from the context menu. The messages are displayed in the lower window of the project browser.

3.13.4 Up load of a resource


If you are online, you can load a resource from the PLC into a project. This is only possible if additional information was also loaded to the PLC (see 3.9.1: Creation of a resource, checkbox "Enable Upload"). We recommend that you create a new project before doing the upload, so you will be sure not to intermix files uploaded with files already existing on the PC. Create a new Project with Project New..., then create a new resource in that new project, then start the upload: Mark the resource which you want to load, and select the menu item Online Upload in the project browser Or Right click on the resource, and select Upload from the context menu. The messages are displayed in the lower window of the project browser.

3.13.5 The Test and commissioning


In the TUI, the watched variables will be displayed (see 3.13.6: Watching ). This window can be used as a remote control for the PLC by selection of the menu PLC or the toolbar: PLC STOP PLC Coldstart The program execution will immediately be interrupted. The program of the user will be started with the initial values of the variables. Existing process data will be overwritten eventually after a program interruption. The first program execution after transfer to the PLC (or after switch on of the PLC) can only be done as cold start: The program execution will be started. By warm start, retain variables will be reset to their initial values, durable variables keep their current value. (Program continuation after power blackout) By hot start, the execution of the program will continue at the location where was interrupted. The variables keep their values which they had got before the stop. A hot start is only possible after a program stop. The program execution will continue.

PLC Warmstart

PLC Hotstart

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

73

3 The Project Manager

3.13.6 Watching variables


During a program test, it is important to know which values the variables have, or which value produce an error. Therefore, we have the possibility to watch variables. Change to the project browser.

Open the branch of the resource in the project tree by click on the knot ( ) in front of the resource. Make the same with the branch of the task in the resource, then you will get the variables of the task in a listed form:

fig. 61: Variable listing of the task POSITION

You have three possibilities to select the variables which you want to watch: Double click on the variable which you want to watch. Right click on the variable, and select Watch variable from the context menu. Mark the variable, and select the menu item Online Watch variable. The variable appears in the Test and commissioning-window where instance path, type, value, and status are displayed. These variables are permanently updated during the program execution on the PLC.

fig. 62: Test and commissioning-window with watched variables

74

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

3.13.7 Set variables


To influence the behaviour of your control program for test cases, you can set variables to specific values. You have three possibilities to set variables for test cases: Mark the variable in the T+C, and select the menu item Debug Set variable. Double click on the variable in the T+C. Set the corresponding input bits in the SmartSIM32 directly by mouse click.

fig. 63: Set variable

Enter the new value and accept by Set-button.

3.13.8 The online-editor


With the online-editor you can watch entire programs or function blocks. The online-editor is only available if you are online. The program or function block, which you want to watch, must belong to the resource that you loaded into the PLC.

fig. 64: Resource Bsp_res with the task POSITION was compiled and transmitted to the PLC

You have two ways to start the online-editor for a program: Mark the POU, which you want to watch, in the branch under the corresponding resource, and select the menu item Online Online Editor Or Right click on the POU, and select Online Editor from the context menu. The online-editor will be opened. You can display the values of the accumulator in the lower left column (which results from the execution of the corresponding lines) by selection of the menu item Online Status display.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

75

3 The Project Manager

fig. 65: Online-editor with state display

3.13.9 Hardware info


This menu is only available in the online-mode. You get information about the used hardware. Mark the active resource and select the menu item Online Hardware Info in the project browser.

fig. 66: Information about the used hardware

76

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

3.13.10 Resource info


This menu is only available in the online-mode. The project name, the resource name, and the version number (which is internal created and assigned to a specific compilation) are displayed. You can display the resource info by marking the resource and selecting the menu item Online Resource Info in the project browser.

fig. 67: Information about the resource

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

77

3 The Project Manager

3.14 Configuration of the project manager


This section gives you an overview about the settings of the project manager.

3.14.1 Settings
Select in the project browser the menu item Extras Options. The following window will be opened:

fig. 68: Settings

Online settings: Query if resource is not up to date: When trying to download a resource which needs re-compilation, OpenPCS will prompt for re-compilation. Query if program on PLC is not up to date If the code on the control system is not the same as the code of the resource which you want to load, you will be asked if you want to transfer the new code. Browser settings: Display directory structure: With this you can switch between the logical structure and the directory structure of the project. In the directory structure, the structure is displayed in the manner files are stored on disk. In the logical structure, files are grouped to functionality.

78

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

fig. 69: Directory structure

fig. 70: Logical structure

Hide variable nodes: The listing of variables of a resource block can be shown or hidden. Only variables of compiled resources can be displayed.

fig. 71: With variable knots

fig. 72: Without variable knots

Auto arrange tools: When the Browser is being minimized, all other tools of OpenPCS will be minimized with it. Resize the browser again and all other tools of OpenPCS will be resized with it. Disable this option to minimize the browser and keep other tools open.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

79

3 The Project Manager

3.14.2 Printer set up


Before you can print, you must set up a printer at first that means you must give the information which printer should be used, and how should be printed. Select the menu item File Printer Setup .... The window Printer settings appears (please note that the layout and contents of this box may vary widely depending on the Windows- and network-version you are using):

fig. 73: Printer settings

80

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

3 The Project Manager

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

81

4 The POU-Editor

4 The POU-Editor 4.1 Overview


The POU-editor is a tool by which you can create POUs, check them for syntactical correctness, and compile. The POU-editor allows you to define Global Data types for your special requirements, to create a cross-reference list, and to print. A POU always consists of a declaration- and an instruction part. Corresponding to this POUstructure, the POU-editor is subdivided into a declaration part (at the top), represented by the variable-editor which is used to declare variables, and an instruction part (at the bottom) by which you create your application program using the declared variables:

fig. 74: POU-Editor with declarations part (at the top), and instruction part (at the bottom)

The expression POU is the abbreviation of ProgramOrganisationUnit, and represents the three POU-types: program, function block, and function from which a PLC-program is constructed.

82

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 75: Create new POU

Please note that a POU, created or saved by OpenPCS Version 4.1, cant be used by earlier versions of OpenPCS, because the structure of the files has changed.

4.1.1 Program overview


The POU-type program represents the main program. All project variables with a reference to a physical address (e.g., marker, and inputs /outputs ) must be declared here. A program uses static variables for which the operating system of the PLC, henceforth called system, reserves memory. A program should have an easy to grasp size. If a complex program must be developed, a splitting into several subprograms, which are developed separately, could make the problem easier. This kind of programming is called structured programming. The subtasks are treated in function blocks or functions.

4.1.2 Function blocks overview


Function blocks (FBs) are important elements for the structuring of your PLC-program. They are used by programs or other FBs, and can call other FBs or functions. The system reserves permanent memory for each instance of a FB. Because of this memory the instance keeps their local data, and all input /output parameters (comparable with an object in other languages) from a call to the next one. An FB-instance is only usable inside the POU in which it was declared, unless it was declared as global. OpenPCS offers several standard functions and standard function blocks for common problems. As mentioned, you can define your own FBs, and declare an instance and use them in your invoking POU like the standard FBs.

4.1.3 Functions overview


Functions are elements for the structuring of your PLC-program. They are used by programs or FBs, and can call other functions. A function can have one input-parameter, no input-parameter,
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

83

4 The POU-Editor

or several input-parameters which will be used to compute the return-value. In contrast to the FBs, a function returns only one element, and has no memory. A function, when called with the same input-parameters, always returns the same return-value. Functions are valid in the whole project, and can be invoked by every POU. An existing POU (program, function , or function block) can be converted into a POU of another type. To do this, use the option Convert POU-type, see section Convert POU-type.

4.2 Declaration part


In the declaration part you define the variables which you want to use in the instruction part. Instances of function blocks are declared like variables (Instantiation).

Delete declarations of variables and function block instances which you dont need anymore. Otherwise you waste memory on your PLC.

4.2.1 Sections of variables


According to the application case, variables are declared in different sections of variables, socalled declaration blocks. A declaration block starts with a keyword and ends with END_VAR (e.g., VAR_GLOBAL ... END_VAR). An exception is Type: TYPE ... END_TYPE. Input If a variable block should only be read inside a POU, you must declare this variable as input-variable. It thereby isnt allowed to modify this variable in this POU. An input-variable can be used for the parameter transfer in a function or function block. Keyword: VAR_INPUT In_Out An input-/ output-variable is accessed under the same name by a function block. The variable gets a reference (pointer) to the transferred variable and its memory location during the parameter transfer by the block-call. Because a write-operation has a direct effect to the content of an In_Out-variable, it isnt allowed to use a writeprotected type for the transferred variable as INPUT-variables or variables with attribute CONSTANT. Keyword: VAR_IN_OUT Output The Output-variables are declared in the function block that use them for the return of values. The calling POU can access them. Keyword: VAR_OUTPUT Global A variable should be declared as global variable in the POU program if this variable should be valid in this POU and in the function blocks called by this POU. This variable must be declared as external variable (VAR_EXTERNAL) in all function blocks which intend to use this variable. If a variable is declared in a global or direct global variable declaration, it must be located in the variable-section GLOBAL. In this case, the variable is resource global (see 3.7). The declaration of global variables can be supplemented by the attributes RETAIN

84

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

or CONSTANT (see Attributes ) , or by an address (see Address ). Keyword: VAR_GLOBAL External If a declared global variable of POU-type program will be used inside a function block which is called by this POU, this variable must be declared as external variable inside this function block. Keyword: VAR_EXTERNAL Type The keyword TYPE is used for declaration of user defined (derived) data types with local scope in the POU-types program and function block, or with global scope in the type definitions (see Type definitions in chapter Project management). Derived data types are special data types which you can derive from elementary data types. Example: By appropriate declaration of a derived data type Pressure as data type INT with subrange, the new data type can be used for the declaration of variables: TYPE Pressure : INT (0..100); END_TYPE VAR Chamber_pressure : Pressure; END_VAR The variable Chamber_pressure thereby is of data type INT, and can only have values in the range 0..100. Keyword: TYPE Local A local variable is only valid inside the POU in which it was declared. The declaration of local variables can be supplemented by the attributes RETAIN or CONSTANT (see Attributes ) , or by an address (see Address ). Keyword: VAR

According to the POU-type only certain variable-sections can be used: Program: Type Local Global Function block: Type Input Output In_Out Local External Function: Type Input

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

85

4 The POU-Editor

Local

86

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.2.2 Elements of a declaration of variables


A declaration of variables consists of following elements: Element Name (name of the variable) Type (Data type) Necessary Enter the name of the variable. The length is limited to 64 characters. Enter the data type of the variable, for example an elementary data type as BOOL, UINT, etc., or a derived data type or a function block.

Necessary

Initial value

Optional

On program start the initial values will be assigned to the variables. If no initial values are set, the variables get the default-values (for numerical variables is usually this the value 0). Enter the attribute of a variable. You can choose between the attributes RETAIN or CONSTANT (or none). RETAIN: With the keyword RETAIN you indicate that the variable should be permanent, i.e. this variable will be stored in a buffer if a power black-out or a stop of the control system happen. Use RETAIN to declare a permanent local or global variable. CONSTANT: With the keyword CONSTANT you indicate that the PLC cant modify the value of this data element.

Attribute

Optional

Address

Optional

If you need a variable with a fix assignment to a physical address (a directly represented variable), you make this assignment by giving a code letter for the memory location, and code letter for the data format into the cell address. Code letter for the memory location: I: Digital-input Q: Digital-output M: Marker Code letter for the data size: X or without letter: Bool (1 Bit) B: Byte W: Word D: Double word Example: %I0.0 in the Free variable-editor I0.0 in the Syntax controlled variable-editor (indicate a boolean input at the address 0.0)

Comment

Optional

Give addition information about the variable. In the syntax-mode, the variable-editor sets the opening bracket

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

87

4 The POU-Editor

with asterisk "(*" in front of the comment, and the asterisk the closing bracket "*)" behind the comment, automatically. You can see this only if you switch to the free variableeditor. Example: (*This is a comment*)
fig. 76: Elements of a declaration

4.2.3 Variable-editor
You can use the variable-editor in the syntax-mode or free-mode. At start up of the POU-editor, the syntax-mode is the default. You can switch to the both modes by Extras Variable Editor Free Mode and Extras Variable Editor Syntaxcontrolled Mode respectively, or by the buttons of the standard-toolbar: Free-mode Syntaxcontrolledmode
fig. 77: Tool buttons free-mode and syntax-mode

In the case of incorrect declaration in the free variable-editor and existence of complex, derived data types, switching into the syntax controlled mode is not possible. The basic set-up of the variable-editor on the creation of a new POU can be modified under Extras Options.... Thereby, it was also selected in which mode the editor will be opened.

fig. 78: Editor options to adjust free/syntax-mode

88

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.2.4 Variable-editor: Syntax-mode


In the syntax controlled mode, the variable-editor allows a comfortable variable declaration. You dont need to know the keywords for the variable declaration, these will be inserted automatically. The input of the variables is done separately for every variable-section under an own index card.

4.2.4.1 Selection of the variable-section


The variable-section is selected by a click on a displayed index card button at the lower window frame; only index cards are available which are permitted in the selected POU-type. On the POUtype program for example, you can only select between the variable-sections Type, Local, and Global (see 4.2.1: Sections of variables).

fig. 79: Possible variable sections for the POU-type Program

4.2.4.2 Entry of lines


The input of variables is done by editing the columns. Between the columns you change left/right by cursor and TAB / Ctrl+TAB respectively, and between the lines you change up/down and page up/page down by cursor or simple by mouse click, respectively (see 4.2.2: Elements of a declaration) . You finish the input of a cell by changing to another one. A faulty or incomplete input of a cell is identified automatically by the syntax check if its possible. A faulty cell will be indicated by the following box:

fig. 80: Message after incorrectly edited line

Accept this message by OK, and correct the line.

4.2.4.2.1 Enter lines by menu system


On the cells under type and attribute, you can select the input from a list. This list field is opened by a click with the left mouse button on the empty cell and then on the displayed arrow . With the keyboard, press ALT and cursor-down simultaneously to open the list.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

89

4 The POU-Editor

fig. 81:Declaration part in syntax-mode: Selection of the data type

Only elementary data types can be selected from the list field. Further data types and function blocks can be selected by the context menu and the menu Insert respectively.

Click right on the relevant line, or mark the line and select the menu Insert

The context menu and the Insert-menu will be opened respectively:

fig. 82: Context menu in the declaration part

fig. 83: Menu Insert

90

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

Select the category from which you want to select a data type and function block respectively: (1) Elementary Datatypes... See fig. 84: Example: Insert of elementary data types (2) User Datatypes... ... are data types which are either locally defined in the POU or are globally defined in a global type definition. (3) Manufacturer Datatypes... ... are defined by the manufacturer, and are distributed with OpenPCS as standard types. (4) User Functionblocks... ... are POU-function blocks which are written by the user, and belong to the project. (5) Manufacturer Functionblocks... ... are standard function blocks which are distributed by the manufacturer with OpenPCS.

fig. 84: Example: Insert of elementary data types

fig. 85: Example: Insert of manufacturer-function-block

Select the data type and the function block from the list respectively, and accept by OK.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

91

4 The POU-Editor

The data type and the function block will be inserted under Type in the corresponding line.

4.2.4.2.2 Line operations


In addition to the standard Windows functions for the editing of texts as copy, cut, insert, and delete, you can also insert or delete one or more lines at arbitrary position in the table by the functions Insert Row and Delete Row. A line will be marked by click on the line number at the left edge. Insert lines: Mark the line in front of which a new line should be inserted. Insert Row , or click right on the line and select Insert Select the menu item Edit Row from the context menu. Delete line: Mark the line which should be deleted. Delete Row or click right on the line and select Delete Select the menu item Edit Row from the context menu.

4.2.5 Variable-editor: Free mode


In free mode, the variable-editor is suited for trained programmers, demanding quick input and overview, but less guidance. Every declaration line must be entered syntactically correct errors will only be reported on the syntax check of the entire POU. In the free mode, the variable-editor displays all declared variables simultaneously in contrast to the syntax mode. You get a better overview over the declared variables.

92

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 86: Free variable-editor

4.2.5.1 Variable-sections
In this mode you declare the variables of a section in each case in a separate declaration block. For a better overview you can separate the single components of a declaration line by tabulators. For the declaration use the keywords of the different variable-sections, for example VAR/END_VAR for local variables. The syntax check is not done during input, possible errors will only be displayed on the syntax check of the entire POU. Pay attention to the order of the declaration blocks in the free variable-editor. INPUTvariables must be declared in front of IN_OUT-variables, IN_OUT-Variables must be declared in front of OUTPUT-variables, etc. (see IEC 1131-3): Order of the declaration blocks: (1) VAR_INPUT (2) VAR_IN_OUT (3) VAR_OUTPUT (4) VAR_GLOBAL (5) VAR_EXTERNAL (6) TYPE (7) VAR Input variables Input-/output variables Output variables Global variables External variables Derived data types Local variables

4.2.5.2 Declaration lines


A declaration line has the following form, where optional parts are set in [square] brackets, and expressions are set between <sharp> brackets: <variable name> [AT <Address>]: <Type> [:= <Initial value>]; [(* <Comment> *)]
fig. 87: Declaration line in the free mode

First the variable name is given, followed by a colon. Behind the colon is the type, and eventually the hardware address introduced by the attribute AT. Should the variable have a definite value on start, this value will be given after a :=. A line ends always with a semicolon (;). The line can be commented, and comments are set between (* and *). Example:
Expvariable1 AT %I0.0: BOOL; (* variable of type BOOL at the address %I0.0 *) Expvariable2 : BOOL := TRUE; (* variable of type BOOL with the start value TRUE *)

An exception is the direct address without variable names (these variables will be referenced by the address):

AT <Address> : <Type> [:= <Initial value>]; [(* <Comment> *)]


fig. 88: Exception: Address without variable name

In this case the variable name is omitted, therefore the address statement is not optional. Example:
AT %I0.0 : BOOL (* At the address %I0.0 is a data of type BOOL *)

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

93

4 The POU-Editor

The second way of addressing should be avoided for the sake of clarity, because the meaning of the variable relates to the variable name mostly. This is important if other people should read or edit this POU. Some Examples: Variable with no initial value InterMedSum : INT;

Variable with initial value Directly represented variable without name and with no initial value Directly represented variable with name and with no initial value Example function block

Pieces : INT := 5;

AT %Q0.0 : BOOL;

Valve AT %Q0.2 : BOOL;

Counter1 : CTU;

fig. 89: Example for the variable declaration in the Free-mode

On declaration of variables you can find information and hints for the use of variable-sections, data types, and function blocks in the sections 4.2.1: Sections of variables and 4.2.2: Elements of a declaration.

Input with menu system: For the simplified selection of data types, OpenPCS offers a list of all available data types. Here you can use a special help. Set the cursor at the location where you want to insert the abbreviation for the type identifier and function block identifier respectively. Select the menu Insert, or click right in the declaration window and select a domain from which you want to insert an identifier: (1) Elementary Datatypes... See fig. 84: Example: Insert of elementary data types (2) User Datatypes... ... are data types which are either local defined in the POU or are global defined in a global type definition. (3) Manufacturer Datatypes... ... are defined by the manufacturer, and are distributed with OpenPCS as standard types. (4) User Functionblocks... ... are POU-function blocks which are written by the user, and belong to the project. (5) Manufacturer Functionblocks... ... are standard function blocks which are distributed by the manufacturer with OpenPCS.

94

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 90: Example: Elementary data types

Select the data type or the function block respectively, and accept by OK. You can get a description by selection of the abbreviation and press of the Help-Button.

4.3 Instruction part


In the instruction part of a POU you program the logic which the PLC has to execute. Selection of the programming language (IL, LD, FBD, ST, SFC, CFC) is left to your choice, depending on your experience or the task to be solved you may pick one or more of these languages. The menu bar offers all necessary commands for the creation and editing of a program. For frequently used actions you can select buttons from the toolbar additionally:

Save current POU Find Replace Cut into the clip board Copy into the clip board Insert into the clip board Select from all variables Switch to the free variable-editor Switch to the syntax controlled variable-editor Switch to the language IL Switch to the language LD Switch to the language FBD
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

95

4 The POU-Editor

Switch to the language ST Check syntax

Direct help

4.4 The instruction part in IL


The programming language IL is close to a machine code, and therefore an efficient language onto which the graphical languages are mapped. IL is a textual, line oriented language.

Condition: The POU-editor is opened.

Display the standard-toolbar with the menu item View Standard-Toolbar:

.
fig. 91: Standard-toolbar

Declare the variables as described in chapter 1.2, press the toolbar-button Use of the IL-editor from the toolbar:

fig. 92: Use of the IL-editor

4.4.1 The structure of an IL-line


An IL-line has the following form, when optional parts are set in [square] brackets, and expressions are set between <sharp> brackets: [<Label>:] <Operator> <Operand1> [,<Operand2>,<Operand3>,...] [(* <Comment> *)]
fig. 93: Syntax of an IL-line with operator

At the beginning is a label if the line represents a jump target. After that an operator is placed followed by the operands and separated by commas. Comments are enclosed by (* and *). Example:
Start: LD a (* Load a in the register *) ADD b (* Add b to the register *) ST c (* store result to variable c *)

A call to a function block instance is done using operator CAL and CALC respectively; the operand is the instance name, followed by arguments supplied in parentheses:

96

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

[<Label>:] CAL/CALC <Instance name>( [<Input1>:=<Value1>,<Input2>:=<Value2>,...] | [<Variable1>:=<Output1>,<Variable2>:=<Output2>,...] )


fig. 94: Syntax of a call of a function block instance

The parameter transfer consists of two parts. In the first part the parameters are transferred to the function block by setting values to the INPUT- and IN_OUT-variables respectively. The variables, which get no value, retain the value of their last call and their initial value respectively. Separated by a | from the first part, output parameters are specified. Example:
In the declaration part: VAR FB: TON; (* Declaration of the function block instance FB of type TON *) a : BOOL; b : TIME; c : BOOL; d : TIME; END_VAR In the instruction part: CAL FB ( IN :=a, PT :=b | c:=Q, d:=ET ) (* Call of the function block instance FB with input-parameter a and b, and output-value-transmission to c and d *)

operands and comments are displayed in different colours, so your POU gets more clarity.

CAL Counter_3( CU :=Photosensor assembly, RESET:=RES_Button, PV := 120 | full := Q )

fig. 95: Calls can be spread out over several lines

4.4.2 Input helps


To realise an easy use of OpenPCS many helpful tools like the toolbox, context menu, and Insert-menu are available.

4.4.2.1 Insert of variables and instance-calls


Previously declared variables or FB-instances can be inserted as follows: Place the cursor to the position at which you want to insert the variable or instance-call respectively.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

97

4 The POU-Editor

Either click right into the IL-window to open the context menu or select the menu Insert. and the variable-section in which the variable or instance was defined. Select Variable A menu window with an alphabetic ordered list of all declared variables and function block instances of this selected variable-section will be opened, respectively:

fig. 96: Insert of a variable or function block instance

If you select a function block instance, you can adjust by the checkbox FB-Instances with parameters if the parameter passing part should be inserted. You only have to enter the values and variables into the template, respectively, and if necessary change CAL to CALC if you wish a conditional call. Mark the variable and function block, respectively, which you want to insert and accept by the button OK.

fig. 97: FB-Instance with call-template

4.4.2.2 Insert operators


The frequently used operators can be inserted by the toolbox. Toolbox if the toolbox is not yet displayed. Select the menu item View

98

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 98: The toolbox

In the toolbox you can click on the field with the operand which you want to insert at cursor position. The operand will be inserted at cursor position. You can select from a list of all operators by the context menu or the Insert-menu: Place the cursor to the position at which you want to insert the operator. Either click right into the IL-window to open the context menu or select the menu Insert. Select Operators.... The selection window will be opened:

fig. 99: Selection of an operator which is to insert

Select the operator group and then mark the operator which you want to insert. Insert the operator at cursor position by click on the button OK.

4.4.2.3 Insert functions


To insert functions you have the choice between user defined functions and manufacturer defined functions. User defined functions are functions that have been defined by yourself, while manufacturer functions are functions that are distributed together with OpenPCS. Place the cursor to the position at which you want to insert the function. Either click right into the IL-window to open the context menu or select the menu Insert. Select Insert User Functions... or Insert Manufacturer Functions.... The following selection dialog will be opened:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

99

4 The POU-Editor

fig. 100: Function Insert

Select a function from the list and insert at cursor position with OK.

4.5 The instruction part of the programming in LD


4.5.1 Overview
The graphical programming language Ladder Diagram (LD) has its origin in the domain of electromagnetic relay systems and is suited for the programming of logical connections of binary variables with their possible states TRUE 1 or FALSE 0. LD describes the possible current flow through a network, starting at the left power rail (which has the state TRUE) pass through different network elements (the variables) to the right power rail. The result is determined by the network elements, their placement, and the kind of their connections (serial or parallel).

A POU can consist of single networks according to the program sequence. In the head of the network is the current network number, a comment can be entered below the network number.

LD-networks consist of the graphical objects: Connections, Contacts and coils, Jump instructions, Calls of function blocks.

The declaration of variables is done in the variable-editor which is the same for all programming languages. The detailed description of the declaration of variables can be found in section 4.2. The programming languages IL, LD, and FBD can be cross-compiled to each other. Therefore, you can create a program in LD-style and represent or edit further this program in IL- or FBDstyle afterwards. Some constraints should be noted which are described in section 4.8.

100

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

Activate the POU-editor LD (Extras Programming Language create a POU in the programming language LD.

LD ) in the instruction part to

A series of language elements like network-structure of the POU, the representation of functions or function blocks are the same in the programming languages LD and FBD. There are language specific differences between LD and FBD on the programming of logical connections of binary operands. All actions for the entering of the program can be selected by the menu Insert in the LD-editor. Actions which are used frequently, are available in the toolbar additionally. You can also use the context menu by click with the right mouse button. Only for some actions you have to use the keyboard when entering the program. The following descriptions for the program in LD creation are based mainly on the use (the menu-actions) of the context menu. At first the basic POU-structure is described, i.e. the network ordering and the structure of a single network will be described. The identification of networks as branch destination, the input of variable names, and the comments will be explained in the further sections. The variable identifier and the branch label get the specification undef_opd automatically. This specification must be replaced by the desired variable identifiers or branch labels.

Arithmetic functions, logical operations, and compare functions can be used by the dialog field Operators from the list field of the POU-editor which you have opened by the menu item Insert Operators... or by the context menu Operators... before. In one network you can use arbitrarily many graphical elements side by side, but only one function block call. The graphics will extend over several pages if necessary. Make a test print and modify the printer adjustments to determine the biggest possible printable area.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

101

4 The POU-Editor

4.5.2 Create the POU in LD


In the Project Manager, select File New POU Program, or File New POU Function Block or File New Function, depending on which type of POU you want to create. A dialog box will be opened prompting you for the name of the POU. Enter the name and press "OK". The POU Editor will be opened on that new POU In addition to the standard tool buttons display also the tool buttons for editing in LDnotation by View LD/FBD-toolbar . Declare the variables, as declared in chapter 4.2, and press the tool-button Use of the LDeditor:

fig. 101: Tool-button Use of the LD-editor

In the menu Insert the following actions are available for the program development:

fig. 102: Accept variable into LD

For an easier program editing, you can also use the buttons of the toolbar:

102

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 103: Button of the tool panel

4.5.2.1 Display and Accept operators


OpenPCS allows you to display a toolbox or a list field with all operators in order to give you an overview of all available operators. The list has the advantage to display operators in groups. From this list or toolbox you can directly insert operators in the instruction part.

Condition: The window of the instruction part is activated. Activate the toolbox by the menu item View Toolbox and click on the corresponding operator for retrieving.

fig. 104: Toolbox of the operators

or alternatively: Select the operator from the list field in the dialog field Operators, which you open by the menu item Insert Operators... or by the context menu Operators.... On the right of the list field, all operators are listed which are available in the first marked group Logic. If you mark another group, the operators, which belong to this group, will be listed. Mark the group and the desired operator and select the button OK . The selected operator will be inserted at the cursor position.

If you need information to the single operators, select the button Help.

Depending on the cursor position or the marked area in the instruction part, the POU-editor offers different actions in the menu Insert of the toolbar or context menu.

4.5.2.2 Create new network


Conditional Operation

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

103

4 The POU-Editor

Select Insert Initial LD Network. In the instruction part appears the first network with a contact and an output symbol. You can get this action by the toolbar or the context menu, too.

fig. 105: Conditioned operation

Unconditional Operation Select the operations JMP or RET from the menu Insert Operators... or the toolbox.

The jump symbol appears in the new network, the element for specification of the branch label is given and can be edited consequently.

fig. 106: LD branch label

Accept by the Enter-key. The window Name element" will be opened, in which you specify the branch label:

fig. 107: Name element: branch label

4.5.2.3 Insert function blocks


Place the cursor at the desired position in the instruction part of your LD-POU. Select the function block from the list of all declared variables which you opened by the menu item Insert Variable All... or the context menu. The option All... cause that in addition to all variables also all declared manufacturer- and user defined function blocks are listed for transmission in the dialog window Insert variable.

104

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 108: Select function block instances

Mark the instance of the desired function block or enter this instance directly into the input-field and accept by button OK. The graphical symbol of the function block appears with all operands as a new network. Name the elements as desired.

4.5.2.4 Insert function


Functions cant be entered into LD-networks. The OpenPCS POU Editor is capable of mixing languages LD and FBD. If a network contains a function, the LD-Editor will display this network in FBD and the rest of the POU in LD. To add a function call, switch to FBD, do so, then switch back to LD.

4.5.2.5 Edit a POU in LD


To modify the POU, you must mark the relevant part of the POU before. You can mark a single, graphical element, several neighbouring elements, a network, or an entire POU. Mark POU-elements A single element can be marked by the mouse pointer, the arrow keys, or the tabulator key. To mark several neighbouring elements in a network, you have different possibilities: Press the shift key and use the mouse to mark elements. Press the shift key and use the cursor keys to mark elements Drag a rubber band around the network region using the mouse

To mark a complete network, select with the mouse pointer the square marker which is directly visible at the left screen border below the network. To mark several networks, first click on one network marker, then press shift and select another network marker. To mark the entire POU, select Edit Select All .

Delete a network Mark the network that you want to delete.


1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

105

4 The POU-Editor

Use delete key DEL" or Edit The marked network will be deleted.

Delete from the menu Edit or the context menu.

4.5.2.6 Mark a network as branch label


A network can be marked as a branch label for a branch operation which is programmed in another network. Place the cursor into the network which you want to mark as branch label. Select Insert Network-Label. Dialog Network-Label will be opened:

fig. 109: LD - Network-Label

Enter the name of the branch label into the cell and accept by the OK-button. The name of the branch label appears in the network header of the marked network:

fig. 110: LD-network with branch label

106

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.5.2.7 Edit logical operation


A LD-initial-network consists of a contact and an termination symbol. In this network you can insert and edit logical operations.

4.5.2.8 Insert of an AND-operation


Mark the horizontal line where the new contact should be inserted.

fig. 111: Place for insertion is marked

Use the space key. A contact will be inserted. The AND-Operator can be picked from the toolbox or from dialog Insert Operators... or from the context menu.

fig. 112: AND-operation inserted

4.5.2.9 Insert of an OR-operation


Mark the contact or the network region to which a parallel contact should be created.

fig. 113: An Input is marked to which a parallel contact should be created

Select the OR-Operator from the toolbox or the list field Operators which you open by the menu item Insert Operators... or the context menu. A new contact will be inserted parallel to the marked region.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

107

4 The POU-Editor

fig. 114: Parallel contact inserted

4.5.2.10 Insert of a conditional termination


Mark the horizontal line directly in front of or after a termination symbol.

fig. 115: Position of inserting a new termination is marked: Termination is inserted under Output_1

Select the desired conditional operation: ST, STN, S, R, JMPC, JMPCN, RETC or RETCN from the toolbox or the list field Operators which you open before by the menu item Insert Operators... or the context menu. The corresponding graphical symbol appears above (marker in front of the output symbol) or below (marker after the output symbol) the existing output symbol.

fig. 116: List of branch operators

You can also mark the horizontal line directly in front of the Output_2 and after that insert the conditioned operation. 108
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 117: New output above Output_2 inserted

4.5.2.11 Modify an expression


If you have an expression consisting of a mixture of AND and OR expressions, you can modify that expression by inserting or removing a vertical connection between parallel rungs.

Add vertical line To add a vertical connection, first mark the two ending points of the vertical line: Use the mouse or the arrow keys to mark the first ending point. Press and hold the CTRL-Key, then mark the second ending point (mouse or keyboard). Release the CTRL-Key.

fig. 118: Connecting ending points are marked

Hit the Spacebar to have the vertical connection inserted:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

109

4 The POU-Editor

fig. 119: Vertical connection was inserted

Delete vertical line Mark the vertical line that you want to delete.

fig. 120: Deleting connection is marked

Use the "DEL" key or "Edit Delete". The marked line will be deleted, the OR-before-AND-operation turned into an AND-before-OR-operation:

fig. 121: Connection is deleted

4.5.2.12 Negate a contact or an output


You can only negate one single element at a time. Mark the element to be negated.

fig. 122: The element, which is to negate, is marked

Hit the spacebar. The marked element will be negated. You can also carry out this action by the toolbar or the toolbox.

110

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 123: Element was negated

4.5.2.13 Delete elements


You can delete a single element or a group of neighbouring elements. The Editor will take care that the elements remaining after the delete are legal LD or FBD networks. If you want to delete multiple elements in mixed AND/OR-operations, the POU-editor allows only such groupings of elements that lead to a useful network content that means after the deleting at least one valid initial network must remain. In networks with conditional branch operations, e.g., JMPCN or RETC, the entire logical operation can be deleted. An unconditioned operation, JMP or RET, remains in the network. In networks with conditioned assignments, ST, STN, S and R, at least one contact must remain after the deleting. When deleting output symbols, at least one output must remain.

4.5.2.14 Name elements


When you insert operations, the operand is always given the name undef_opd. You have to name the elements properly. When invoking function block instances, you pass values by naming the inputs and outputs of the function block appropriately. Mark the element you want to name.

fig. 124: The element, which is to name, is marked

Hit the Enter key. The dialog field Name element will be opened:

fig. 125: Name LD - Element

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

111

4 The POU-Editor

or Select the variable from the list of all declared variables which you open before by the menu item Insert Variable All... or the context menu.

4.5.2.15 Name a label


A jump instruction, like most other operations, has to be completed by entering the label to be used as the jump target. Mark the jump instruction for which you want to define a label.

fig. 126: The jump instruction, which is to define, is marked

Hit the Enter key. This action is also available in the menu Insert Name Element... .

The dialog field Name Element" will be opened:

fig. 127: Name LD - Element as label

Enter the name of the branch destination and hit the OK"-button.

fig. 128: Jump operation is defined

112

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.5.2.16 Enter a network-comment


Each network can have a comment. Have the cursor positioned in the network to be commented. Select Insert Network-comment... . The dialog field Network-comment" will be opened:

fig. 129: Enter LD - network-comment

Enter the comment, then press OK". The entered comment appears in the network heading below the network number.

fig. 130: Network-comment is inserted

4.5.2.17 Create function blocks in LD


In the Project Manager, select File New POU Function Block

A dialog box will be opened prompting you for the name of the POU. Enter the name and press "OK". The POU Editor will be opened on that new POU

For the creation of function blocks in LD the same rules are valid as on the creation of a program.

4.5.2.18 Create functions in LD


In the Project Manager, select File New Function

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

113

4 The POU-Editor

A dialog box will be opened prompting you for the name of the POU. Enter the name and press "OK". The POU Editor will be opened on that new POU

For the creation of functions in LD the same rules are valid as on the creation of a program.

4.6 The instruction part on programming in FBD


4.6.1 Overview
The programming language Function Block Diagram (FBD) has its origin in the domain of signal processing. The instruction part is subdivided into networks like in LD before. The single programming elements are represented by means of graphical circuit symbols. These graphics give the POU a structure. Operators, functions, and function blocks are represented as square symbols with connection points for the inputs of the left side and connection points for the outputs on the right side. The connection points are parameters (variables/constants) or other inputs or outputs. First, these are set to undef_opd. Inside a network, several operators and functions can be combined in arbitrary order. A function block invocation represents a network on its own, no further program components can be added. The function block can have multiple inputs and outputs. A function has only one output and several inputs. If you create a user defined function block, the inputs and outputs on the block symbol are displayed in the order in which they were declared in the variable-editor of this function blocks.

FBD-networks consist of the graphical objects: Network label, Network comment, and Network graphic,

which will be explained in the following.

114

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.6.1.1 Network label


Each network, which another network should jump to, starts with an alphanumeric identifier that is used as a jump label.

fig. 131: Network-Label

4.6.1.2 Network comment


Between network label and network graphic, a network comment can be inserted.

fig. 132: Network-comment

4.6.1.3 Network graphic


The network graphic consists of graphical elements (rectangular symbols) with connection points for the input on the left side and for the output on the right side. The signal processing is realised through these connection points. Outputs of one rectangle and the outputs of different rectangles mustnt be combined, because the source of transferred data is not unique. The data flow can only happen from one output or one variable/constant to one or more inputs of the following rectangle.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

115

4 The POU-Editor

fig. 133: Network-graphic

The variable declaration is done by the variable-editor which is used in each programming language. The complete description of the variable declaration can be found in section 4.2. The programming languages IL, LD, and FBD can be compiled among each other. Therefore, you can create a program in LD-style and represent or edit further this program in IL- or FBDstyle afterwards. In addition, some conditions should be noted which are described in section 4.8. Activate the POU-editor FBD (Extras Programming Language part for creation of a POU in the programming language FBD. FBD ) in the instruction

A series of language elements like network-structure of the POU, the representation of functions or function blocks are the same in the programming languages LD and FBD. There are language specific differences between LD and FBD on the programming of logical connections of binary operands. All actions for the entering of the program can be select by the menu Insert in the FBD-editor. Actions, which are used frequently, are available in the toolbar additionally. For a faster entering on the programming of your POU you can also use the context menu by click with the right mouse button. Only for some actions you have to use the keyboard when entering the program. The following descriptions for the program in FBD creation are based mainly on the use (the menu-actions) of the context menu. The principle POU-structure is described in the programming hints, i.e. the structure of a single network will be described. The identification of networks as branch destination, the input of variable names, and the comments will be explained in the further sections.

Arithmetic functions, logical operations, and compare functions can be called by the dialog field Operators from the list field of the POU-editor which you have opened by the menu item Insert Operators... or by the context menu Operators... before.

4.6.2 Create a POU in FBD


In the Project Manager, select File New POU Program, or File New POU Function Block or File New Function, depending on which type of POU you want to create.

116

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

A dialog box will be opened prompting you for the name of the POU. Enter the name and press "OK". The POU Editor will be opened on that new POU In addition to the standard tool buttons display also the tool buttons for editing in LDnotation by View LD/FBD-toolbar .

fig. 134: LD/FBD-toolbar

Declare the variables, as declared in chapter 4.2, and press the tool-button Use of the FBDeditor:

fig. 135: Tool-button Use of the FBD-editor

In the menu Insert the following actions are available for the program development:

fig. 136: FBD Accept variable

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

117

4 The POU-Editor

4.6.2.1 Operators
OpenPCS allows you to display a toolbox or a list field with all operators in order to give you an overview of all available operators. The list has the advantage to display the operators thematically ordered. From this list or toolbox you can directly Accept a required operator into your POU.

Condition: The window of the instruction part is activated.

Activate the toolbox by the menu item View Toolbox and click on the corresponding operator for retrieving.

fig. 137: The toolbox

or alternatively: Select the Operator from the list field in the dialog field Operators, which you open by the menu item Insert Operators... or by the context menu Operators.... On the right of the list field, all operators are listed which are available in the first marked group Logic. If you mark another group, the operators, which belong to this group, will be listed.

fig. 138: Insert operator

Mark the group and the desired operator and select the button OK . The selected operator will be inserted at the cursor position.

118

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

If you need information on any operator, select the button Help.

Depending on the cursor position or the marked area in the instruction part, the POU-editor offers different actions in the menu Insert of the tool panel or context menu.

4.6.2.2 Create new network


Conditional Operation Select Insert Initial-FBD-Network. In the instruction part appears the first network with a contact and an output symbol.

Unconditional Operation Select the operations JMP or RET from the menu Insert Operators... or the toolbox.

The jump symbol appears in the new network, the element for specification of the branch label is given and can be edited consequently.

fig. 139: FBD branch label

Accept by the Enter-key. The window Name element" appears, in which you enter the branch label.

4.6.2.3 Insert a function block


A function block represents its own network. Place the cursor at the desired position in the instruction part of your FBD-POU. Select the function block from the list of all declared variables which you opened by the menu item Insert Variable All... or the context menu. The option All... has the effect that all variables and all manufacturer- and user defined function blocks will be listed for transfer in the dialog box Insert variable.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

119

4 The POU-Editor

fig. 140. Accept declared function block

Mark the instance of the desired function block or enter this instance directly into the inputfield and accept by button OK. The graphical symbol of the function block appears with all operands as a new network. Give the parameters the desired variable identifiers.

fig. 141: Function block inserted

120

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.6.2.4 Insert function


Mark the complete connection line after which a function should be inserted.

fig. 142: Position for insertion is marked

Select the function from a list which you can open by the menu item with Insert Manufacturer/User Functions... or by the context menu.

fig. 143: FBD insert function

Mark the desired function or enter this function directly into the input field and hit the button OK. The graphical symbol of this function will be inserted after the marked position.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

121

4 The POU-Editor

fig. 144: Function ispositive was inserted

If you try to insert a function at a incorrect position, the following error message will be displayed:

fig. 145: FBD Function inserted incorrectly

4.6.2.5 Delete function block or function


Mark the function block or function and hit the deletion key DEL" or Delete by the menu item or the context menu. The marked graphical circuit symbol will be deleted.

4.6.2.6 Edit a POU in FBD


To modify the POU, you must mark the relevant part of the POU first. You can mark a single graphical element, several neighbouring elements, a network, or the entire POU.

4.6.2.7 Mark POU-elements


A single element can be marked by the mouse button, arrow keys, or tabulator key, and in combination with the shift key, too. To mark several neighbouring elements in a network, you have different possibilities: Hold pressed the shift key and select the two border elements by the mouse pointer. Hold pressed the shift key and select the affected elements by the arrow key. Draw a frame around the network region with the mouse pointer. To mark a complete network, select the square marker point by the mouse pointer which is mapped at the left screen side directly below the network. To mark several networks, first click on a marker. Press the shift key and hold it pressed, and select the marker of the above or below situated networks.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

122

4 The POU-Editor

To mark the entire POU, select Edit

Select all .

4.6.2.8 Insert a network


Mark the network marker after which the new network should be inserted. Select from the menu Insert" the desired network content. For selection are: The header of a FBD/LD-networks, function blocks (variables...), a unconditional jump, and a unconditional return.

4.6.2.9 Delete network


A network can be deleted completely. Mark the network to delete, and hit the deletion key DEL or select Edit marked network will be deleted. Delete. The

4.6.2.10 Mark a network as a branch label


A network can be indicated as a branch label for a jump instruction which is programmed in another network. Place the cursor into the network that you want to indicate as branch label. Select Insert Network Label.... The window Network Label appears:

fig. 146: FBD - Network-label

Enter the name of the branch label into the cell and hit the button OK". The branch label name appears in the network-header of the marked network:

fig. 147: Network was provided with a label

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

123

4 The POU-Editor

4.6.2.11 Edit a network


In an existing network you can insert circuit symbols like operators and functions. It is thereby possible to program several operators and functions in arbitrary order. With a function, only the first input of the function can be connected to other functions.

Editing a network in FBD arbitrary operators and functions can be encapsulated even if the data types dont match. The check of data types happens only during the syntax check.

4.6.2.12 Insert a circuit symbol


To insert a circuit symbol, the contact line must be marked behind or in front of an existing circuit symbol. The new circuit symbol will be inserted on the right side of the marked position. Mark the contact line behind which you want to insert a new operator, for example a logical AND-operation.

fig. 148: Position for insertion is marked

Select the operator AND from the toolbox or from the list field Operators which you have opened by the menu item with Insert Operators... or by the context menu.

124

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 149: List of logical operators

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

125

4 The POU-Editor

Hit the button OK. The symbol of the operator appears behind the marked position:

fig. 150: Operand AND was inserted

4.6.2.13 Delete circuit symbol


Marked circuit symbols can be deleted from a network. Deleting a marked operation symbol, only the circuit symbols are retained which are pre-connected on the top input and all following ones. Mark the circuit symbol to delete.

fig. 151: Circuit symbol to delete is marked

Hit the DEL" key or use Edit

Delete. The marked circuit symbol will be deleted.

126

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 152: Circuit symbols and no longer connected circuit symbols were deleted

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

127

4 The POU-Editor

4.6.2.14 Insert input


The number of inputs can only be increased for the logical operation symbols (AND, OR, XOR) and the mathematical operations ADD and MUL. Mark the input behind which you want to insert a new input.

fig. 153: Input, behind which a new input should be inserted, is marked

Select Insert

Additional Input. Behind the marked input a new input will be inserted.

fig. 154: New input was inserted

Should an input be inserted below, the lower input or the circuit symbol can be marked in order to do it.

128

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.6.2.15 Delete input


The number of variables of logical or arithmetic operations with more than two operation variables can be reduced up to two. If the number of inputs is reduced up to one, the complete block will be deleted automatically. Mark the input to delete.

fig. 155: Input to delete is marked

Hit the DEL" key or use Edit

Delete. The marked input will be deleted.

fig. 156: Input was deleted

You can also mark and delete several neighbouring inputs.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

129

4 The POU-Editor

4.6.2.16 Insert output


An output can be inserted above or below an existing output. For boolean outputs you can use the operators ST, STN, S, R, JMPC, JMPCN, RETC, and RETCN, for the other data types only ST. On bit-sequences STN can also be used.

Insert the output at first position Mark the contact line in front of the output symbol.

fig. 157: If the position in front of the output is marked, the new output will be inserted above the existing one

Select the operator from the list field of the dialog field Operators, which you have opened by menu item Insert Operators... or by the context menu Operators.... In the right side of the list field all operators are listed which are available in the currently marked group. Behind them the available operations are arranged into groups: (1) Group Logic" - for boolean outputs: S, R

(2) Group Branching: - for boolean outputs: JMPC, JMPCN, RETC and RETCN

(3) Group Assignment: - for boolean outputs: ST - for the other data types: ST - for bit sequences: STN

Mark the desired operator. The corresponding graphical symbol appears above the existing output. 130
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 158: New output was inserted above the output fault indicator

Insert output behind an existing output Mark the output behind which a new output should be inserted.

fig. 159: If an existing output is marked, the new output will be inserted below the existing one

Select the operator as described above. Mark the desired operator. The corresponding graphical symbol appears below the existing output.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

131

4 The POU-Editor

fig. 160: A new output was inserted under the output fault indicator

4.6.2.17 Delete output


Single and multiple neighbouring outputs can be deleted. On deleting output symbols at least one symbol must be retained. Mark the output region to delete.

fig. 161: The outputs to delete are marked

Hit the DEL" key or use Edit

Delete. The marked output region will be deleted.

132

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 162: The marked outputs was deleted

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

133

4 The POU-Editor

4.6.2.18 Negate input


Inputs, which are assigned boolean data types or bit sequences, can be negated. Mark the input to negate.

fig. 163: The input to negate is marked

Hit the spacebar. The marked input will be negated. You can also carry out this action by the tool panel or the toolbox.

fig. 164: The marked input was negated

134

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.6.2.19 Negate output


All output operations (except S and R) can be negated: Mark the output to negate.

fig. 165: The output to negate is marked

Hit the spacebar. The marked output will be negated. You can also carry out this action by the toolbar or the toolbox.

fig. 166: The marked output was negated

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

135

4 The POU-Editor

4.6.2.20 Name element


When you insert operators or functions, all operands will be set to undef_opd. You should never declare a variable of that name to have the compiler warn you about operands still not properly set. The contacts and outputs must be completed by entering the variable names. The parameter assignment is realised by assignment of the variable names to the single contacts of the functions and function blocks. You can also assign constants (that means values) to the inputs.

Name input Mark the input for which you want to enter a variable name or a constant value. Hit "Enter". The dialog field Name element" will be opened:

fig. 167: Name FBD - element

Enter the variable name directly or by the clipboard, or enter the value of a constant and press OK,

or Select a variable from the list of all declared variables which you have opened before by the menu item with Insert Variable All... or by the context menu.

136

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 168: Insert variable

Name output Mark the output for which you want to enter a variable name. Hit "Enter". The dialog field Name element" will be opened:

fig. 169: Name FBD - element

Enter the variable name and press OK, or Select a variable from the list of all declared variables which you have opened before by the menu item with Insert Variable All... or by the context menu.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

137

4 The POU-Editor

4.6.2.21 Enter a label for a jump instruction


A jump symbol must be completed by definition of the branch destination. Mark the jump symbol for which you want to define a branch destination.

fig. 170: The jump instruction, which is to defined, is marked

Hit "Enter". The action is also available in the menu Insert The dialog field Name element" will be opened: Name element... .

fig. 171: Name FBD - element as branch destination

Enter the name of the branch destination and press OK".

fig. 172: Branch destination was entered

138

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.6.2.22 Enter network-comment


Each network can be completed by a multiple line comment. Place the cursor into the network. Select Insert Network Comment.... The window Network-comment" will be opened:

fig. 173: FBD - network-comment

Enter a comment (the "ENTER"-key will produce a new line) and press OK . The entered comment appears in the network-header below the network number.

fig. 174: Network-comment was inserted

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

139

4 The POU-Editor

4.7 The instruction part in ST


The language ST (Structured Text) is a textual general language similar to the well-known languages like PASCAL and C. Complex expressions and calculation operations can be described clearly as formula; powerful control structures help you to develop complicated logical evaluations. The variable declaration is done by the variable-editor which is used in the other programming languages. The complete description of the variable declaration can be found in section 4.2. In principle its up to you to declare the variables at first or to edit the ST-part at first. You can change between these editors anytime. Note that all variables, which are used in the POU, are declared before the syntax check, otherwise error messages will occur caused by the missing variable declaration. Activate the POU-editor ST (Options Programming Llanguage ST ) in the instruction part for creation of a POU in the programming language ST. In the window of the ST-editor enter the instruction part of your POU. The possible instructions in ST are described in chapter 4.7.2: Instructions in ST.

4.7.1 Create ST-POU


In the Project Manager, select File New POU Program, or File New POU Function Block or File New Function, depending on which type of POU you want to create. A dialog box will be opened prompting you for the name of the POU. Enter the name and press "OK". The POU Editor will be opened on that new POU Declare the variables, as declared in chapter 4.2, and press the tool-button Use of the STeditor, or select Options Programming Language ST

fig. 175: Button for switching to ST

4.7.2 Instructions in ST
Code written in ST is a sequence of ST-instructions. ST-instructions are terminated with a semicolon. Linefeeds are not significant, i.e. more than one instruction can be on one line, and one instruction can use one or more line. The instructions known in ST are: Description Keyword
Assignment Condition := IF

Example
a:=5; IF a<b THEN c:=1; ELSIF a>b THEN c:=2; ELSE c:=3; END_IF;

Multiselection

CASE

CASE n OF 2: p:=4; 3: p:=p+3;

140

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

5..10: p:=100-p*(p-q); ELSE p:= MAX(a,b); END_CASE; Looping WHILE WHILE x > 1 DO y:= y-2; END_WHILE; Looping FOR FOR a:=1 TO 100 BY 2 DO IF a>c THEN b:=a; END_IF; END_FOR; Looping REPEAT REPEAT a:=a+b; UNTIL a<100 END_REPEAT; Terminate Repetition Return to caller Function Block instance call and use of output EXIT RETURN FBName(Parameter_1, Parameter_2 | Parameter_out); EXIT; RETURN; RTC(IN:=1, PT:=T#1996-12-31-00:00:00); A:=RTC.Q;

fig. 176: Instructions in ST

For more description, see the rest of this chapter.

4.7.3 Assignments
An Assignment will assign the result of an expression to a variable. Example

VAR a: INT; b: ARRAY [0..5] OF INT; c: REAL; e: INT; END_VAR a := 5; (* assign 5 to a *) b[1]:= a*2; e := a; (* two assignments *) e:= REAL_TO_INT( c ); (* assignment with function call *)

The assignment instruction will evaluate the expression on the right side and assign the resulting value to the variable given on the left. The type of the variable must match the type of the expression

4.7.4 Conditional instructions


Conditional instructions allow the programmer to execute instructions not on every execution of a program, but only under some condition. We discuss in this context the instruction IF (single instruction) and CASE (multiple instruction).

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

141

4 The POU-Editor

4.7.4.1 IF-instruction
The IF-instruction has following syntax:
IF expression THEN Block { ELSIF expression THEN Block} [ ELSE Block ] END_IF;

If the expression after IF evaluates to true, the instructions given after THEN will be executed. If the expression after IF evaluates to false, the instructions after ELSE will be executed or the ELSEIF-condition will be checked. In any case, execution will then continue with the next instruction after END_IF.

IF Expression THEN Instruction block; ELSIF Expression THEN Instruction block;

Execution of the instruction block only if the expression is true. Execution only if previous expressions are false and this expression is true. This partial instruction can be omitted or repeated arbitrary frequently. Execution only if all previous expressions are false. This ELSE- branch is optional. Closing bracket of the IF-instruction

ELSE Instruction block;

END_IF;

An instruction block represents one or more instructions. Note that every instruction block is finished by a semicolon.

The following IF instruction will compute the maximum of two numbers:


IF a>b THEN maximum := a; ELSE maximum := b; END_IF;

IF instructions may be nested, i.e. the THEN-part as well as the ELSE-part may contain other IF instructions. Example: The following program will again compute the maximum of two numbers, but if this maximum is a and a is greater than 10, it will be reduced by 1:
VAR a: INT :=12; b: INT :=5; maximum: INT;

142

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

END_VAR IF a>b THEN maximum :=a; IF (a>10) THEN a:=a-1; ELSE a:=a+1; END_IF; ELSE maximum :=b; END_IF;

4.7.4.2 CASE-instruction
Though IF instructions may be nested, checking for one of many conditions can look quite complicated using IF. CASE, instead, can check for more than one value with one instruction. The expression of the CASE-instruction is of type INT, and only the instruction will be executed that corresponds to this INT-value. After that the first instruction behind END_CASE will be executed. IF the expression does not match any of the case-values, the first instruction (block) behind the ELSE will be executed. This partial instruction is optional.
CASE expression OF case_value1: { instructions; } case_value2: { instructions; } ... case_valueN: { instructions; } [ ELSE instructions; ] END_CASE;

Example:
VAR number : INT:= 10; amount : INT :=2; END_VAR CASE number OF 10: amount := amount +1; 11: amount := amount -1; ELSE amount := number; END_CASE;

In this example, the value of number will be determined, and if it is equal to 10, amount will be incremented, if it is equal to 11, amount will be decreased. In any other case, amount will be set to equal number.

4.7.5 Repetitions
Repetition instructions, or loops, allow to execute a piece of code not only once, but many times. With ST, there are three types of loops: FOR WHILE REPEAT All repetition instructions have an expression which will control execution and termination of the loop. With WHILE and FOR loops, this condition is checked before execution of the loop, whereas the REPEAT loop does check it after executing the loop instructions. That means the instructions of the REPEAT-repetition will be executed at least one times (independent if the expression is true or not) in opposite to the WHILE-repetition.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

143

4 The POU-Editor

4.7.5.1 WHILE-loop
The WHILE loop will execute the loop body as long as the given expression evaluates to true. Syntax:
WHILE expression DO instructions; END_WHILE;

The expression given after the keyword WHILE will be evaluated before entering the loop. If it is true, the loop body will be executed. This will terminate only when the expression evaluates to false. Example
VAR i : INT := 3; END_VAR WHILE i > 0 DO i:=i-1; END_WHILE;

Initially, i equals 3. 3 is greater than 0, so the expression after WHILE is true and the loop body executed. This will decrement the value of i to 2. 2 is still greater than 0, so the loop body will be executed again. Some time later, the loop body will decrement i from 1 to 0. On the next check, the expression after WHILE will be false, hence the loop body will not be executed again.

4.7.5.2 FOR-loop
With the FOR loop, a loop control variable will be set to a specified starting value, then incremented (or decreased), and the loop will be terminated when a given end value is reached. Use only integral variables for control variables.

The syntax is:


FOR assignment TO Endvalue BY Increment DO Instructions; END_FOR;

Example
VAR Field : ARRAY[1..5] OF INT :=[2,14,8,12,5]; Index : INT; MaxIndex : INT :=5; Maximum : INT :=0; END_VAR FOR Index :=1 TO MaxIndex BY 1 DO IF Field[Index] > Maximum THEN Maximum := Field[Index]; END_IF; END_FOR;

The loop control variable Index will start with 1, and will be incremented BY 1 on each execution of the loop. This will be done until the end value MaxIndex (=5) will be reached. Note: the BY-term is optional and can be omitted. Default then is to increment by 1.

144

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

Execution of the FOR-loop: 1. 2. 3. 4. 5. Initialising of the control variables Check of the termination criterion and termination if necessary. Execution of the instruction block Increase/decrease of the control variable about the step size. Go to step 2.

4.7.5.3 REPEAT-loop
In contrast to the other loop types, REPEAT will check the loop expression after execution of the loop. The syntax is:
REPEAT instructions; UNTIL expression END_REPEAT;

So, the REPEAT loop will always be executed at least once. Example:
VAR i : INT := -1; END_VAR REPEAT i:=i-1; UNTIL i < 0 END_REPEAT; (* now, i = -2 *)

Although i will meet the loop condition from the beginning, the REPEAT loop will be executed once anyway.

4.7.5.4 EXIT
Any of the loops can be left under program control before the loop condition dictates so. The EXIT instruction will jump to the first instruction after the innermost loop. Example:
VAR start: INT :=0; summe: INT :=0; ende : INT := 10; END_VAR FOR Start := 1 TO Ende BY 2 DO Summe := Summe + 1; IF Summe > 4 THEN EXIT; END_IF; END_FOR; (* Will continue here *)

As soon as Summe is greater than 4, the FOR loop will be left.

4.7.6 Cyclic Execution and Structured Text


Applications in a PLC typically are executed in a cyclic manner, i.e. the operating system of your PLC will restart your cyclic application quite soon after it finished. Endless-loops in your application are generally not a proper programming technique, but rather considered a programming error, and a good PLC operating system will terminate such application programs.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

145

4 The POU-Editor

Actively waiting, like the following pseudo-code demonstrates:


FOR n:=1 TO 10 DO Switch on light n Wait one second Switch off light n END_FOR;

is not a good programming technique, because the simple wait would use the entire controller, preventing it from fulfilling more demanding tasks. And, if the PLC uses a process image, like most do, no light would ever be seen on. The use of loops, which wait for events, is forbidden for automation systems according to the IEC 1131-3.

4.7.7 Calling function block instances


Function Block Instances are called by simply writing the name of the function block instance, with the formal parameters assigned actual parameters in parentheses after the instance name. It is not necessary to provide actual values for all formal parameters, all parameters not assigned will keep the value from the previous call, or their default value. Example: Function Block Definition
FUNCTION_BLOCK FB_ABC VAR_INPUT x: INT:=1; (* one input *) END_VAR VAR_OUTPUT y: INT:=4; (* one output *) END_VAR IF (x >2) THEN (* some logic *) y :=5; END_IF; END_FUNKTION_BLOCK

Declaration of an instance of this FB type:


VAR FBName: FB_ABC; END_VAR

Calling this instance FBName(); (* FBName.y equals 4 *) FBName(x :=3); (* FBName.y equals 5 *)

4.7.8 RETURN
The RETURN instruction will cause the current POU to be left, transferring control back to the caller of the current POU. Note that on working with functions, the function value (variable with the name of the function) must be assigned. If output values of function blocks arent assigned by local values of the function block, they have the predefined values of their data types. Example:
IF a<b THEN RETURN; END_IF;

146

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

4.7.9 Expressions and operators


Operands known in ST are: Literal variables, e.g. 14, abc, t#3d_5h Variables, e.g.: Var1, Var[2,3] Function Call, e.g.: Max(a,b) While operators are parts of ST-language, expressions are constructions which must be constructed by aid of ST-elements. Operators need operands to build expressions. Operators known in ST are:

Parentheses function call Exponentiation Negation Complement Multiplication Division Modulo Addition Subtraction Comparison Equality Inequality boolean AND boolean exclusive OR boolean OR

() ** NOT * / MOD + <, >, <=, >= = <> &, AND XOR OR

fig. 177: List of operators

4.7.10 Function call as operator


Functions are invoked with the parameters specified in a comma separated list, enclosed in parentheses. The return value of the function will be used as the value of the function in evaluating it. A function shall always return the same value when given the same input values. Therefore a function cant have a memory in opposite to a function block. Functions are regarded as expressions. In OpenPCS, predefined functions (standard functions) and user-defined functions can be used. Example: m:= MAXIMUM(x,y); with the following definition of MAXIMUM
FUNCTION MAXIMUM : INT VAR x, y, z: INT; END_VAR IF x > y THEN z:= x; ELSE z:=y; END_IF; MAXIMUM :=z; END_FUNCTION

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

147

4 The POU-Editor

4.7.11 Comments
Like all modern programming languages, ST supports comments. A comment is any text included between (* and *), e.g. (* Comments are helpful *) The compiler will ignore comments when generating executable code, so your program will not accelerate in any way if you omit comments. Comments may span multiple lines, e.g. (* This comment is long and needs more than one line *)

4.7.12 Input helps 4.7.12.1 Calling function block instances


To get a list of all defined function blocks: Select Insert Variable All... . A window will be opened in which all declared variables are displayed:

fig. 178: Dialog box manufacturer function block

Mark the name of a function block instance Close the dialog box with OK.

4.7.12.2 Calling functions


We will use two standard functions, namely BYTE_TO_INT and INT_TO_BYTE. You may enter these by keying in their names as part of the ST program, or use the following procedure: Place the cursor where you want to enter the call to the function 148
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

Select Insert

Manufacturer functions. The dialog box functions will be shown:

fig. 179: Dialog box manufacturer function

Select the function, e.g. INT_TO_BYTE and press OK. The function call will be inserted at the current cursor position. Enter the opening parenthesis (.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

149

4 The POU-Editor

4.8 Switching Programming Languages


Languages IL, LD, and FBD are mutually compatible and cross-compileable into each other with OpenPCS as far as technically feasible. You can switch from the ST-language to other languages and back again if the POU isnt modify in the other languages. A switch to ST of POUs, which are created in IL, LD, or FBD, is not supported. The switchover is done by: Select Extras Programming Language Or Select the language of your choice by the tool-button of the standard toolbar. AWL/FBD/LD/ST

fig. 180: Tool-button for switchover the programming language

The instruction part of the POU appears in the selected programming languages. If you start in instruction list, it is quite easy and common to create sequences that will not properly be understood by the LD/FBD Editor. Such sequences will be represented by a special comment network cannot be displayed graphically, plus the original instruction list text. You cannot edit these parts of your POU in LD/FBD, but the contents will be kept, so you may modify other parts. The corresponding instructions are represented in IL.

fig. 181: POU-part cant be displayed graphically

To work around restrictions in cross-compiling from IL to LD and FBD, see the following chapters.

4.8.1 Conditional function block call


LD/FBD cannot display conditional calls. Example:
VAR Counter_3 : CTU; PutInContainer, sensor, RES_key, full : BOOL; END_VAR (* Conditional call to Counter-Block "PutInContainer" runs *) LD PutInContainer CALC Counter_3( CU := sensor, RESET := RES_key, PV := 120

150

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

| full := Q, := CV )

After switching to language LD or FBD, this will be displayed as:

Solution Replace the conditional call by a conditional jump over an unconditional call
VAR Counter_3 : CTU; PutInContainer, sensor, RES_key, full : BOOL; END_VAR LDN PutInContainer JMPC Label_4 CAL Counter_3( CU := sensor, RESET := RES_key, PV := 120 | full := Q, := CV ) Label_4:

After switching to language LD or FBD, this will be displayed as:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

151

4 The POU-Editor

4.8.2 Intermediate Stores


In IL, you may used Store-Instructions in the middle of an expression to keep intermediate results: Example
(* AND before OR-operation, only in IL representable*) LD var1 OR ( var2 AND var3 ST AND_result ) OR var4 ST OR_result

After switching to LD or FBD, this will be displayed as

152

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

Solution
(* AND before OR-operation, LD/FBD kompatibel, part1 *) LD var2 AND var3 ST AND_result (* AND before OR-operation, LD/FBD kompatibel, part2 *) LD var1 OR AND_result OR var4 ST OR_result

After switching to FBD, this will be displayed as:

4.8.3 Line comments


In Instruction List, comments are possible on each line, while in LD and FBD, comments are only possible for networks. When switching to LD or FBD, the comments of all instructions of a network will be displayed as the comment of the network. When switching back to instruction list, the comments will no longer be associated with the individual lines. Example
(* Counting the produced items *) CAL Counter_4( (* Instance of the Function Block CTD *) CD := part, (* Impulse of a sensor *) LOAD := Setkey, PV := 50 (* number of items in one box *) | leer := Q, (* Counter completed, i.e. box full *) := CV )

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

153

4 The POU-Editor

After switching to FBD, this will be displayed as:

After switching back to instruction list, it will look like:

4.9 Editor for global types


Complex type-declarations, e.g., structures which you want to use for several POUs inside the entire project, can be declared very easy in a separate editor. This one will be opened if you edit a global type declaration in the project browser. Type-declaration can be constructed from derived or elementary data types. They are declared inside the keywords TYPE...END_ TYPE.

154

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 182: Global user-defined data types

Deviating from the derived data types, which you create as variable-section TYPE for the POUtypes Program and Function block and which are only valid inside the particular POU, the constructed data types are global here, and so these data types are valid for the whole project.

4.10 Syntax check and error correction


Select from the toolbar the button tion key combination Alt+F10. , in the menu File Syntaxcheck, or press the func-

If the POU can be compiled without error, you receive the message No syntax error occurred in the status line at the lower border of the window after the finished syntax check.

If syntax errors are found, the window Error messages will be opened:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

155

4 The POU-Editor

fig. 183: Syntax check with error message

An entry in a line indicates if an error was found in the instruction section or declaration section. The line- and column-number of the error, name and path of the POU, and a short description of the error can be found behind this entry. The maximum of 25 errors will be listed, so after elimination of the first errors, new error messages can eventually be displayed. Correct the errors in increasing order of the lines. The faulty position in the IL-editor will be displayed by double click on the error message. The cursor appears in the faulty program line. If you need help, mark an error message and press the F1-key. The POU will automatically be saved, when you start a syntax check.

4.11 Create cross-reference list


In order to keep the overview over your variables, a cross-reference list can be displayed. Crossreference: Select File

156

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 184: Cross-reference list

4.12 Edit POU


In the menu Edit the following items are available for program editing:

Select Edit Undo if you want to represent the POU in its original manner so you can undo the last modifications. Select Edit Select Edit Cut if you want to cut out a text from the POU and put it into the clipboard. Copy if you want to put a copy of a text into the clipboard.

Place the mouse pointer to the position at which you want to insert the content of the clipboard. Then select Edit Paste. Select Edit Select Edit Select Edit Select Edit Select Edit Select Edit Select Edit Delete to delete marked regions. Select All to mark the whole contents of the particular editor. Find... to search for a definite character string. Find Next to search once more for a definite character string. Replace... to replace a found character string by another one. Find Variable... to search for a variable. Goto... to jump to a definite line.

fig. 185:Take the cursor to a definite line

4.13 Save POU


Use File Save to save the modified contents of a POU.

4.14 Change POU-Type


Use this option if the content of an existing POU is used in a new POU of other type (program, function, or function block), or if you have selected the wrong POU-type on creation of the POU. On changing the POU-type a part of the variable declaration can be lost. The variablesections which arent available in the new POU-type (e.g., input- or output-variables of the POU-type program) are deleted. The IL-part will be accepted unchanged. Select File Convert POU type. In the opening list field, where the current POU-type is marked, select one of the two others POU-types, and the change will be executed. In the header of the POU the new POU-type will be displayed.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

157

4 The POU-Editor

fig. 186: Change POU-Type

Switchover the variable editor with Extras Variable Editor Free-Mode to view the entire declaration part with all variable-sections. Check the declaration and instruction part of your POU.

You can also use this option to change the return-value of a POU of type function into another return-value.

Select File Convert POU type. In the opening list field, where the POU-type function is marked by a hook, select function type. The dialog field Function type will be opened, where you can enter the new function type and press the OK"-button for confirmation. The change of the return-value will be executed and immediately be displayed in the title line of the POU-editor.

fig. 187: Change function type

4.15 Printing
4.15.1 Print a POU
Select File Print,

The dialog field Print" will be opened:

158

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

4 The POU-Editor

fig. 188: Dialog field Print

Select the button OK". Afterward the print will be sent to the printer.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

159

5 ControlX Editor

5 ControlX Editor 5.1 Survey


5.1.1 The standard IEC-61131-3
The norm IEC 61131-3 consists of five parts. It specifies requirements for modern PCS systems regarding the PCS hardware and the programming system. The norm comprises as well established concepts of traditional PCS programming as improvements and new programming methods. The IEC 61131-3 is thought of as a guideline of PCS programming and is accepted by most PCS manufacturers. The norm was set up by the commission SC65B WG7 (initially SC65A WG6) of the International Electrotechnical Commission (IEC) consisting of representatives of different PCS manufacturers, software companies and users.

5.1.2 General Information


The ControlX Edit Framework consists of two independent windows. The first window is divided into the variable editor in the upper section and the instruction editor in the lower section. The instruction editor may me one of several available editors, as the ladder diagram editor or the SFC editor. The second window is the output window. Further information: Overview Working with the ControlX Editor Framework General Information on Ladder Logic Variable Editor Ladder Editor Output - Window

5.1.3 Components 5.1.3.1 Output Window


The output window is a part of the ControlX editor framework. It displays the results of the syntax check. Further information: General Information Presentation Function of the Output Window

160

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.1.3.2 Variable Editor


The variable editor is a part of the ControlX editor framework which enables you to insert language elements of the language you are working with. You can work in the "free variable editor mode". Further information: General Information Introduction Available variable types Declarations

5.1.3.3 Instruction Editor


5.1.3.3.1 Ladder Editor
The Ladder Editor serves for creating ladder diagrams. The framework consists of two windows. The first window is split and consists of the variable editor above the separation line and the instruction section below it. The second window is the output window, where output information will be displayed. Example:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

161

5 ControlX Editor

Further information: General Information General Information on Ladder Logic Variable Editor Output - Window Ladder Diagram

5.1.3.3.2 SFC Editor


The framework consists of two windows. Using the SFC Editor you can create SFC diagrams. The first window is split and consists of the variable editor above the separation line and the instruction section below it. The second window is the output window, where output information will be displayed Further informations: General Information Elemente der Ablaufsprache Variable Editor Output - Window SFC (AS)

5.2 Output Window


5.2.1 Presentation
The framework consists of two windows. The first window is split and consists of the variable editor above the separation line and the instruction section below it. The output window is placed in the lower part of the ControlX Editor framework, in the second window which could be switched on or off with the commands of the menu view.

162

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

Presentation of the output window in the ControlX Editor framework (Example.: Program for coordinating the arm of a robot) Further information: General Information Ladder Editor Function of the Output Window

5.2.2 Function of the Output Window


The function of the output window is to display the results of the Syntax check. This comprises every encountered error with the exact error position within the program code. You can click on any error message to mark the corresponding code fragement within the program editor (this may be within the declaration section or the instruction section of the ControlX editor framework). The last output line of the output window is always the report of the total of errors.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

163

5 ControlX Editor

Example: Program for controlling a roboter arm with one syntax error within the instruction section. The error position is the variable identifier of the first contact of the first network. This variable has been declared as "grundstellung" but is referred to as "rundstellung". You can click on the error message in order to mark the contact and easily correct the error. Further information: General Information Ladder Editor Presentation

164

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.3 Variable Editor


5.3.1 Introduction
The variable editor is a part of the ControlX editor framework, just as the instruction editor and the output window.

Variable editor in the "free mode". The "free mode" of the variable editor is suitable for skilled programmers, who are familiar with variable declarations. The "free mode" is a fast tool for declaring variables. Note that every declaration must be syntactically correct. Error messages will not be displayed before the syntax check. In the "free mode", the variable editor displays all variable blocks at the same time. This gives you a better overview of all declared variables. Further information: General Information Available variable types Declarations

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

165

5 ControlX Editor

5.3.2 Available variable types


There are certain restrictions on the variable types you may use in the three different POU types. There is only one variable type that may be used more than once.

Further information: General Information Introduction Declarations

5.3.3 Declarations
In the "free mode", variables of each type have to be declared within a separate declaration block. It is advisable to separate the different components of a declaration line with tabs. Each declaration block is introduced and closed with a certain key word, e.g. VAR and END_VAR for local variables. Note that the declaration blocks have to follow in this order:

1.) VAR_INPUT 2.) VAR_IN_OUT

3.) VAR_OUTPUT 4.) VAR_GLOBAL

5.) VAR_EXTERNAL 6.) TYPE

6.) VAR

The key words that introduce and close the variable blocks is displayed in blue color. You should add comments to each declaration line. A comment begins with an opening 166
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

bracket and an asteriks "(*" and ends with an asteriks and a closing bracket "*)". Comments are displayed in green color.

Note that there is no syntax check during input. Errors wll not be displayed before the Syntax check of the entire program.

Further information: General Information Introduction Available variable types

5.4 Menus
5.4.1 Basic Commands 5.4.1.1 Restore
Use this command to restore size and position of the active window to the size it has been before using the commands maximize or minimize.

5.4.1.2 Move
Use this command to produce a fourfold arrow, with whom you can move of the active window or by pressing the buttons of direction.

Note: This command is not available if the window is shown full sized. Shortcut: Keyboard:

STRG+F7

5.4.1.3 Change Size


Use this command to produce a fourfold arrow, with whom you can change the size of the active window or dialogue-field by pressing the buttons of direction.

After producing the fourfold arrow: Press one of the buttons of direction in order to move the pointer to the border you want to change. Press one of the buttons of direction for moving the frame. Press Enter when the window has the right size.

Note: This command is not available if the window is shown full sized.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

167

5 ControlX Editor

Shortcut: Mouse: Drag the frames in the corners or borders of the window to the right size.

5.4.1.4 Minimize (Basic Commands)


Use this command to minimize the window of the editor to an icon. Shortcut: Mouse: Keyboard:

Press on the symbol for minimize in the title-bar. ALT+F9

5.4.1.5 Maximize (Basic Commands)


Use this command to enlarge the window to the largest possible extension. Shortcut: Mouse: Press on the symbol for minimize in the title-bar or double-click on the title-bar. Keyboard: STRG+F10 enlarges one program-window.

5.4.1.6 Close (Basic Commands)


Use this command to close the active window or dialogue-field. Note: If there is more than one window open, this command will close only a single window. If you want to close all windows you can use the command Close out of the menu File.

Shortcut: Keyboard:

STRG+F4 closes one program-window.

5.4.1.7 Next (Basic Commands)


Use this command for switching to the next open program-window. The ContolX Editor will switch the windows in the sequence you opened them.

Shortcut: Keyboard:

STRG+F6

168

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.2 Menus in the SFC Editor 5.4.2.1 Survey of menus (SFC Editor)
File Menu Edit Menu Insert Menu View Menu Window Menu Online Menu Help Menu

5.4.2.2 Commands "File" Menu


5.4.2.2.1 Commands "File" Menu (SFC)
The File menu contains the following commands: Close Save Print Page Setup Print Preview Exit Closes an open SFC-program Saves changes of an open SFC-program Prints the current SFC-program Displays the Page Setup dialog, so you can set the margins Allows you to see a preview of your printed file Closes the SFC-Editor

5.4.2.2.2 Close (File Menu / SFC)


Use this command to close all windows which contains the current SFC-program. The SFCEditor proposes to save your changes. If you close an program without saving your changes since the last saving will be lost. You can also use the close-symbol in the toolbar to close your SFC-program, like it is shown in the following picture:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

169

5 ControlX Editor

5.4.2.2.3 Save (File Menu / SFC)


Use this command to save your current SFC-program. It will be stored with its original name and path. Shortcut: Toolbar: Keyboard: STRG+S

5.4.2.2.4 Print (File Menu)


Use this command to print a document. In case you activate this command a dialog appears in which you can make statements about the side area, which should be printed, the number of copies, the printer and other options about the printer setup. Shortcut: Toolbar: Keyboard: STRG+P

5.4.2.2.5 Page Setup (File Menu)


Use this command to set the margins for your printout.

170

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

In the area Paper you can arrange the format as well as the source of the used paper. In the area Margins you can fit the margins of your document. The textfield Top provides a space for you to specify the width of the top margin on every printed page. The Textfiled Bottom provides a space for you to specify the width of the bottom margin on every printed page. The distance between header/footer and the respective margin is fix. In the area Ausrichtung you can choose whether the paper shoulb be printed in the upright format or the horizontal format.

5.4.2.2.6 Print Preview (File Menu / SFC)


Use this command to show your current document, how it would look printed. If you choose this command, the main window will be hided by a side-view-window, where you can decide whether one ot two pages should be shown in this window. Furthermore you can move through the text, you can reduce or enlarge the view or you can start to print.

5.4.2.2.7 Exit (File Menu)


Use this command to finish your session. You can also choose the command Close from your System menu. The Editor asks you to save programs with unsaved changes. Shortcut: Mouse:

Doupleclick on the system menu of the application

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

171

5 ControlX Editor

Keyboard:

ALT+F4

5.4.2.3 Commands "Edit" Menu


5.4.2.3.1 Commands "Edit" Menu (SFC)
The Edit Menu contains the following commands: Undo Redo Allows you to reverse changes Macht die letzte Rckgngig-Aktion wieder rckgngig Deletes the selected item and places it on the clipboard Copies the selected item and places it on the clipboard Replaces the selected item with data from the clipboard Adds the data from the clipboard left beside the selected item. Adds the data from the clipboard right beside the selected item. Deletes the selected item Verschiebt den Alternativzweig nach links Verschiebt den Alternativzweig nach rechts Suchen von Codefragmenten zur Fehlerbeseitigung anhand von Textstellen Suchen von Codefragmenten zur Fehlerbeseitigung anhand der Zeilennummern Selects all items Editieren des Codes eines bestimmten SFCElementes Allows you to edit the properties of SFC-elements

Cut

Copy

Paste / Replace

Paste / Add Left

Paste / Add Right

Delete Move Left Move Right Search Go to AWL row Select All Edit

Properties

172

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.2.3.2 Undo (Edit Menu)


Use this command to reverse (undo) your last change.

Shortcut: Toolbar: Keyboard: STRG+Z oder ALT-RCKTASTE

5.4.2.3.3 Redo (Edit Menu)


Use this command to reverse the last Undo command. Shortcut: Toolbar: Keyboard: STRG+Y

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

173

5 ControlX Editor

5.4.2.3.4 Cut (Edit Menu)


By using this command you delete the selected items and place a copy of them in the clipboard. In the case that no items are marked or the action would have an unauthorized condition as effect you can not use this command. In the clipboard are allways the items from the last use of cut or copy. Shortcut: Toolbar: Keyboard: STRG+X

5.4.2.3.5 Copy (Edit Menu)


By using this command you copy the selected items to the clipboard. In the case no items are marked you can not use this command. In the clipboard are allways the items from the last use of cut or copy. Shortcut: Toolbar: Keyboard: STRG+C

5.4.2.3.6 Paste / Replace (Edit Menu)


Use this command to replace the selected items with a copy from the data from the clipboard. In the case that the clipboard is empty or the action would have an unauthorized condition as effect you can not use this command. Shortcut: Toolbar: Keyboard: STRG+V

5.4.2.3.7 Paste / Add Left (Edit Menu / SFC)


Use this command to add a copy of the clipboard left beside the selected items. In the case that the clipboard is empty or the action would have an unauthorized condition as effect you can not use this command. Shortcut: Keyboard:

STRG+L

174

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.2.3.8 Paste / Add right (Edit Menu / SFC)


Use this command to add a copy of the clipboard right beside the selected items. In the case that the clipboard is empty or the action would have an invalide condition as effect you can not use this command. Shortcut: Keyboard:

STRG+R

5.4.2.3.9 Delete (Edit Menu)


Use this command to delete the selected items. In case deleting will have an invalide condition of data as effect you can not use this command. Shortcut: Keyboard:

ENTF

5.4.2.3.10 Move Left (Edit Menu / SFC)


Verwenden Sie diesen Befehl, um den markierten Alternativzweig nach links zu verschieben. Damit ist es mglich, die Abarbeitungsprioritt der einzelnen Alternativzweige zu ndern. Der verschobene Zweig erhht durch diese Operation seine Abarbeitungsprioritt. Shortcut: Keyboard:

ALT+L

5.4.2.3.11 Move Right (Edit Menu / SFC)


Verwenden Sie diesen Befehl, um den markierten Alternativzweig nach rechts zu verschieben. Damit ist es mglich, die Abarbeitungsprioritt der einzelnen Alternativzweige zu ndern. Der verschobene Zweig vermindert durch diese Operation seine Abarbeitungsprioritt. Shortcut: Keyboard:

ALT+R

5.4.2.3.12 Search (Edit Menu)


Use this command to search for a textposition inside the plan. You will see the result in the output window. With an double click on the result, you approach to the editor window of the respective transition. Notice that you have to save your plan before you can search inside it.

Shortcut:
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

175

5 ControlX Editor

Keyboard:

STRG+Q

5.4.2.3.13 Go To AWL-row (Edit Menu / SFC)


Use this command to Verwenden Sie diesen Befehl, um anhand einer Nummer einer fehlerhaften Zeile in der erzeugten POE-Datei das entsprechende Codefragment im SFC-Plan zu finden. Die Nummer einer fehlerhaften Zeile wird beim Compilieren im OpenPCS-System protokolliert. Weitere Hinweise sind unter Fehlersuche zu finden. Shortcut: Keyboard:

STRG+F

5.4.2.3.14 Select All (Edit Menu)


Use this command to select all items. Shortcut: Keyboard:

STRG+A

5.4.2.3.15 Edit (Edit Menu / SFC)


Use this command to edit all marked elements Verwenden Sie diesen Befehl, um den Quellcode des markierten Elementes zu editieren. Shortcut: Keyboard:

RETURN

5.4.2.3.16 Properties (Edit Menu / SFC)


Verwenden Sie diesen Befehl, um die Eigenschaften des markierten Elementes zu ndern. Shortcut: Keyboard:

ALT+RETURN

5.4.2.4 Commands "Insert" Menu


5.4.2.4.1 Commands "Insert" Menu (SFC)

176

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

The Insert Menu contains the following commands: Insert Step/Transition Ersetzt die Markierung mit einer Transitions-Schrittfolge Fgt links zur Markierung einen Schritt oder eine Transition an Fgt rechts zur Markierung einen Schritt oder eine Transition an Ersetzt die Markierung mit einem Sprung

Add Step/Transition Left

Add Step/Transition Right

Jump

5.4.2.4.2 Insert Step/Transition (Insert Menu / SFC)


Verwenden Sie den Befehl, um die aktuelle Markierung mit einem Transition - Schritt Paar zu ersetzen. Die notwendige Reihenfolge wird dabei automatisch bestimmt. Dieser Befehl steht nicht zur Verfgung, falls das Ersetzen zu einem ungltigen Zustand der Daten fhrt. Shortcut: Keyboard: STRG+ALT+S

5.4.2.4.2.1

5.4.2.4.3 Add Step/Transition Left (Insert Menu / SFC)


Verwenden Sie den Befehl, um links an die aktuelle Markierung einen Schritt oder eine Transition anzufgen. Dieser Befehl steht nicht zur Verfgung, falls das Anfgen zu einem ungltigen Zustand der Daten fhrt. Shortcut: Keyboard:

STRG+ALT+L

5.4.2.4.4 Add Step/Transition Right (Insert Menu / SFC)


Verwenden Sie den Befehl, um rechts an die aktuelle Markierung einen Schritt oder eine Transition anzufgen. Dieser Befehl steht nicht zur Verfgung, falls das Anfgen zu einem ungltigen Zustand der Daten fhrt. Shortcut: Keyboard: 5.4.2.4.4.1

STRG+ALT+R

5.4.2.4.5 Jump (Insert Menu / SFC)


Verwenden Sie den Befehl, die Markierung mit einem Sprung-Element zu ersetzen. Dieser Befehl steht nur zur Verfgung, wenn die letzte Verbindungslinie in einem Alternativzweig markiert ist.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

177

5 ControlX Editor

Shortcut: Keyboard:

STRG+ALT+J

5.4.2.5 Commands "View" Menu


5.4.2.5.1 Commands "View" Menu (SFC)
The View Menu contains the following commands: Toolbar Status Bar Output Window Zoom In Zoom Out Blendet die Symbolleiste ein oder aus Blendet die Statusleiste ein oder aus Blendet das Ausgabefenster ein oder aus Vergrert den Darstellungsmastab Verkleinert den Darstellungsmastab

5.4.2.5.2 Toolbar (View Menu / SFC)


Verwenden Sie diesen Befehl zum Ein- oder Ausblenden der Symbolleiste. Die Symbolleiste enthlt einige Schaltflchen der gebruchlichsten Befehle vom SFC-Editor, wie zum Beispiel Datei ffnen. Wenn die Symbolleiste angezeigt wird, erscheint ein Hkchen neben diesem Meneintrag.

178

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

Hilfe zum Gebrauch der Symbolleiste finden Sie unter Symbolleiste

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

179

5 ControlX Editor

5.4.2.5.3 Descripton of the Toolbar

Die Symbolleiste wird horizontal oben im Anwendungsfenster unterhalb der Menleiste angezeigt. Sie stellt per Maus schnellen Zugriff auf viele Tools des SFC-Editors bereit. Um die Symbolleiste ein- oder auszublenden, knnen Sie aus dem Men Ansicht den Befehl Symbolleiste auswhlen (ALT,A,S). Schaltflche Tastenkrzel Ctrl + S Ctrl + X Ctrl + C Ctrl + V Ctrl + P Aktion Saves the current SFC-program oder die aktive Vorlage unter aktuellen Namen. Entfernt die markierten Daten aus dem SFC-Programm und b sie in die Zwischenablage (siehe Befehl Cut) Kopiert die markierten Daten in die Zwischenablage (siehe Be Copy) Fgt den Inhalt der Zwischenablage an der Einfgestelle ein (s Befehl Paste) Druckt das aktuelle Programm aus (siehe Befehl Print) Ermglicht die Vorschau auf die Druckerausgabe (siehe Befeh Preview) Vergrert den Mastab der Darstellung des SFC-Planes Verkleinert den Mastab der Darstellung des SFC-Planes Ctrl + Z Ctrl + Y Macht die letzte Bearbeitung rckgngig (siehe Befehl Undo) Macht die letzte Rckgngig-Aktion rckgngig (siehe Befehl Schaltet die Anwendung in den Hilfemodus, um zu einzelnen Elementen des Editors Hilfetext anzugeben (siehe Befehl Direc .

5.4.2.5.4 Status Bar (View Menu / SFC)


Verwenden Sie diesen Befehl, um die Statusleiste ein- oder auszublenden. Die Statusleiste beschreibt die Aktion, die vom ausgewhlten Meneintrag oder einer gedrckten Schaltflche der Symbolleiste ausgefhrt wird und zeigt den Zustand der feststellbaren Tasten an. Falls die Statusleiste angezeigt wird, erscheint ein Hkchen neben dem Meneintrag dieses Befehls. Hilfe zur Verwendung der Statusleiste finden Sie unter Statusleiste

5.4.2.5.5 Output Window (View Menu / SFC)


Verwenden Sie diesen Befehl zum Ein- oder Ausblenden des Ausgabefensters. Das Ausgabefenster dient fr Nachrichten des SFC-Editors an den Benutzer, z.B. beim Speichern der damit verbundenen Codeerzeugung erscheinen dort eventuell Warnungen und Fehlermeldungen zum SFC-Plan.

180

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

Hilfe zum Gebrauch des Ausgabefensters finden Sie unter Description of the Output Window.

5.4.2.5.6 Description of the Status Bar

Die Statusleiste wird am unteren Rand des Fensters des SFC-Editors angezeigt. Sie knnen die Statusleiste im Men Ansicht mit dem Befehl Statusleiste ein- oder ausblenden. Whrend Sie sich mit den RICHTUNGSTASTEN durch Mens bewegen, beschreibt der linke Bereich der Statusleiste die Funktion der Meneintrge. Entsprechend dazu werden in diesem Bereich auch Beschreibungen zur Wirkung der Schaltflchen der Symbolleiste angezeigt, wenn Sie diese niederdrcken und gedrckt halten. Wenn Sie den zu einer Schaltflche der Symbolleiste zugehrigen Befehl nicht ausfhren wollen, nachdem Sie seine Beschreibung gelesen haben, lassen Sie die Maustaste los, whrend sich der Mauszeiger nicht mehr auf der Schaltflche befindet. Befindet sich der Mauscursor ber einem Element des SFC-Planes, werden zugehrige Informationen wie der Name in der Statusleiste angezeigt. In den rechten Bereichen der Statusleiste wird angezeigt, welche der folgenden Tasten festgestellt sind: Anzeige Beschreibung UF Die FESTSTELLTASTE ist aktiviert NUM RF Die Taste NUM ist festgestellt Die Taste ROLLEN ist festgestellt

5.4.2.5.7 Description of the Output Window (View Menu / SFC)

Das Ausgabefenster dient der Interaktion des SFC-Editors mit dem Benutzter bei der Syntaxkontrolle und bei der Zwischencodeerzeugung eines Programmes. Die genannte Vorgnge werden automatisch im Hintergrund beim Vorgang des Speicherns ausgefhrt. Treten dabei Warnungen oder Fehler auf, werden diese zeilenweise im Ausgabefenster beschrieben. Der SFC-Editor besitzt genau ein Ausgabefenster, in welche alle Meldungen gesammelt werden. Durch Doppelklick auf eine Zeile des Ausgabefensters wird automatisch der SFC-Plan geffnet, der die entsprechende Zeile hervorgerufen hat. Das Ausgabefenster lt sich verstecken, um Platz fr die Anzeige grerer Plne zu gewinnen.(Output Window)

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

181

5 ControlX Editor

5.4.2.5.8 Zoom In (View Menu / SFC)

Verwenden Sie diesen Befehl, um den Mastab der Darstellung zu vergrern. Die einzelnen Elemente werden dadurch grer dargestellt. Der Anteil des sichtbaren Ausschnittes des SFCPlanes verkleinert sich mit diesem Befehl. Shortcut: Toolbar: 5.4.2.5.8.1

5.4.2.5.9 Zoom Out (View Menu / SFC)


Verwenden Sie diesen Befehl, um den Mastab der Darstellung zu verkleinern. Die einzelnen Elemente werden dadurch kleiner dargestellt. Der Anteil des sichtbaren Ausschnittes des SFCPlanes vergrert sich mit diesem Befehl. Shortcut: Toolbar: 5.4.2.5.9.1

5.4.2.6 Commands "Online" Menu


5.4.2.6.1 Commands "Online" Menu (SFC)
The Online Menu contains the following commands to change in the Online-mode Das Men Online bietet Ihnen Befehle zum Wechseln in den Online-Modus. State Notice Einschalten der Statusanzeige zu einem laufenden Programm Ausschalten der Statusanzeige

Offline

5.4.2.6.1.1

5.4.2.6.2 State Notice (Online Menu / SFC)


Wurde das aktuelle Programm ber die Test- und Inbetriebnahme von OpenPCS gestartet, steht der Befehl Zustandsanzeige zur Verfgung. Durch Anwahl dieses Menpunktes baut der Editor eine Verbindung zur Steuerung auf und fragt den Status des laufenden SFC-Programmes ab. Aktive Schritte des Programmes werden in diesem Modus optisch durch ein rotes Rechteck gekennzeichnet:

182

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.2.6.2.1

5.4.2.6.3 Offline (Online Menu / SFC)


Schaltet die Statusanzeige des SFC-Editors ab. (siehe dazu den Befehl State Notice).

5.4.2.7 Commands "Window" Menu


5.4.2.7.1 Commands "Window" Menu (SFC)
Das Men Fenster bietet folgende Befehle, die Ihnen erlauben, mehrere Ansichten von mehreren SFC-Programmen im Anwendungsfenster einzurichten: Cascade Tile Arrange Icons Window 1, 2, ... Arranges the windows in cascade style Arranges the windows side by side Arranges the to symbols reduced icons Switches to the specified window

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

183

5 ControlX Editor

5.4.2.7.2 Arrange Icons (Window Menu / SFC)


Verwenden Sie diesen Befehl, um die Symbole der minimierten Fenster im unteren Bereich des Hauptfensters anzuordnen. Falls sich dort ein geffnetes SFC-Programmfenster befindet, kann es passieren, da einige oder alle Symbole verdeckt sind, weil sie sich unterhalb des SFCProgrammfensters befinden.

5.4.2.7.3 Cascade (Window Menu / SFC)


Verwenden Sie diesen Befehl, um die geffneten Fenster berlappend anzuordnen.

5.4.2.7.4 Tile (Window Menu / SFC) 5.4.2.7.4.1 5.4.2.7.5 Tile Horizontally (Window Menu / SFC)
Verwenden Sie diesen Befehl, um die geffneten Fenster vertikal nebeneinander anzuordnen

5.4.2.7.6 Tile Vertically (Window Menu / SFC)


Verwenden Sie diesen Befehl, um mehrere geffnete Fenster Seite an Seite anzuordnen.

5.4.2.7.7 The commands 1,2... (Window Menu / SFC)

Am Ende des Mens Fenster stellt der SFC-Editor eine Liste der aktuell geffneten SFCProgrammfenster dar. Vor dem SFC-Programmnamen des aktiven Fensters erscheint ein Hkchen. Whlen Sie ein SFC-Programm aus der Liste, um sein Fenster zu aktivieren.

5.4.2.8 Commands "Help" Menu


5.4.2.8.1 Commands "Help" Menu (SFC)
Das Men Hilfe enthlt folgende Befehle, die Ihnen Untersttzung fr diese Anwendung bereitstellen: Content and Index Use of the Help Info Starts the online-help and shows the first site

Explains the use of help Shows the product information

184

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.2.8.2 Content and Index (Help Menu / SFC)


Verwenden Sie diesen Befehl, um ber das Verzeichnis der Themen eine bestimmtes Hilfethema auszuwhlen.

5.4.2.8.3 Direct Help

Verwenden Sie den Befehl Kontexthilfe, um Hilfe zu einem bestimmten Teil des SFC-Editors zu erhalten. Wenn Sie die Schaltflche "Kontexthilfe" aus der Symbolleiste auswhlen, ndert sich der Mauszeiger zu einem Pfeil mit Fragezeichen. Klicken Sie dann mit der Maus irgendwo in das Fenster des SFC-Editors, zum Beispiel auf eine andere Schaltflche in der Symbolleiste. Das dem angeklickten Element entsprechende Hilfethema wird daraufhin angezeigt. Shortcut: Keyboard: .

UMSCHALT+F1

5.4.2.8.4 Use Help (Help Menu / SFC)


Hier erfahren Sie alles ber den genauen Gebrauch und den Umgang mit der Onlinehilfe.

5.4.2.8.5 About SFC Editor (Help Menu / SFC)


Verwenden Sie diesen Befehl zur Anzeige des Copyrighthinweises und der Versionsnummer Ihrer Kopie des SFC-Editors.

5.4.3 Menus in the Ladder Editor 5.4.3.1 Survey of Menus (Ladder-Editor)


File Menu Edit Menu Insert Menu View Menu Options Menu Online Menu Window Menu Help Menu

5.4.3.2 Commands "File" Menu


5.4.3.2.1 Commands "File" Menu (Ladder)
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

185

5 ControlX Editor

The File menu contains the following commands: Close Save Convert POU-Type Check Syntax Print Page Setup Print Preview Exit Closes the current Ladder-program Saves the current Ladder-program to its original name Allows you to change between program and function block Checks the program about syntax errors and opens the inspection-report Prints the current Ladder-program Displays an dialog, so you can set the margins Shows an print preview Closes the Ladder-Editorr

5.4.3.2.2 Close (File Menu / Ladder)


Use this command to close all windows, which contains the current Ladder-program. The Ladder-Editor proposes you to save your changes. If you close an program without saving your changes since the last saving will be lost. You can also use the close-symbol in the toolbar to close your SFC-program, like it is shown in the following picture:

5.4.3.2.3 Save (File Menu / Ladder) 5.4.3.2.3.1


Use this command to save your current SFC-program. It will be stored with its orriginal name and path. Shortcut: Toolbar: Keyboard: STRG+S

186

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.3.2.4 Convert POU-Type (File Menu / Ladder)


This command allows you to change the type of block between program and function block and the other way round.

5.4.3.2.5 Check Syntax (File Menu / Ladder)


By using this command you check the program about syntax errors. Notice that you allways check the last saved version. In case you have changed your program without saving it appears an dialog which asks you to save changes. Confirm this question with OK. After that appears an inspection-report. Shortcut: Symbol: Keyboard:

Alt+F10

5.4.3.2.6 Print (File Menu)


Use this command to print a document. In case you activate this command a dialog appears in which you can make statements about the side area, which should be printed, the number of copies, the printer and other options about the printer setup. Shortcut: Toolbar: Keyboard: STRG+P

5.4.3.2.7 Page Setup (File Menu)


Use this command to set the margins for your printout.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

187

5 ControlX Editor

In the area Paper you can arrange the format as well as the source of the used paper. In the area Margins you can fit the margins of your document. The textfield Top provides a space for you to specify the width of the top margin on every printed page. The Textfiled Bottom provides a space for you to specify the width of the bottom margin on every printed page. The distance between header/footer and the respective margin is fix. In the area Ausrichtung you can choose whether the paper shoulb be printed in the upright format or the horizontal format.

5.4.3.2.8 Print Preview (File Menu / SFC)


Use this command to show your current document, how it would look printed. If you choose this command, the main window will be hided by a side-view-window, where you can decide whether one ot two pages should be shown in this window. Furthermore you can move through the text, you can reduce or enlarge the view or you can start to print.

5.4.3.2.9 Exit (File Menu)


Use this command to finish your session. You can also choose the command Close from your System menu. The Editor asks you to save programs with unsaved changes. Shortcut: Mouse:

Doupleclick on the system menu of the application

188

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

Keyboard:

ALT+F4

5.4.3.3 Commands "Edit" Menu


5.4.3.3.1 Commands "Edit" Menu (Ladder)
The Edit Menu contains the following commands: Undo Redo Negate Cut Copy Paste / Replace Delete Select All Search Replace Search Variable Declarations Replace Variable Declarations Allows you to reverse changes Reverse the last Undo command Negates connection results inside a program Deletes the selected item and places it on the clipboard Copies the selected item and places it on the clipboard Replaces the selected item with data from the clipboard Deletes the selected items Selects all items Searchs for a piece of text inside the plan Searchs for a piece of text inside the plan and replaces it Searchs for variables inside the declaration part Searchs for variables inside the declaration part and replaces it Jumps inside a program to a specified network or jumping mark respectively

Go To ...

5.4.3.3.2 Undo (Edit Menu)


Use this command to reverse (undo) your last change.

Shortcut: Toolbar: Keyboard: STRG+Z oder ALT-RCKTASTE 189

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.3.3.3 Redo (Edit Menu)


Use this command to reverse the last Undo command. Shortcut: Toolbar: Keyboard: STRG+Y

5.4.3.3.4 Negate (Edit Menu / Ladder)


By using this command you can put the contact of the binary variables in the instruction section in the opposite condition (true or false). Moreover it is is possible to negate the signal, which is send to the exit. Notice that you can not negate the logical symbols set and reset. Shortcut: Keyboard:

Space

5.4.3.3.5 Cut (Edit Menu)


By using this command you delete the selected items and place a copy of them in the clipboard. In the case that no items are marked or the action would have an unauthorized condition as effect you can not use this command. In the clipboard are allways the items from the last use of cut or copy. Shortcut: Toolbar: Keyboard: STRG+X

5.4.3.3.6 Copy (Edit Menu)


By using this command you copy the selected items to the clipboard. In the case no items are marked you can not use this command. In the clipboard are allways the items from the last use of cut or copy. Shortcut: Toolbar: Keyboard: STRG+C

190

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.3.3.7 Paste / Replace (Edit Menu)


Use this command to replace the selected items with a copy from the data from the clipboard. In the case that the clipboard is empty or the action would have an unauthorized condition as effect you can not use this command. Shortcut: Toolbar: Keyboard: STRG+V

5.4.3.3.8 Delete (Edit Menu)


Use this command to delete the selected items. In case deleting will have an invalide condition of data as effect you can not use this command. Shortcut: Keyboard:

ENTF

5.4.3.3.9 Select All (Edit Menu)


Use this command to select all items. Shortcut: Keyboard:

STRG+A

5.4.3.3.10 Search (Edit Menu)


Use this command to search for a textposition inside the plan. You will see the result in the output window. With an double click on the result, you approach to the editor window of the respective transition. Notice that you have to save your plan before you can search inside it.

Shortcut: Keyboard:

STRG+Q

5.4.3.3.11 Replace (Edit Menu / Ladder)


Use this command to search in the current program for entered text, formats or comment signs you want to replace.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

191

5 ControlX Editor

Shorrtcut: Keyboard: Strg+H

5.4.3.3.12 Search Variable Declarations (Edit Menu / Ladder)


Use this command to search for variables inside the declaration part.

5.4.3.3.13 Replace Variable Declaration (Edit Menu / Ladder)


Use this command to search for variables in the declaration part you want to replace.

5.4.3.3.14 Go To (Edit Menu / Ladder)


Use this command to jump inside the program to the specified network or the specified jumping mark respictively, with the intention to change the insert mark.

5.4.3.4 Commands "Insert" Menu


5.4.3.4.1 Commands "Insert" Menu (Ladder)
The Insert menu contains the following commands: Network Functionblock Function Variable ...AND Contact ...OR Contact Coil Control Relay Others Inserts a new network into the instruction section Inserts a new function block into the instruction section Inserts a new function into the instruction section Inserts differnt variables into the instruction section Create Contact in serial order (Logical AND) Create Contact in parallel order (Logical OR) Inserts a coil at the exit Inserts a control relay at the exit Inserts other beginning symbols

5.4.3.4.2 Network (Insert Menu / Network)


This command allows you to insert new branches into the instruction section.

192

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

Shortcut: Toolbar: Keyboard:

F12

5.4.3.4.3 Functionblock (Insert Menu / Ladder)


Use this commans to insert function blocks into the instruction section. Shortcut: Keyboard:

Strtg+Alt+B

5.4.3.4.4 Function (Insert Menu / Ladder)


Use this command to insert functions into the instruction section. Shortcut: Toolbar: Keyboard:

Strg+Alt+F

5.4.3.4.5 Variable (Insert Menu / Ladder)


Use this command to insert different variables into the instruction section.

Shortcut Alt + V Alt + I Alt + O Alt + N Alt + L Alt + G Alt + E Alt + F Toolbar:

Action All... Input... Output... In/Out... Local... Global... External... FB-Instanz...

5.4.3.4.6 ...AND Contact (Insert Menu / Ladder)


Use this command to insert an contact right beside the input mask into the instruction section.

Shortcut: Toolbar: Keyboard:

F9

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

193

5 ControlX Editor

5.4.3.4.7 ...Or Contact (Insert Menu / Ladder)


Use this command to insert a contact below the input mask into the instruction section. Shortcut: Toolbar: Keyboard:

Strg+F9

5.4.3.4.8 Coil (Insert Menu / Ladder)


Use this command to insert a coil at the exit. Shortcut: Toolbar: Keyboard:

F10

5.4.3.4.9 Control Relay (Insert Menu / Ladder)


Use this command to insert a control relay additional to the logical symbol. You can assign each exit maximally one control relay. Shortcut: Toolbar: Keyboard:

F11

5.4.3.4.10 Others (Insert Menu / Ladder)


By using this menu point you can assign other output symbols to the exit in the instruction section. By clicking the right mouse button you receive a list with possible logical symbols.

Button R S JMP RET

Action Inserts Reset as beginning symbol Inserts Set as beginning symbol Inserts Jump as beginning symbol Inserts Return as beginning symbol

194

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

5 ControlX Editor

5.4.3.5 Commands " View" Menu


5.4.3.5.1 Commands "View" Menu (Ladder)
Toolbar Common Ladder Operations Common Ladder Functions Common Ladder Function Blocks Output Window Statusbar By putting a small hook you you can hide or show the Toolbar By putting a small hook you you can hide or show the Common Ladder Operations. By putting a small hook you you can hide or show the Common Ladder Functions By putting a small hook you you can hide or show the Common Ladder Function Blocks By putting a small hook you you can hide or show the Output Window By putting a small hook you you can hide or show the Status Bar below the Output-Window Enlarges the current file on your screen Reduces the current file on your screen

Zoom In Zoom Out

5.4.3.6 Commands "Options" Menu


5.4.3.6.1 Settings (Options Menu / Ladder)
This command allows you to edit layout and colors in the ControlX Framework.

5.4.3.7 Commands "Online" Menu


5.4.3.7.1 Commands "Online" Menu (Ladder)

Start Stop

Connection to control and statustest of an active program Closes the connection to the control

5.4.3.7.2 Start (Online Menu / Ladder)


Have you started the current program in the project file and loaded it in the online-editor you can use the command Start. If you choose this command, the editor builds up an connection with the control and interrogates the status of the current Ladder-program.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

195

5 ControlX Editor

5.4.3.7.3 Stop (Online Menu / Ladder)


This command closes the connection to control.

5.4.3.8 Window (Ladder)


5.4.3.8.1 Survey "Window" Menu (Ladder)
Close All Cascade Tile Arrange Icons Split Closes all active windows Arranges the windows in cascade style Arranges the windows side by side Arranges the to symbols reduced icons Allows to change the size of the window from variable editor and instruction section Allows to change the window section between variable editor and instruction section Sets the cursor into the ducumentation window Sets the cursor into the output-window Switches to the specified window

Next pane

Document Window Output Window Window 1, 2, ...

5.4.3.9 Help (Ladder)


5.4.3.9.1 Survey "Help" Menu (Ladder)
Content and Index This Windows Using Help Info Starts the online-help and shows the first site Starts the online-help Explains the use of help Shows the product information

196

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6 Ladder Diagram Editor 6.1 Introduction


6.1.1 General information on Ladder Logic
The basic principle of Ladder Logic is currency flow through networks. Generally, Ladder Logic is restricted to processing boolean signals (1=True, 0=False). A Network is restricted by so called margin connectors to the left and to the right within the Ladder Editor. The left margin connector has the logical value 1 (current). There are connections that conduct currency to elements (variables) that conduct currency to the right hand side or isolate depending on their logical state. The result of the procedure depends on the arrangement of elements and the way they are connected (AND = serial; OR = parallel). Networks consist of the following graphical objects: Connections (horizontal or vertical lines, and soldered points) Contacts, Coils, Control Relays Function blocks and Functions Jumps (Graphical elements for control flow) See also: Ladder Diagram

6.1.2 General Information on Ladder Diagram Editor


The Ladder Diagram Editor included in the ControlX Editor Framework is an editor suitable for the US market. It neatly fits into an IEC - 61131-3 programming environment. With the Ladder Diagram Editor, you write IL code translatable by the IEC compiler and displayable by the IEC IL editor (kispoeed). Thus it is possible to write function blocks in IL that can be used as ladder function blocks in the US. See also: Overview Working with the ControlX Editor Framework General Information on Ladder Logic

6.1.3 Informations on handling 6.1.3.1 Menu


The menu provides file edit and management functions, display options lf the editor and help functions. See also: Survey of Menus (Ladder Editor)

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

197

6 Ladder Diagram Editor

6.1.3.2 Toolbar
The toolbar increases the speed of working by providing the functionality of different menus or dialogs in one place. Choose View Toolbar in the menu, in order to display or hide the toolbar.

6.2 Quickstart
6.2.1 Create Ladder Diagramm
Before working with the Ladder Diagram Editor you should have analyzed the control task and structured the program. Use the Project Browser to create a new project and a new file. The file the Ladder Diagram Editor uses is "LDD". Double click the file with the left mouse button in the Project Browser. This opens the file into the Ladder Diagram Editor. If the ControlX Editor Framework has not yet been opened, it will be opened together with the file. Use the menu entries and the toolbar to edit the file. See also: Ladder Diagram Create Ladder Logic Save Syntax - Check Menu Toolbar Keyboard

6.2.2 Create Ladder Logic


In order to create a Ladder Logic, a file of type "LDD" must exist and be opened. 1.) When a new file is being opened, a standard network will be displayed with a contact on the left hand side and a coil on the right hand side. The label fields of network elements contain "X" by default. 2.) There is no restriction on whether to declare variables in the variable editor or add instructions in the instruction editor first. It is possible to freely switch between both editors during program creation. 3.) Since the variable editor is available in the "free mode" only, you should stick to the correct syntax according to the norm IEC 61131-3. 4.) On creating networks, you should also stick to basic logical principles in order to avoid errors. Refer to the norm IEC 61131-3 for further information.

198

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

See also: General Information on Ladder Logic Ladder Diagram Create Ladder Diagram Save Syntax - Check Online

6.2.3 Save
The Save command is available only if changes were made to an opened LDD file. If this is not the case, the "Save" toolbar button and the menu entry are grayed. There will be a save before attempting to close an unsaved file to avoid loss of data. See also: Ladder Diagram Create Ladder Diagram Create Ladder Logic Syntax - Check Online

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

199

6 Ladder Diagram Editor

6.2.4 Syntax Check


The syntax check of a program succeeds if all language elements that were used are in fact available and if they were used and combined in a permissible manner according to the programming language. Basic language elements (contacts, key words, literals and identifiers) may always be used. However, data types (bool, integer) and variables may only be used if their declarations are available. 1.) Precondition: The program of the current LDD file has been comnpleted. 2.) In the menu "File", click "Syntax Check". 3.) If there are unsaved changes to the file, a save query will appear. The syntax check always operates on the latest saved version. The results of the syntax check will be displayed in the output window. See also: Ladder Diagram Create Ladder Diagram Create Ladder Logic Save Online Output - Window

6.2.5 Online
Before working with the Online Editor, you should have create ressources and tasks within the Project Browser. Ressources and tasks are compiled by the code generator, which yields an executable SPS program. Further necessary tools that have to be invoked from the Project Browser are the Test and Commissioning Tool (T&C) and the Control. 1.) In the "Online" menu, click "Start". 2.) Note that the load state "LOW" changes to a blue color, while "HIGH" will be highlighted in red. 3.) The states of the control will be initialized and displayed in the online editor. See also: General Information on Ladder Logic Ladder Diagram Create Ladder Diagram Create Ladder Logic Save Syntax - Check

200

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.3 Working on Ladder Diagrams


6.3.1 Ladder Diagram
A ladder diagram consists of a Diagram Comment and one or many Networks. A ladder diagram may be programmed as one of the kinds program, function block or function. The kind of a new ladder diagram is chosen on creation in the Project Browser (File New). Example:

See also: General Information on Ladder Logic Operators Function and Function Blocks Logical Connection

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

201

6 Ladder Diagram Editor

6.3.2 Comments
You should use comments to describe network elements and their purpose in some detail. This may increase their readability for other persons and enables the user as well as the developer to quickly understand the purpose of subprograms. A comment is a language element that enables the inclusion of plain text into programs without any implications on program execution. When programming in a graphical language, text frames are provided for comments. Example:

See also: General Information on Ladder Logic

6.3.3 Network
The instruction section of the Ladder Diagram Editor is subdivided into so called networks, which help structuring the graphic. A network consists of: Network label Network comment Network graphic

Network label:

Each network that may be a jump target from within another network will automatically be assigned a preceding alphanumerical identifier or an unsigned decimal integer. By default, networks will be numbered. This numbering of all networks will be automatically updated whenever a new network is inserted. The numbering simplifies finding a certain network an corresponds to line numbers of textual programming languages. Network comment: The Network Comment is represented as a square area in the ladder diagram. To enter a commentary text, double click on this square. The comment is always placed below the network label. Note that the first network additionally contains a ladder diagram comment above the network label and the network comment. 202
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

Network graphic: The network graphic consist of graphical objects, which may be graphical symbols or connections. Connections transport data between graphical symbols, which process the data at their inputs and transfer the processed data to their outputs. Note that the connections may also cross.

See also: General Information on Ladder Logic Operators Functions and Function Blocks Logical Connections

6.3.4 Instructions 6.3.4.1 Operators


Within a ladder diagram, the term operator designates the graphical objects contact, coil and jump. Contacts: A contact associates the value of an incoming connection with the value of an assigned variable. The kind of association depends on the type of contact. The result value will be transferred to the connection on the right hand side. There are triggers and interruptors. Coils serve to assign values to output variables of networks. A coil copies the state of the connector on its left hand side to its connector on its right hand side without any changes. Furthermore, the coil saves a function of the state or the transition of the left connector into a boolean variable. Jumps manipulate the control flow of programs. They make it possible to directly invoke certain networks in a defined order. When encountering a jump operator, control flow continues at a different network. Thus, jumps are an exception from the basic principle that networks are always processed in a top down fashion.

Coils:

Jump:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

203

6 Ladder Diagram Editor

See also: General Information on Ladder Logic Contacts Coils Functions and Functions Blocks Logical Connections

6.3.4.2 Functions and Function Blocks


Functions: If a program block might be useable for different and reoccuring parts of a control task, you should consider using a function for this subtask. A function may have more than one input parameter, but one output parameter only. I.e. the calculation may yield one data element as result only. Functions may not have an internal state, i.e. they may not save any data. Thus, if a function is invoked twice with the same input parameters, it will always yield the same return value. You may also use function blocks for reoccuring subtasks. Function blocks may have more than one input parameter and more than one output parameters, too. A function block can save its variable values from one invocation to the next. These values can be used in the next invocation if they are not assigned new values. Thus, function blocks may have an internal state.

Function Blocks:

See also: General Information on Ladder Logic Functions and Functions Blocks Use of Functions Use of Function Blocks Logical Connections

6.3.4.3 Logical Connections


A logical connection is represented as parallel or serial combinations of different networks. There is no restriction on the number of serially or parallely linked networks. A serial sequence is called an AND connection, while a parallel sequence is called an OR connection. See also: General Information on Ladder Logic AND OR

204

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4 Ladder Logic


6.4.1 Operators 6.4.1.1 Contacts
There are two contact symbols for boolean input variables:

1.)

Contact symbol for a variable that must have the value "1" to make the corresponding boolean connection true. If the variable is associated with a physical address, the state "1" corresponds to a released interruptor or a pressed trigger. Contact symbol for a variable that must have the value "0" to make the corresponding boolean connection true. If the variable is associated with a physical address, the state "0" corresponds to a pressed interruptor or a released trigger.

2.)

See also: General Information on Ladder Logic Operators Function and Function Blocks Logical Connections

6.4.1.2 Coils
The output variable is always situated to the right hand side of the network and is connected to the right currency rail.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

205

6 Ladder Diagram Editor

1.) 2.) 3.)

The result of the logical connection will directly be assigned to the output variable. The output variable will be assigned the negation of the result of the logical connection. The result of the logical connection will "permanently set" the output variable: If the result of the logical connection is "1", the output variable will be set to "1". If, however, the result of the logical connection is "0", this will have no implications. The result of the logical connection will "permanently reset" the output variable: If the result of the logical connection is "1", the output variable will be set to "0". If, however, the result of the logical connection is "0", this will have no implications. Jump operations manipulate control flow. With jumps, networks may be executed only if certain conditions hold. Jumps may be conditioned by a binary combination result, or unconditioned, i.e. obligatory. The jump target must always be the beginning of a network, designated by its network label. Return jumps stop program execution within the current POU, and continue at the point where the POU was invoked from. Return jumps may be conditioned by a binary connection result, or unconditioned.

4.)

5.)

6.)

See also: General Information on Ladder Logic Operators Function and Function Blocks Logical Connections

6.4.1.3 Control Relays


Control relays are contacts that are inserted in front of coils. Control relays may be used as breakpoints in manual execution, for example. There can always be one control relay before each coil only. Exmple:

206

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

See also: General Information on Ladder Logic Operators Function and Function Blocks Logical Connections

6.4.2 Blocks 6.4.2.1 Function Blocks


6.4.2.1.1 Function Block
Function blocks may be used for frequently needed functionality. Function blocks may contain several input parameters and several output parameters. A function block keeps up its variable values from one invocation to the next. They may be reused during the next invocation if they are not assigned new values.

6.4.2.1.2 Use of Function Blocks


A Function Block is represented as a rectangular graphical symbol. The connectors on the left hand side represent the input variables, while the connectors to the right represent the output variables. Within the rectangle, you see the name of the function block. The names of the input operands are situated to the left, while the names of the output operands are to the right. The instance name is above the rectangle. Example of a function block:

A function block constitutes an autonomous network. Input and output operands that are not used will not be assigned variable identifiers. The corresponding connectors will then remain without labels. If parameters are passed outside the function block, the function block symbol will be drawn without any connectors.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

207

6 Ladder Diagram Editor

The following table presents an overview of all function blocks, ordered according to their purpose. Function Block F_TRIG R_TRIG RS SR TOF TON TP CTD CTU CTUD Purpose Falling Trigger Raising Trigger RS Flip Flop SR Flip Flop Delayed Off Trigger Delayed On Trigger Impuls Counter down Counter up Counter up and down .

Choose a function block from the table to see a graphical representation. See also: General Information on Ladder Logic Use of Functions

6.4.2.1.3 Graphical presentations of prototypes 6.4.2.1.3.1 F_TRIG


The function block F_TRIG processes the state of the input operand "CLK". If there is a change of state from "1" to "0" in the next processing cycle, this will be recognized and the output "Q" will yield the boolean value "1". The state is "1" at the output only during the one cycle where the change of state of "CLK" was recognized and thus a falling edge is signaled. Prototype:

Meaning of operands: CLK: input operand whose falling edge is to be recognized Q: output operand; signals if "CLK" has a falling edge

208

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.1.3.2 R_TRIG
The function block R_TRIG processes the state of the input operand "CLK". If there is a change of state from "0" to "1" in the next processing cycle, this will be recognized and the output "Q" will yield the boolean value "1". The state is "1" at the output only during the one cycle where the change of state of "CLK" was recognized and thus a rising edge is signaled. Prototype:

Meaning of operands: CLK: input operand whose rising edge is to be recognized Q: output operand; signals if "CLK" has a rising edge

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

209

6 Ladder Diagram Editor

6.4.2.1.3.3 RS
The function block "RS" statically switches a data element (the output "Q1") to a boolean state "1" or "0" Switching between the two states is due to the values of the boolean input operands "SET" and "RESET1". At the beginning of the procedure. the output "Q1" will be initialized with the value "0". If the function block is invoked for the first time with the "1" as the value of the "SET" operand, the output "Q1" will yield the value "1" it will be set. Afterwards, any changes of "SET" will not have implications on the output value "Q1" any more. "1" as a value of the input operand "RESET1" will always switch the output "Q1" to "0", i.e. it will reset the output. If both input operands have the value "1", the true reset condition will dominate. In other words, "Q1" is preferably reset. Prototype:

Meaning of operands: SET: Set condition RESET1: Reset condition Q1: Output state of bi-stable element

210

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.1.3.4 SR
The function block "RS" statically switches a data element (the output "Q1") to a boolean state "1" or "0" Switching between the two states is due to the values of the boolean input operands "SET1" and "RESET". At the beginning of the procedure. the output "Q1" will be initialized with the value "0". If the function block is invoked for the first time with the "1" as the value of the "SET1" operand, the output "Q1" will yield the value "1" it will be set. Afterwards, any changes of "SET1" will not have implications on the output value "Q1" any more. "1" as a value of the input operand "RESET" will always switch the output "Q1" to "0", i.e. it will reset the output. If both input operands have the value "1", the true set condition will dominate. In other words, "Q1" is preferably set. Prototype:

Meaning of operands: SET1: Set condition RESET: Reset condition Q1: Output state of bi-stable element

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

211

6 Ladder Diagram Editor

6.4.2.1.3.5 TOF
If the state of the input operand "IN" is "1", this will be passed to the output operand "Q" without any delay. If there is a falling edge, a timer function will be started lasting as long an interval as specified by the operand "PT" If the timer is running, a change of state at the input "IN" to "0" will have no implications. It is after the time is up that the operand "Q" will change to the state "0". If the "PT" value changes after the start, it will have no implications until there is the next rising edge of the operand "IN". The operand "ET" contains the current timer value. If the time is up, the operand "ET" will keep its value as long as the operand "IN" has the value "1". If the state of the "IN" operand changes to "0", the value of "ET" will switch to "0". If the input "IN" is switched off, this will switch off the output "Q" after an interval specified by the delay value.

Time Diagram:

Prototype:

212

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

Meaning of operands: IN: Start condition PT: Initial time value Q: binary state of the timer ET: current time value

6.4.2.1.3.6 TON
The rising edge of the input opernad "IN" will start the timer "TON", and it will run as long a time interval as specified by the operand "PT". While the timer is running, the output operand "Q" will have the value "0". If the time is up, the state will change to "1" and keep this value until the operand "IN" changes to "0". If the "PT" value changes after the timer has been started, this will have no implications until the next rising edge of the operand "IN". The output operand "ET" contains the current timer value. If the time is up, the operand "ET" will keep its value as long as the operand "IN" has the value "1". If the state of the "IN" operand changes to "0", the value of "ET" will switch to "0". If the input "IN" is switched on, this will switch on the output "Q" after an interval specified by the delay value. Time diagram:

Prototype:

Meaning of operands: IN: Start condition PT: Initial time value Q: binary state of the timer ET: current time value

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

213

6 Ladder Diagram Editor

6.4.2.1.3.7 TP
A rising edge of the input operand "IN" will start the timing function of the timer "TP", and it will run as long an interval as specified by the operand "PT". While the timer is running, the output operand "Q" will have the state "1". Any changes of state at the input "IN" will have no implications on the procedure. If the "PT" value changes after the start, this will not have any implications before the next rising edge of the "IN" operand. The output operand "ET" contains the current timer value. If the operand "IN" has the state "1" after the time is up, the operand "ET" will keep its value. Every edge occuring while the timer is not running will cause am impuls that lasts as long as specified. time diagram:

Prototype:

Meaning of operands: IN: Start condition PT: Initial time value Q: binary state of the timer ET: current time value

214

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.1.3.8 CTD
The function block "CTD" serves for counting down impulses received from the input operand "CD". On initialization, the counter will be set to "0". If the operand "LOAD" is "1", the value received by the operand "PV" will be taken over as a value into the counter. Each rising edge at the input "CD" will decrease the counter by "1". The output operand "CV" contains the current value of the counter. If the counter value is positive, the output operand "Q" will have the boolean value "0". If the counter value reaches zero or becomes negative, the output "Q" will be set to "1". Prototype:

Meaning of operands: CD: Counter impulses, rising edge LOAD : set condition PV: initial value Q: signals whether counter value has reached zero CV : counter value

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

215

6 Ladder Diagram Editor

6.4.2.1.3.9 CTU
The function block "CTD" serves for counting up impulses received from the input operand "CD". On initialization, the counter will be set to "0". The counter value will be reset if the operand "RESET" receives the value "1". Each rising edge at the input "CD" will increase the counter by "1". The output operand "CV" contains the current value of the counter. If the counter value is below the margin value "PV", the output operand "Q" will have the boolean value "0". If the counter value reaches or passes the margin, the output "Q" will be set to "1". Prototype:

Meaning of operands: RESET: reset condition PV: counter margin value Q: signals if counter has reached the margin value CV : counter value

216

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.1.3.10 CTUD
The function block "CTUD" serves for counting up and down impulses. On initialization, the counter will be set to the value "0". Every rising edge at the input operand "CD". will increase the counter by "1", while every falling edge at the input "CD" will decrease it by "1". If the operand "LOAD" is "1", the value received by the operand "PV" will be taken over as a value into the counter. The counter value will be reset if the operand "RESET" receives the value "1". While the static state of the operand "RESET" remains unchanged, the counting conditions or the load condition will have no implication, independent of their value. The output operand "CV" contains the current value of the counter. If the counter value is below the margin value "PV", the output operand "Q" will have the boolean value "0". If the counter value reaches or passes the margin, the output "Q" will be set to "1". If the counter value is positive, the output operand "QD" will have the boolean value "0". If the counter value reaches zero or becomes negative, the output "QD" will be set to "1". Prototype:

Meaning of operands: CU: counting impulses for counting up, rising edge CD: counting impulses for counting down, rising edge RESET: reset condition LOAD : load condition PV: load value QU: signals wheter counter state has reached PV QD : signals whether counter state has reached "0" CV: counter state

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

217

6 Ladder Diagram Editor

6.4.2.2 Functions
6.4.2.2.1 Function
If a certain functionality is needed for reocurring purposes, a function may be appropriate. A function may have several input parameters, but one output parameter only, i.e. the calculation may have a single data element as a result only. Functions cannot save internal data from invocation to invocation. If repeatedly invoked with the same parameters, a function will always yield the same return value.

6.4.2.2.2 Use of Functions


A Function is represented by a rectangular graphical symbol. The connectors on the left hand side represent the input variables, while the connectors to the right represent the output variables. Within the rectangle, you see the name of the function and the names of the input operands. There may be more than one function or operation symbols in series in a network. If the data types of the connected symbols do not match, a type conversion function must be inserted between them. The following table presents an overview of all functions, ordered according to their purpose. Function *_TO_** TRUNC ABS ADD MUL SUB DIV SHL SHR ROL ROR GT GE EQ LE LT NE LEN LIMIT MOD Purpose Type conversion of elementary data types round a real down to the closest integer absolute value Add numeric data types Multiply numeric data types Subtract numeric data types Divide numeric data types by one another Binary shift left Binary shift right Binary rotation left Binary rotation right Comparison Greater than Comparison Greater or Equal than Comparison Equals Comparison Less or Equal than Comparison Less than Comparison Not Equal Length of a string Limit Modulo Operation .

218

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

MOVE

Assignment

Choose a function from the table to see a graphical representation. Further Information General Information on Ladder Logic Functions and Function Blocks

6.4.2.2.3 Graphical presentation of functions 6.4.2.2.3.1 Type Conversion


Operands that are to be combined must always be of the same type. Assume that the input operand of a function is required to be of type BYTE, for instance. Now, if the data type of the passed variable is BOOL, a type conversion will be necessary. In this case, the type conversion function BOOL_TO_BYTE will be appropriate. If types are converted, the value from the working register is used as an input operand. The result, i.e. the operand with its new data type, will also be written to the working register. Prototype:

Description of operands: * Data type of the input operand **

Data type of the output operand

If numerical values are converted in their type, care has to be taken that the current value is within the valid range of the target data type. If the value is too large, the result will be clipped to the number of bits the target operand possesses, which will be an incorrect value.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

219

6 Ladder Diagram Editor

6.4.2.2.3.2 Type Conversion Functions


BOOL_TO_BYTE BOOL_TO_DINT BOOL_TO_DWORD BOOL_TO_INT BOOL_TO_SINT BOOL_TO_TIME BOOL_TO_UDINT BOOL_TO_UINT BOOL_TO_USINT BOOL_TO_WORD BYTE_TO_BOOL BYTE_TO_DINT BYTE_TO_DWORD BYTE_TO_INT BYTE_TO_SINT BYTE_TO_ TIME BYTE_TO_UDINT BYTE_TO_UINT BYTE_TO_USINT BYTE_TO_WORD DINT_TO_BOOL DINT_TO_BYTE DINT_TO_DWORD DINT_TO_INT DINT_TO_SINT DINT_TO_TIME DINT_TO_UDINT DINT_TO_UINT DINT_TO_USINT DINT_TO_WORD DWORD_TO_BOOL DWORD_TO_BYTE DWORD_TO_DINT DWORD_TO_INT DWORD_TO_SINT DWORD_TO_TIME DWORD_TO_UDINT DWORD_TO_UINT DWORD_TO_USINT DWORD_TO_WORD INT_TO_BOOL INT_TO_BYTE INT_TO_DINT INT_TO_DWORD INT_TO_SINT INT_TO_TIME INT_TO_UDINT INT_TO_UINT INT_TO_USINT INT_TO_WORD SINT_TO_BOOL SINT_TO_BYTE SINT_TO_DINT SINT_TO_DWORD SINT_TO_INT SINT_TO_TIME SINT_TO_UDINT SINT_TO_UINT SINT_TO_USINT SINT_TO_WORD TIME_TO_BOOL TIME_TO_BYTE TIME_TO_DINT TIME_TO_DWORD TIME_TO_INT TIME_TO_SINT TIME_TO_UDINT TIME_TO_UINT TIME_TO_USINT TIME_TO_WORD UDINT_TO_BOOL UDINT_TO_BYTE UDINT_TO_DINT UDINT_TO_DWORD UDINT_TO_INT UDINT_TO_SINT UDINT_TO_TIME UDINT_TO_UINT UDINT_TO_USINT UDINT_TO_WORD UINT_TO_BOOL UINT_TO_BYTE UINT_TO_DINT UINT_TO_DWORD UINT_TO_INT UINT_TO_SINT UINT_TO_TIME UINT_TO_UDINT UINT_TO_USINT UINT_TO_WORD USINT_TO_BOOL USINT_TO_BYTE USINT_TO_DINT USINT_TO_DWORD USINT_TO_INT USINT_TO_SINT USINT_TO_TIME USINT_TO_UDINT USINT_TO_UINT UINT_TO_WORD WORD_TO_BOOL WORD_TO_BYTE WORD_TO_DINT WORD_TO_DWORD WORD_TO_INT WORD_TO_SINT WORD_TO_TIME WORD_TO_UDINT WORD_TO_UINT WORD_TO_USINT

220

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.3 TRUNC
The function "ABS" yields the absolute value of a numerical variable. The data type remains unchanged. The smallest SINT value (128) and the smallest INT value (32768) remain unchanged by the ABS function, as the binary representation of 128 and +128 (and of 32768 and +32,768, respectively) are identical. Note that in these cases, no error message will be generated, though. Prototype:

Meaning of operands: IN: Input: Operand of data type ANY_NUM OUT: Output: Operand of data type ANY_NUM EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

221

6 Ladder Diagram Editor

6.4.2.2.3.4 ABS
The function "ABS" yields the absolute value of a numerical variable. The data type remains unchanged. The smallest SINT value (128) and the smallest INT value (32768) remain unchanged by the ABS function, as the binary representation of 128 and +128 (and of 32768 and +32,768, respectively) are identical. Note that in these cases, no error message will be generated, though. Prototype:

Meaning of operands: IN: Input: Operand of data type ANY_NUM OUT: Output: Operand of data type ANY_NUM EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

222

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.5 ADD
ADD adds the value of the operand "IN1" and the values of the operands (IN2...Inn). All input operands have to be of the same numerical data type. If the result exceeds the range of the target data type, an overflow will be generated. The data type of the result corresponds to the data type of the input operands. In the Ladder Diagram, ADDs are available for the data type Integer and UInteger. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1: Input: First summand IN2...n: Input. further summands to add EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output: yields addition result

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

223

6 Ladder Diagram Editor

6.4.2.2.3.6 MUL
MUL multiplies the value of the operand "IN1" and the values of the operands (IN2...Inn) with each other. All input operands have to be of the same numerical data type. If the result exceeds the range of the target data type, an overflow will be generated. The data type of the result corresponds to the data type of the input operands. In the Ladder Diagram, MULs are available for the data type Integer and UInteger. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1: Input: First operand IN2...n: Input. further operands to multiply EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output: yields multiplication result

224

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.7 SUB
SUB subtracts the value of the operand "IN2" from "IN1". Both input operands have to be of the same numerical data type. If the result exceeds the range of the target data type (on subtracting negatives), an overflow will be generated. The data type of the result corresponds to the data type of the input operands. In the Ladder Diagram, SUBs are available for the data type Integer and UInteger. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1: Input: Minuend IN2. Input: Subtrahend EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output: yields subtraction result

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

225

6 Ladder Diagram Editor

6.4.2.2.3.8 DIV
DIV divides the value of the operand "IN1" by the values of the operand IN2. Both input operands have to be of the same numerical data type. If there is a remainder, the result will be truncated, i.e. always rounded down (e.g. 7 / 3 = 2 or (7) / 3 = (-2)). In the Ladder Diagram, DIVs are available for the data type Integer and UInteger. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1: Input: Dividend IN2: Input: Divisor EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output: yields division result

226

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.9 SHL
The bit pattern in the operand "IN" is shifted to the left by as many bits as specified in the operand "N". The empty binary digits to the right will be set to zero. The result is of the same data type as the input operand "IN". Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN: Input: BYTE, WORD or DWORD (as a bit pattern) N Input: Number of binary digits to shift EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output. Result

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

227

6 Ladder Diagram Editor

6.4.2.2.3.10 SHR
The bit pattern in the operand "IN" is shifted to the right by as many bits as specified in the operand "N". The empty binary digits to the left will be set to zero. The result is of the same data type as the input operand "IN". Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN: Input: BYTE, WORD or DWORD (as a bit pattern) N Input: Number of binary digits to shift EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output. Result

228

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.11 ROL
The bit pattern in the operand "IN" is rotated to the left by as many bits as specified in the operand "N". Bits that are "shifted off" to the left "re-enter" to the right. The result is of the same data type as the input operand "IN". Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN: Input: BYTE, WORD or DWORD (as a bit pattern) N Input: Number of binary digits to shift EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output. Result

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

229

6 Ladder Diagram Editor

6.4.2.2.3.12 ROR
The bit pattern in the operand "IN" is rotated to the right by as many bits as specified in the operand "N". Bits that are "shifted off" to the right "re-enter" to the left. The result is of the same data type as the input operand "IN". Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN: Input: BYTE, WORD or DWORD (as a bit pattern) N Input: Number of binary digits to shift EN: Input controlling the executing of the function ENO: Output controlling the execution of the function OUT: Output. Result

230

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.13 GT
The comparison function GT checks whether the input operand "IN1" is greater than the input operand "IN2". If this is true, the output yields "1", otherwise "0". For more than two arguments, the result is defined by {FUN := 1, iff INi > IN(i+1)}. Input operands may be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE or TIME. There will be a type conversion within the function. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1...n: Input: Operands to be compared EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

231

6 Ladder Diagram Editor

6.4.2.2.3.14 GE
The comparison function GE checks whether the input operand "IN1" is greater or equal than the input operand "IN2". If this is true, the output yields "1", otherwise "0". For more than two arguments, the result is defined by {FUN := 1, iff INi >= IN(i+1)}. Input operands may be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE or TIME. There will be a type conversion within the function. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1...n: Input: Operands to be compared EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

232

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.15 EQ
The comparison function EQ checks whether the input operand "IN1" equals the input operand "IN2". If this is true, the output yields "1", otherwise "0". For more than two arguments, the result is defined by {FUN := 1, iff INi = IN(i+1)}, i.e. all values must equal. Input operands may be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE or TIME. There will be a type conversion within the function. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails.

Prototype:

Meaning of operands: IN1...n: Input: Operands to be compared EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

233

6 Ladder Diagram Editor

6.4.2.2.3.16 LE
The comparison function LE checks whether the input operand "IN1" is less or equal than the input operand "IN2". If this is true, the output yields "1", otherwise "0". For more than two arguments, the result is defined by {FUN := 1, iff INi <= IN(i+1)}. Input operands may be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE or TIME. There will be a type conversion within the function. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1...n: Input: Operands to be compared EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

234

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.17 LT
The comparison function LT checks whether the input operand "IN1" is less than the input operand "IN2". If this is true, the output yields "1", otherwise "0". For more than two arguments, the result is defined by {FUN := 1, iff INi < IN(i+1)}. Input operands may be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE or TIME. There will be a type conversion within the function. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1...n: Input: Operands to be compared EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

235

6 Ladder Diagram Editor

6.4.2.2.3.18 NE
The comparison function NE checks whether the input operand "IN1" does not equals the input operand "IN2". If the values differ, the output yields "1", otherwise "0". For more than two arguments, the result is defined by {FUN := 1, iff INi <> IN(i+1)}, i.e. all values must be inequal equal. Input operands may be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE or TIME. There will be a type conversion within the function. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails.

Prototype:

Meaning of operands: IN1...n: Input: Operands to be compared EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

236

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.19 LEN
The function "LEN" calculates the length of a character string in characters. The data type of the input operand must be "STRING", while the output opernad has the data type "INT". Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

Meaning of operands: IN1: Input: Operand of data type STRING OUT: Output: Operand of data type INT EN: Input controlling the executing of the function ENO: Output controlling the execution of the function

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

237

6 Ladder Diagram Editor

6.4.2.2.3.20 LIMIT
The function "LIMIT" calculates the limit value. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

238

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.2.2.3.21 MOD
The function "MOD" is an arithmetic function calculating the remainder of a division. In the Ladder Diagram, DIVs are available for the data type Integer and UInteger. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

239

6 Ladder Diagram Editor

6.4.2.2.3.22 MOVE
The function "MOVE" is an arithmetic function that serves for assigning a value. In the Ladder Diagram, DIVs are available for the data type Integer and UInteger. Functions must have a EN input and an ENO output controlling the execution of the function. If "EN" is FALSE, the function is not executed and "ENO" will be set to FALSE. "ENO" may also be used as the error state of the function. These two parameters must be connected directly or via a sub-network with the currency rails. Prototype:

240

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.3 Combinations 6.4.3.1 AND


An AND combination corresponds to a serial connection of contacts or other network elements. An AND operation is true if both input variables have the value specified by the kind of contact. Example:

The AND combination in the example is true if the input variables have the following states: Input_1 1 Input_2 0 Input_3 1 The output variable AND_Result has the state 1. See also: Network OR Mixed combinations

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

241

6 Ladder Diagram Editor

6.4.3.2 OR
An AND combination corresponds to a parallel connection of contacts or other network elements. An AND operation is true if at least one input variables has the value specified by the kind of contact. Example:

The OR combination in the example is true if at least one of the input variables has a value as specified below: Input_1 1 Input_2 1 Input_3 0 The output variable OR_Result has the state 1. See also: Network AND Mixed combinations

242

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

6.4.3.3 Mixed combinations


Mixed combinations are a complex wiring made up of AND and OR combinations. The combination result is true if there is at least one way where "current" can flow between the left and the right output symbol. Example:

The combination in the example yields the value "true" if the input variables have the following values: Input_1 oder Input_3 1 Input_2 0 The output variable OR_AND_Result has the value 1. See also: Network AND OR

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

243

6 Ladder Diagram Editor

6.5 Online
6.5.1 General Information on the Online Editor
The Online Editor simulates the behaviour of an executable program on a SPS. An executable program is generated from within the Project Browser, where one ore many ressources and tasks can be compiled. A ressource can generally be thought of as an actually present control. A ressource consists of a name, a hardware description, a communication description and a list of tasks to be executed. A task can be thought of a running program, with some additional information on the kind of execution. A task is defined as a name, information on execution (e.g. cyclic), and an executable program.

See also: General Information on Ladder Diagramm Editor General Information on Ladder Logic Using the Online Editor

6.5.2 Using the Online Editor

244

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

6 Ladder Diagram Editor

Precondition: With aid of the Project Browser, at least one ressource and one task must have been defined and compiled (code generation). The Test and Commissioning Module (TUI) must be started, and a control must be active. From the "Online" menu, choose "Start". This activates the Online Editor. Instead of identifier names, you will see the current status values, and the load state will be displayed. Blue colour indicates LOW, while red colour indicates HIGH. Changes to the control will be displayed in the Online Editor instantaneously.

See also: General Information on Ladder Diagramm Editor General Information on Ladder Logic General Information on the Online Editor

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

245

7 The SFC-Editor

7 The SFC-Editor 7.1 Elements of Sequential Function Chart


SFC-plans are a tool for formulation of control flow of technical process, which are characterised by change of states. Every state transition is coupled on certain conditions. The sequential function chart offers the following language elements: Step: A step contains many actions. Actions contain code fragments. A step, which is executing, is called active. If a step is active, the contained actions will execute. A step can be activated by: 1. switching of a previous transition, 2. a jump element, 3. setting the initial flag (c.f. initial step). Initial step: Initial steps are active at the beginning of the program. Positions in the plan could be marked by initial steps, at which the execution starts on program start.
T1

STEP 1

STEP 1

Transition: The program flow is controlled temporally and structurally by switching of transitions. A transition will switch if the transition condition is true and all previous steps are active. Once the transition switches, all previous steps become inactive and all following steps become active. Simultaneous sequences: One transition may set active multiple steps at the same time, starting a parallel chain. If all previous steps of transition T1 are active and the transition condition is TRUE, all following steps (e.g., S1, S2) of the simultaneous sequence will activate. Convergence of simultaneous sequences: The chains of a simultaneous sequence are converged into a single transition. If all previous steps (e.g., S1, S2) are active and the condition of the following transition (T1) is TRUE, all previous steps will be deactivated while the steps following transition T1 will be activated.

T1

S1

S2

S1

S2

T1

246

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

S1

T1

T2

Divergence of sequence selection: Selection of a sequence step chain. If the step before the divergence is active, all transitions ( (e.g., T1, T2) are checked from left to right. The first transition evaluating to TRUE will switch, deactivating the step before and activating the step after. Convergence of sequence selection: The chains of a divergence of sequence selection are converged into a step. If one of the transitions switches, the steps before it will be deactivated, and the Step following it will be activated.

T1

T2

S1

T1 Init

Jump: The program flow is continued at another location. The name of the jump is the name of the activate step if the previous transition (T1) switches.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

247

7 The SFC-Editor

7.2 A program example


Init Door unlocked and everything switched off ff fff h l Door locked & ON-switch pressed ? Step 1 Unlock door and let water in Water amount value exceed?

Step 2

Hold water warm

Step 3

Turn drum cyclic during a definite time

Period of time for warm washing exceed ? Step 4 Washing out with clear water Time for washing out exceed? Step 5 Let out water Water level is lower than water amount value? Step 6

Dryer ON ?

Dryer OFF ?

Step 7

Therm. drying

Step 8

Turn drum cyclic

Lower than damp limit value ? Init Jump to Init


fig. 189: a washing process as SFC-plan

As an example, we consider the washing process of a washing machine. At base state, the washing machine is switched off and the door is unlocked (Init). The machine starts with the washing process if the door is locked and the ON-button is pressed. The washing process is 248
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

subdivided in definite phases, for example, the adding of water, the warming up, the cyclic turning of the drum (step 2 and step 3 parallel), the washing out with clear water (step 4), the let out of water (step 5), and finally, the drying (step 7 + step 8) if necessary. For every transition of a state, different conditions are valid as for example the water amount in the machine, the water temperature, the washing time, the air damp during the drying process, etc. The drying of the clothes consists of two parallel states which take place together, namely the mechanical crease protection (realised by a additional short time turning of the drum), and the thermal drying process. In the IEC-1131 these parallel states are described as simultaneous sequence. These are surrounded by a pair of horizontal double lines. Every simultaneous sequence starts and ends with a step. The transition following a simultaneous sequence will switch only if all simultaneous branches are executed completely. The drying of the clothes starts only if the corresponding switch at the machine is in position ON. This behaviour can be realised by use of a divergence of sequence selection (simple horizontal line). Divergences of sequence selection consist of several parallel branches with a transition as first element. If a divergence of sequence selection should be executed (previous step is active), beginning with the left branch, it is looking for a true boolean expression in the first transition of a branch, and only this branch is executed. In general, the IEC-1131 dictates us which sequential elements a SFC-plan must have, which predecessors and successors a SFC-element can have: Element step transition jump Predecesso r transition step Transition Successor transition step, jump

fig. 190: valid predecessors and successors of SFC-elements

Detailed explanations about the programming with the sequential function chart could be founded in [IEC1131] or [John & Tiegelkamp, 1995], for example.

7.3 Use of the SFC-Editor


7.3.1 Start of the editor from the browser
From the browser, the SFC-editor can be started by the - button of the toolbar or by selection of the menu item SFC of the Tools menu. A file of the directory project files with the appendix .sfc can be loaded by double click with the left mouse button, and the SFC-editor will be started automatically.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

249

7 The SFC-Editor

7.3.2 SFC-Editor User Interface

Declaration of local program variables

Display of the SFC-plan

Output of user messages

fig. 191 : the layout of the SFC-editor

The SFC-editor is a MDI-application, i.e. several SFC-plans could be opened and worked on simultaneously. Every SFC-plan consists of a text window for the declaration and the editing of local variable respectively. All variables, which should be used by the code of the transitions or steps, must be declared in this window. If the declaration of variables is forgotten, a compilation of the plan is impossible and corresponding error messages in the output window of the editor will be generated. In general, all errors, corresponding with the program translation, are printed in an output window as textual message. All SFC-plans share the same output window. By double click on an error line, the corresponding SFC-plan will be opened and additional sequential actions will be initiated in dependence of the cause of error (in the SFC editor V4.1, only the corresponding plan would be opened; use Edit Goto to find the erroneous line).

7.3.3 Creation of a new document


In the Project Manager, select File New SFC Program A dialog box will be opened prompting you for the name of the POU. Enter the name and press "OK". The SFC-Editor will be opened on that new POU

Every new document consists of a minimal SFC-program that means it consists of an initial step, a transition, and a finishing jump back to the initial step.

fig. 192: the SFC-plan of a new created document

250

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

7.3.4 Opening a chart


To open an SFC chart, double click the name in the Project Manager's treeview.

7.3.5 Saving
Use File Save to save the current result of your work.

7.3.6 Printing
Use File Print to print your SFC chart.

A dialog box will be shown asking for printer details. Click OK to start printing.

7.3.7 Form
The current version of the SFC-editor does not support the printing of OpenPCS-forms yet.

7.3.8 Page view


The page view makes it possible to show the printed form of a plan in the WYSIWYG-format on the screen. In this mode, one is informed about the necessary pages for printing out the entire program and the page numbers of definite program subsection.

7.3.9 Setting of marks


To edit the SFC chart, it is necessary to mark part of it. This selection can comprise only one element of the chart, a region of the chart, or the entire chart. Many operations offered by the SFC editor are related to the currently selected area. As the SFC Editor uses context sentitive menus, some menu items might be greyed depending on the current selection.

7.3.9.1 Single marks


Click the left mouse button to mark an element with the mouse.

fig. 193 : Marking a single element by aid of the mouse

The mark of a single element can be transformed into a neighbour element by aid of the cursor keys (,,,) of the keyboard.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

251

7 The SFC-Editor

7.3.9.2 Region marks


In order to execute a function on several elements of the SFC-plan, all corresponding elements must be marked.

fig. 194 : Marking of several elements region marks

Mark one element first, using mouse or keyboard. Hold the Shift-key pressed, and click another element with the mouse to select an entire region of the chart or hold the Ctrl-key pressed and click other elements to add them to the selection

In this version are no region marks possible by keyboard.

7.3.10 Editing of the graph-layout


To maintain the consistency of the graph, some operations are disabled depending on the current selection. Whether an operation is executable, depends on the mark (its impossible to shift left/right a branch of a divergence of a sequence selection if no branch of a divergence of a sequence selection was marked before). In addition, an operation is not allowed if it transforms the plan in an inconsistent state. An example of this is the deleting of a step in a transition step transition-sequence that would produce a transition transition-sequence which is not allowed. Operations, which are not executable, are not displayed in the menu or toolbar automatically. In principle, there is always the possibility to cancel every structural change of the plan by Edit Undo or to restore by Edit Redo.

7.3.10.1 Cut to the clipboard


By selection of the menu item Edit Cut, the marked elements are copied into the clipboard and are deleted from the plan afterwards. Previous elements, situated in the clipboard, are overwritten. In combination with the menu item Edit Paste, elements can be moved in the SFC-plan.

7.3.10.2 Copy into the clipboard


By selection of the menu item Edit Copy, all marked elements can be copied into the clipboard. Similar to cutting, all previous elements of the clipboard are overwritten. By

252

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

intermediate inserting and replacing respectively ( menu items under Edit Paste ), parts of the SFC-plan can be duplicated. Note that the copying creates new elements with the same name. You might want to modify these names after pasting from the clipboard to avoid the problems of having multiple objects with identical names.

7.3.10.3 Insert of elements from the clipboard


When inserting elements from the clipboard into the chart, you can select to replace the current selection, or to add it left or right to the current selection, if applicable. The content of the clipboard remains unchanged by the previous operations, and therefore, is available for further operations.

7.3.10.4 Deleting of the marked region


By selection of the menu item Edit Delete, the actual marked elements can be deleted. The connecting lines cannot be deleted from the plan.

7.3.10.5 Divergence of sequence selection branches shift left/right


The selection of the branch of a divergence of sequence selection, which has to execute, starts from left to right. Because of this fact, the order of the single branches is important. Use Edit Move Left and ... Right to arrange the branches in proper ordering.

7.3.10.6 Replacing of the mark by a steptransitionpair


By selection of the menu item Insert a step-transition-sequence. Step/Transition, the current selection can be replaced by

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

253

7 The SFC-Editor

7.3.10.7 Insert a jump

fig. 195 : Insert position of a jump

With Insert Jump, a jump can be inserted at the place of the current selection. The handle with jumps obeys strong restrictions in order to guarantee sure and executable networks by the editing functions of the SFC-editor. The SFC-editor restricts the occurrence of a jump at the last element of a divergence of sequence selection chain.

7.3.11 Declaration of variables


All variables used by SFC-elements must be declared before compilation. Example: VAR ImyVar:INT; BMyFlag: BOOL; END_VAR The OpenPCS-compiler expects the variable declaration in following order: - VAR_EXTERNAL - VAR_GLOBAL - VAR There is no possibility to declare variables which are only valid inside one plan element (step, transition).

254

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

7.3.12 Exception handling


During an execution of a SFC-program, situations could happen which require a specific change to execution logic in the program. The modelling of this exception handling is possible with additional standard plan elements (transitions, jumps, steps), but reduce the clarity of the program. The SFC-editor offers macros for the solution of this problem on the IL-level to activate or inactivate steps purposefully. The following commands are available: @ACTIVATE_STEP(StepName) @DEACTIVATE_STEP(StepName) @DEACTIVATE_ALL_STEPS() /* Activating of a step */

/* Inactivating of a step */ /* Inactivating of all steps */

These macros manipulate the internal execution control so that the given steps will be (in-)activated in the next cycle additionally. Attention: If the above commands are used in the IL-code, unsure or not executable networks could arise!

7.3.13 Editing of the program blocks


Steps and transitions need the IL-code fragments for their functionality. To edit the code, a text editor can be opened by Edit Edit when the corresponding element was marked. In this editor version, the code of transitions and steps can be given as IL-code only.

fig. 196 : Editing of the IL-code of a step

The names and the comment lines of an element can be adjusted by the appearing dialog under Edit Properties. Both named functions can be called by the context menu of an SFC-element equivalently. The context menu can be opened by a click with the right mouse button on the appropriate element.
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

255

7 The SFC-Editor

In the next sections, some specific remarks are given to the separate elements.

7.3.13.1 Transitions
Transition are responsible for the change of the active state of previous step(s) to the following step(s). Transitions show the possible change in form of a true, boolean statement (transition condition). The code of the transition has to be written so that the current result at the end of the code is of type BOOL. The transition switches if and only if the value of the accumulator is TRUE.

7.3.13.2 Steps and initial steps


The code of a step is executed cyclic if and only if this is an active state. In principle, one can say that the code is surrounded by a loop which is entered if a previous transition switches, and is left if a following transition switches. If a step was activated, its code is executed at least one time. Initial steps are always active at program start that means that no preceding transition is necessary. In standard, the entry-point into the IL-program is the first IL-element. Every step can be converted into an initial step by activating the control box initial step in the properties window. De-activating this switch will turn the initial step back into a normal step. The name of a step must meet following syntax: The first character of the step name is a letter (a-z, A-Z); every further character is a letter or a number (,0 9) or a underline (_).

Valid step names: Invalid step names:

Step1 _Step1

S_1 1Step

S1_ Heater off

Step names have a maximum length of 31 characters.

7.3.13.3 Jumps
Jumps are elements of a SFC-plan for controlling the flow of execution. With the up to now introduced elements, the activation of the steps happens always from top to button. For programming of cycles and similar things, a further possibility is necessary to activate previous steps. Jumps exist to provide this functionality. The predecessor of a jump element is always a transition. The target of a jump is always a step. The target of the jump is fixed by giving the jump the same name as the selected target-step. If a step is given as a target of a jump, its name must be unique. If a jump-target is not or more than once available, corresponding error messages are created during the syntax control. To guarantee the consistency of an SFC-plan, the insertion of a jump is possible only as the last element of a divergence of sequence selection.

7.3.14 Syntax control


The syntax control, integrated in the SFC-editor, tests the entire plan for logical consistency. Therefore, for example, jump-targets are tested for uniqueness or names of plan elements for validity. The syntax check is invoked during saving of the chart. If errors are detected during the control, no IL-code can be created! In order to avoid an inconsistency between the generated IL-program (extension *.poe) and the SFC-program (extension *.sfc), the content of the IL-file is deleted. If such a POU would be compiled anyway, the following error message would result: <Progname>.POE is not a program. Convert POU-Type or remove task from the resource. It occurred 1 error during the generation !

256

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

Objects, which creates errors during the syntax control, are marked by a small red lightning optically. By double click on the error lines, which appear in the output window, elements of the plan that cause this error or are in connection can be marked. For example, the following errors are recognised during the syntax control: 1. The jump has no valid jump-target

fig. 197: SFC jump with no valid target

2.

The jump has no unique jump-target

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

257

7 The SFC-Editor

fig. 198: SFC jump with no unique target

After the output of the error message, all objects that come into consideration as a possible jumptarget are listed. 3. The target of a jump is situated in a simultaneous sequence.

fig. 199: SFC jump into a simultaneous sequence

258

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

Jumps into simultaneous sequences are seen as a error because the token in a simultaneous sequence could leave the sequence only if every parallel branch has a token. But the jump into a simultaneous sequence gives a token only to one of the branches. The program has no initial

step.
fig. 200: SFC chart with no initial step

If a program has no initial step, no step can ever be activated. Therefore, the entire network is not executable. No IL-syntax errors are recognised during the syntax check. If mistakes are made in the variable declaration, in the code of the single steps or in the formulation of the transition conditions, these could be recognised only during the compilation in OpenPCS. Then, the compiler lists the corresponding line numbers of the POU-file which caused an error. In order to assign a line number of the POU-file to an element of the SFC-plan, Edit Goto IL-Line can be used to find this location in the SFC chart

fig. 201: SFC dialog "GoTo IL-Line"

If an element is found that fits to the line number, the text editor is opened automatically, to eliminate the error in the code. If an error in the variable declaration is found, its indicated by the following message box:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

259

7 The SFC-Editor

fig. 202: SFC Error messages on error in declarations

Then, the error must be removed in the variable declaration window.

7.3.15 The SFC-editor in online-mode


If a SFC-program is created and compiled successfully, it can be tested with the TUI. In the Project Manager, select Online Go Online on the proper resource Open the resource tree and select the task icon corresponding to the SFC program In the Project Manager, select Online Online-Editor to start the SFC-Editor in Online mode In the SFC-Editor, select online status display The online-modus helps to observe the control flow of a SFC-program which is situated in a control unit. Therefore, all active steps are marked by a red rectangle.

fig. 203 : Display of the active steps in the online-modus

7.4 The buttons of the toolbar


Icon Menu entry Short keys Description

File Edit

Save Cut

Ctrl + S Ctrl + X

Saving of the active document Cut the marked elements into the clipboard

260

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

7 The SFC-Editor

Edit Edit File File View Edit Edit

Copy Paste Print Print preview Zoom in Undo Redo

Ctrl + C Ctrl + V Ctrl + P

Copy the marked elements in the clipboard Replace of the marks by the elements of the clipboard Output of the program on the printer Preview of the printer output Zoom in Zoom out

View Zoom Out Ctrl + Z Ctrl + Y

Cancel the last alteration Cancel the command cancel again Help to the menu items

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

261

7 The SFC-Editor

262

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

8 The CFC-Editor
The OpenCFC -Editor (Continuous Function Chart Editor) is an engineering tool used to create automation programs graphically. The individual modules of a program are represented by function charts, which in their total form are projects. Predefined function blocks are transformed into block objects with the help of the OpenCFC -Editor, and then connected graphically into a function chart. A completed project composed of several function charts can be transferred to the controller and tested online. The OpenCFC -Editor allows for the documentation of a project: the function charts can be printed. The context menu is always available. Users can directly access the required menu commands by clicking the right mouse key. The online help system informs the user how to proceed with the creation of a CFC project. The OpenCFC -Editor has no limitations concerning the project size. The program will run on Windows 95 and Windows NT.

8.1 Styles and Symbols


An important advice. This should help to avoid mistakes, or remind you of an important requirement for the further development of the program. A tip which will make work easier or a further advice. A reference to the toolbar. It is beside an instruction which refers to a menu command also available in the toolbar. The corresponding symbol is displayed on the button.

8.2 Structure of the OpenCFC-Editor


The main window of the OpenCFC -Editor consists of a title bar, a menu bar, a toolbar and a status line. Within the main window one or more function charts can be optionally displayed in their own windows.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

263

8 The CFC-Editor

fig. 204: CFC Editor

The menu bar contains all necessary commands for creating and handling a program. For frequently repeated actions extra toolbar symbols can be chosen:

fig. 205 : CFC-Editor toolbar

The individual symbols have the following meaning: Create a new program Open an existing program Save program Preview a function chart Print an active function chart Search for a named connector or a block type Cut selected blocks to clipboard Copy selected blocks to clipboard Paste from clipboard to function chart Undo last action

264

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

Go to the upper level Enlarge section of active window; size of objects will decrease Reduce section of active window; size of objects will increase Insert a block from the library to the function chart Create connection between the selected connectors Create several connections with the connection tool Show/hide grid Information about OpenCFC -Editor The status information of the editor are displayed in the status line, e.g. details of the properties of a selected block connector or the functionality of a selected menu command. By selecting the appropriate commands in the view menu, the toolbar and the status line can be hidden or shown. Located on both vertical boundaries of the Function Chart window are margin bars. They consist of a set of margin connectors which can be used to create connections between different function charts or connections to the hardware. According to the selected format the width of a Function Chart window will be limited by three, five or seven blocks. Its length is free expandable; the single sheets of the function chart area are marked off on the screen by a horizontal line.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

265

8 The CFC-Editor

8.2.1 Creating a Program 8.2.1.1 Creating a new CFC program


In the Project Manager, select File Block. New CFC Program or File New CFC Function

A dialog box will be opened prompting you for the name of the POU. Enter the name and press "OK". The CFC-Editor will be opened on that new POU

fig. 206 : CFC-Editor with no chart opened

Select the desired format of the function chart and click the OK button. All menus of the OpenCFC -Editor will be displayed in the menu bar.

266

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

fig. 207: empty chart in CFC Editor

8.2.1.2 Show/Hide Grid


For better orientation during the creation of a function chart a grid, which divides the work area into single block fields, can be shown. Choose View Grid. The grid will appear in the currently active function charts.

fig. 208: CFC Editor with grid shown

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

267

8 The CFC-Editor

8.2.1.3 Adding Blocks to a Function Chart


A function chart is structured in rows and columns. The intersections of the rows and columns are the block fields. In each block field a single block can be placed; the size of the field will be adjusted automatically to fit the size of the block. Between the block fields there are narrow columns and rows which serve as connection channels. No blocks can be placed in these areas. The block library contains one block prototype of each available block type. When selecting a block from the library a copy of its prototype, a so-called instance, will be inserted into the function chart. When a block is placed into the function chart it receives an instance number, which appears in the left hand side of the block symbol below the block name. The allocation of numbers is automatic. Each block type will be numbered separately: beginning with 1 and incrementing for any further inserted block of the same type. Choose Insert Function Block to open the dialog Block Selection.

fig. 209: CFC-Editor: Insert Function Block dialog

Select the desired block from the function block list. According to its location in the work area, the pointer will change its form after a block has been selected. This simplifies the insertion of the block into the function chart. The pointer is in a free block field, in which a block can be placed. The pointer is in a connection channel, i.e. a block cannot be placed here. The pointer is in an occupied block field; if a new block is placed here, a column will be added and the block which has occupied the field will be shifted one grid space to the right.

268

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

Move the pointer to a block field. Click the left mouse button. The selected block will be placed in the field. The pointer returns to its original form.

fig. 210: block inserted into CFC chart

Insert further blocks into the function chart in the same way. Note the sequence of the program execution. The position of the blocks can be changed subsequently.

8.2.1.4 Connecting Blocks in a Function Chart


A connection can be created between a block output connector and one or more block input connectors. Loops, i.e. connections between an output and one or more inputs of the same block are also possible. The OpenCFC -Editor checks the data type of the connectors to be connected and only allows connections between connectors of the same data type. The connections are placed automatically in the provided connection channels. If its not possible to draw a continuous connection line in a connection channel, the connection will be replaced automatically by reference points.

fig. 211: connected blocks in CFC-Editor

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

269

8 The CFC-Editor

In order to create a connection between blocks of the same function charts, you must select the connectors to be connected. A connector is selected with a mouse click or by moving the cursor to the connector with the help of the arrow keys and pressing the space key.

8.2.1.4.1 Creating a Connection between an Output Connector and an Input Connector


First select the two connectors to be conntected. The sequence of selection is not relevant..

fig. 212: Output and Input connector marked

Select Insert line.

Single Connection. The two connectors will be connected with a connection

fig. 213: Output and Input connector connected

8.2.1.4.2 Creating a Connection between one Output Connector and Several Input Connectors
Each output connector can be connected to several input connectors. A connection between several output connectors and one input connector is not possible Select the output connector and the first input connector to be connected. Select the other input connectors while pressing the CTRL key.

fig. 214: Ouput and multiple Inputs marked

270

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

Choose Insert Single Connection. The selected connectors will be connected. The connection line coming from the output connector branches to the various inputs. The branching points will be represented as knots:

fig. 215: Output and multiple Inputs connected

8.2.1.4.3 Adding an Input Connector to an Already Existing Connection


Select the output connector of the existing connection which you want to extend with a further destination input connector. All connectors of the connection will be marked Select the input connector to be added while pressing the CTRL key

fig. 216: Connection line and Input marked

Choose Insert Single Connection. The existing connection will be extended with an additional input. In the example above it is represented by reference points.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

271

8 The CFC-Editor

fig. 217: Input added to connection line

8.2.1.5 The Connection Tool


If you wish to create a series of connections in one operation, the CFC editor supports you with the connection tool . Choose Insert Connection Tool. The pointer will change

Select the output and the inputs to be connected. With this tool it isnt necessary to press the CTRL-key. When you have all connectors marked, choose Insert Single Connection to create the connection. If a connection is to be made between a further output connector and an input connector, the output connector must be selected first. In this manner several connections can be created quickly and efficiently Choose Insert Connection Tool to switch off the connection Tool. The pointer will return to its original form:

8.2.1.6 The Margin Bar


The working area of OpenCFC is terminated on the left and right side with a marginbar. Each marginbar provides room for margin connectors. Initially, all margin connectors are empty and unused. To use a margin connector, give it a name. You can use margin connectors for different purposes: Connection to physical addresses (in IEC1131 notation: AT %I or AT %Q is possible only via margin connectors If you want to wire an output from the far right side of a chart to the far left, you can draw a direct connection or use margin connectors. Typically, using margin connectors will increase readability. In IEC1131 each margin connector will be mapped to the declaration 272
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

of a global variable.

8.2.1.6.1 Assigning a name to a margin connector


Choose Properties... in the context menu. The dialogbox Properties margin connector will open. Select option Identifier and enter a name in the field provided

fig. 218:Properties margin connector dialog

Hit OK. The name will be displayed in the margin connector

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

273

8 The CFC-Editor

fig. 219: Margin connector named

274

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

8.2.1.6.2 Connecting to a physical address


To connect a block to a physical address, the block has to be connected to the margin bar first, inputs to the left margin bar, and outputs to the right margin bar, respectively. You should assign names to the margin connectors used.

8.2.1.6.3 Connecting a block to the margin bar


Select the block connector you want to create the connection with Select a margin connector in the margin bar

fig. 220: Margin connector marked

Choose Insert Single Connection. The selected block connector and the margin connector will be connected

fig. 221: Input connected to margin connector

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

275

8 The CFC-Editor

8.2.1.6.4 Creating a connection


Choose Properties... in the context menu of the margin connector to be mapped to a hardware address, e.g. a named input connector. The dialog box Properties margin connector will open. Select the option Identifier and click the check box use IO. Enter the hardware address in the edit field memory location (at ...). Please note that the address you enter is not checked by the OpenCFC editor, but only by the compiler during compilation later. This is because legal hardware addresses are dependent on target system properties unknown to the OpenCFC editor.

fig. 222: Margin connector properties dialog

Choose the OK button. The memory location appears in the corresponding symbol of the margin connector

276

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

fig. 223: Input connected to margin bar with address

8.2.1.7 Assigning a Constant to an Input Connector


When a block connector is selected, the corresponding connector description and the data type appear in the status line. If you have assigned further properties to a connector, these will also be displayed in the status line.. Select the block input a constant is to be assigned to Choose Edit Properties.... The Properties window will open Choose the Input Value sheet, enter the required value and click theOK button

fig. 224: constant value input

The input value appears in the status line of the main window when the connector is selected .

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

277

8 The CFC-Editor

8.2.1.8 Zooming in and out


The View menu offers two commands in order to change the zoom factor of the function chart in the active window by steps. In the following example the function chart is shown in the standard size:

fig. 225: sample chart window

Choose View Zoom Out. A larger section of the function chart in the Function Chart window will be displayed without having to enlarge the window

fig. 226: sample chart window zoomed out

Choose View Zoom In if you want to enlarge the blocks of the function chart.

278

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

8.2.2 Editing a Program


The positioning on the work area, i.e. the shifting and adding of blocks is supported by the altering form of the mouse pointer. The pointer can adopt the following forms The mouse pointer is in an empty block field. The dragged blocks can be dropped here. The mouse pointer is in an occupied block field. A column will be inserted for the dragged block. If you have selected several blocks with a rubber band, the suitable quantity of columns and rows will be inserted. The mouse pointer is in an empty block field. The block copied to the clipboard can be placed. The arrangement of the other blocks will not be modified. If you have copied a group of blocks to the clipboard, the suitable quantity of columns will be inserted. The mouse pointer is in a connection channel which is restricted for blocks.

8.2.2.1 Opening a program


To open a CFC chart, double click the CFC chart in the Project Managers treeview.

8.2.2.2 Moving a block to an empty block field

fig. 227: CFC chart

Click the block to be shifted and drag it to the empty block field where it is to be placed while pressing the mouse button

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

279

8 The CFC-Editor

fig. 228: Moving block to empty field

Release the mouse button. The block will be placed in the empty block field. The existing connections will be preserved; the connection layout will be adjusted automatically to the new arrangement

fig. 229: block moved to empty field

8.2.2.3 Dragging a block to an empty field


Click the block to be moved, drag it to the destination block field while keeping the mouse button pressed down

fig. 230: sample chart with block dragged

280

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

Release the mouse button, dropping the block into the block field. Space will be provided as necessary, connections will be rearranged.

fig. 231: block dragged to empty field

8.2.2.4 Shifting a Group of blocks


It is possible to shift several selected blocks within a function chart. Drag a rubber band around the blocks to be shifted. Using the mouse, the blocks can be marked separately while pressing the CTRL key. A group of blocks selected in this manner can only be shifted, if the totality of the blocks is within an rectangular area like the marking with a rubber band

fig. 232: multiple blocks marked

Click one block within the selected area and drag it to the requested spot while pressing the mouse button. All selected blocks will be shifted; their arrangement among themselves will not be modified Release the mouse button if the destination position is reached. If there are not enough coherent and unoccupied block fields, the lacking amount of columns will be added. The connections within the selected area and to the other blocks will be preserved

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

281

8 The CFC-Editor

fig. 233: multiple blocks dragged

8.2.2.5 Copying or Shifting Blocks Using the Clipboard


A group of blocks can be put to the clipboard by copying or cutting. They can be inserted from the clipboard to any function chart. The connections within the inserted group will be preserved. Drag a rubber band around the blocks. Using the mouse, the blocks can be marked separately while pressing the CTRL key. A group of blocks selected in this manner can only be copied or cut, if the totality of the blocks is within an rectangular area likewise the marking with a rubber band

fig. 234: sample chart

Choose Edit Copy if you want to put a copy of the group of blocks to the clipboard Choose Edit Cut if you want to cut the group of blocks from the function chart to the clipboard Choose Edit Paste.

Locate the mouse pointer in the destination block area. If the group of blocks is to be inserted to another function chart activate the concerning function chart at first. Click the block field where the upper left block of the group is to be inserted. The remaining blocks will be arranged to the right and below this spot. 282
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

fig. 235: blocks pasted

Connect the blocks among themselves and create connections to other function charts of the project if required. The connections within the inserted area will be preserved

8.2.2.6 Deleting a Block


Select the block to be deleted Press the DEL key. The selected block will be deleted and the existing connections within function chart will be cut. If there are connections to the margin bar the connection information will be deleted

8.2.2.7 Changing Connections


It is possible to delete existing connections or to add new ones To delete a connection within one chart or between charts: Select a connected connector. Press the DEL key. The connection(s) of the selected connector to the function chart will be deleted To delete a connection to a margin connector Choose Properties... in the context menu of the margin connector with a connection to another function chart that should be deleted. The Properties Margin Connector window will open

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

283

8 The CFC-Editor

fig. 236: margin bar properties dialog

uncheck use I/O and press OK. The connection to the physical address will be deleted

284

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

8.2.2.8 Saving a program


Choose File Save if a program is to be stored . If the program exists already, it will be stored with its original name. If a new program is to be stored, the dialog box Save As will open.. Browse in the directory box and choose where the program is to be stored, edit the file name and click the OK button The extension .CFC will be added automatically

8.2.2.9 Documenting a Program


To print a program, each function chart has to be printed independently. Select File Print and press OK.

In case no printer or the wrong printer is installed, configure your printer Printer Setup. using File In the dialog box Printer Configuration a new printer driver can be installed or an installed printer can be chosen. Dependent on the type of printer, the sheet size and the print direction (vertical or horizontal) can be selected.

8.2.2.10 Using the help function The help function of the OpenCFC -Editor is following the standard MS-Windows help system.
The usage of the help system is the same as in any MS-Windows application. Hints can be found selecting the command Use Help in the menu Help. The help system of the OpenCFC -Editor offers all information that are required when you are working with the OpenCFC -Editor. In the summary there is a short list of the topics that allows to jump directly to a searched topic. Along with the help topics covering the particular procedures there are buttons which allow to jump to superior, related or more detailed topics. Additionally the user can always branch to Ba sics of the OpenCFC -Editor and Summary. All menu commands and dialog boxes are explained through the context-sensitive help. Select the menu item to which help is required and press the F1 key in order to fade in the corresponding help topic. In order to get information on a dialog box, open it and press the F1 key. All elements of the dialog box will be explained (Display fields, Edit fields, List boxes and buttons).

8.3 Advanced Topics


8.3.1 Online Debugging Programs
To debug a program written with OpenCFC online, perform the following steps: Write your program, compile it and download it to your controller Use the Test and Commissioning tool TUI to start your controller. Note the resource tree shown in the project browser.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

285

8 The CFC-Editor

fig. 237: TUI window

Locate entry in the resource tree representing your CFC program, mark it and Online Editor in the project browser. choose Online The OpenCFC Editor will be started, opening this very program. Select Online Online Current values will now be displayed for all visible connections, and periodically updated. To Online first. modify the program, select off Online

8.3.2 Execution Sequence


The arrangement of the blocks on a chart is directly related to the sequence of execution: Blocks are executed first column first from top to bottom, then second column top to bottom, and so on. To modify execution sequence, rearrange the blocks as required.

8.3.3 Modifying a block interface


OpenCFC stores, with each block, the interface of that block as it was when the block has been inserted into a chart. If you are using blocks you created yourself, using IEC1131 languages (instruction list, structured test, function block diagram, ladder diagram, or CFC), you might modify this block interface later. If you then re-load a block referencing such a block, CFC will notice the modification of the block interface and warn you showing the following message

286

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

fig. 238: block interface modified warning message

All instances of blocks with modified interfaces will be shown with question marks. To correct the chart, find all such instances and replace the blocks with correct blocks. Choose Edit Find.... The dialog box Find appears. Select the option Invalid Block. ..

fig. 239: Find-dialog

If the item is positioned outside of the currently visible section of a function chart, the section will be shifted so that the block or margin connector will be visible. If the discovered item is located in an invisible or closed function chart, the function chart will appear immediately

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

287

8 The CFC-Editor

8.3.4 Using forms for printing


Print forms are not supported with the current version of CFC.

8.3.5 Compound Blocks


Compound Blocks are a way to structure your application

8.3.5.1 Compound Blocks: Introduction


The work area of the CFC-Editor is limited to one page width. By selecting the paper size, you determine the number of blocks that can be placed horizontally. Vertically, a function chart can grow unlimited. Although in fact you are not limited in the length of your CFC chart, it is easy to loose overview on a too lengthy chart. Compound Blocks are a means to finer structure your application, hiding groups of logically related blocks inside one Compound Block. Signals between the blocks inside a Compound Block are not visible to the outside. Outside a Compound Block, only those signals are visible that enter or leave the Compound Block. On screen, double-click the Compound Block to see its contents. Use View Level up or in the toolbar to get back to the location where the Compound Block is being invoked. Compound Blocks can be nested, i.e. inside a Compound Block you can define, or use, other compound blocks. The contents of a Compound Block can be edited, you can add or delete blocks, rewire connections, add, modify or delete connections leaving or entering the Compound Block. On screen, the last input and output connector of a Compound Block is shorter than any other connector, so you can easily distinguish a Compound Block from other Blocks.

288

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

8 The CFC-Editor

8.3.5.2 Insert a new empty Compound Block


To create a new, empty Compound Block, 1. 2. 3. Select Insert Compound block...

The mouse cursor changes to Click the mouse where you want to insert the new Compound Block

You can now fill the Compound Block first, by double-clicking and editing it just like any other function chart. Or, add inputs and outputs to the Compound Block first, editing its contents later using the already provided inputs and outputs then.

8.3.5.3 Converting Blocks to a Compound Block


Whenever you run out of space on a chart, or think readability would be increased by more hierarchically grouping, you can collapse some of your already wired blocks into a Compound Block: 1. 2. 3. 4. Have the Block(s) selected Compound block... Select Insert CFC-Editor will prompt you to verify you want to convert the blocks to a Compound Block The selected Blocks will be removed from the chart and replaced by a Compound Block. All signals between these blocks will be moved with the Blocks, all signals to other blocks will be kept and changed to interface signals of the Compound Block.

8.3.5.4 Adding an input or output to a Compound Block


You can edit the contents of a Compound Block just like any other function chart. When you need to provide additional inputs, or need to provide additional outputs, you need to change the interface of the Compound Block accordingly. You can do this from the surrounding (top-down) or from within the Compound Block (bottom-up). top-down: 1. Any Compound Block has one very last connector which is shorter than the others. This is always the last connector, one on the left side as an input, one on the right side as an output. Wire this last input or output As soon as you use this last connector, it will be shown in full length, and another shorter connector will be added to the end.

2. 3.

Bottom-Up: (currently not supported yet)

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

289

9 Introduction into IEC1131

9 Introduction into IEC1131 9.1 Program Structure


The Programming Languages of OpenPCS are compliant to IEC1131-3. This manual describes the elements of these languages. Continuous Function Chart (CFC) is an extension to IEC1131 and is not covered in this manual.

Your application will be structured into small, independent units of code and data, called Program Organisation Units, which we abbreviate as POU. The German abbreviation is POE, which you will see in the software in some instances. There are three types of POUs: Program Function Function block IEC1131 defines a set of commonly used standard functions and function blocks, and OpenPCS provides most of these. If a program is structured into multiple POUs, on each call to another POU execution of the calling POU will be suspended, and resumed after return from the called POU. A call can be unconditional or conditional. Each POU is subdivided into a declaration part and an instruction part. All variables used in the instruction part have to be declared in the declaration part. Instructions as well as declarations may have comments, arbitrary character strings enclosed in (* and *). The entire POU is enclosed in keywords PROGRAM...END_PROGRAM or FUNCTION...END_FUNCTION or FUNCTION_BLOCK...END_FUNCTION_BLOCK. Example Typical Elements of a POU
PROGRAM smpl_pou (* Declaration part*) VAR Memory_1 : SR; (* Declare an instance of an FB of type SR *) ON_key AT %I0.0 : BOOL; (* Declare variables *) OFF_key AT %I0.1 : BOOL; Release : BOOL; Start : BOOL; . (* Declare more variables *) . END_VAR (* instruction part*) CAL Memory_1( Set1 := ON_key, (* Call FB with parameters *) ReSet := OFF_key) LD Memory_1.Q1 ST Release . (* and more instructions *) . END_PROGRAM (*End of Program*)

290

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Important Note OpenPCS is a portable, configurable programming system. Not all functions, datatypes, and other features described here are available with all controllers. If in doubt, see the vendor of your controller

9.2 Declarations
9.2.1 Datatypes
IEC1131 defines a set of elementary datatypes, plus means to define derived datatypes. The keywords for datatypes may be written in lower or upper case.

Elementary Datatypes The following table lists all elementary datatypes of IEC1131 with their keyword and default initial value. Any variable defined to be of a given type will have this default initial value unless it is declared as being different for this individual variable:
Keyword BOOL Datatype Boolean value, can be 1 or 0, which is the same as TRUE and FALSE. SINT Short Integer; values range from 128 to +127 INT Integer; values range from 32768 to +32767 DINT Double Integer; values range from 2147483648 to +2147483647 USINT Unsigned Short Integer; values range from 0 to 255 UINT Unsigned Integer; values range from 0 to 65 535 UDINT Unsigned Double Integer; values range from 0 to 4294967295 REAL Real number TIME Time duration value DATE Calendar date TIME_OF_DAY Time of day DATE_AND_TIME Calendar date and time of day STRING BYTE WORD DWORD Character string of variable length (for maximum length of strings, see 12.7.1) Bitstring of 8 bits Bitstring of 16 bits Bitstring of 32 bits Bits 1 8 16 32 8 16 32 32 Default 0 0 0 0 0 0 0 0.0 T#0s D#1900-01-01 TOD#00:00:00 DT 1900-01-0100:00:00 ' ' (Empty String) 0 0 0

8 16 32

Data types DATE, TIME_OF_DAY and DATE_AND_TIME are not supported by the current version of OpenPCS. Some standard functions and operations (called overloaded) can be used with only one datatype, but a variety of datatypes. The permitted datatypes for these is given as a generic datatype (starting with ANY...) according to the following hierarchy:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

291

9 Introduction into IEC1131

ANY

ANY_NUM

ANY_BIT

ANY_DATE

STRING

TIME

Abgeleitete Datentypen

REAL

ANY_INT

BOOL BYTE WORD DWORD

DATE TIME_OF_DAY DATE_AND_TIME

SINT INT DINT USINT UINT UDINT

fig. 241: Hierarchy of datatypes

Please note that you cannot use these generic datatypes (those starting with ANY...) to declare variables, not can you use it in a definition of your own functions or function blocks. BOOL R_EDGE and BOOL F_EDGE Datatypes BOOL R_EDGE (rising edge) and BOOL F_EDGE (falling edge) are offered as elementary datatypes in OpenPCS. These may be used only in the declaration of INPUT variables for Function blocks.

Derived datatypes Derived datatypes are defined by the manufacturer of your controller, or by yourself. These new datatypes are defined using keywords TYPE...END_TYPE, based on the elementary datatypes. After definition, they may be used just like predefined or elementary datatypes. Example: Derived datatypes In the following sample code, a new datatype is defined to represent a Pressure value
TYPE Pressure : INT; END_TYPE VAR PreValvePressure: Pressure; END_VAR

Declaration of a datatype with sub-range Using a derived sub-range datatype, you can restrict values for variables declared to be of this datatype. The behaviour if, due to the result of a calculation, a variable value should exceed the sub-range, is controller-dependent and not defined by IEC1131 nor by OpenPCS.

292

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

This feature is not implemented in Version 4.1 of OpenPCS Example: sub-range datatype We define a datatype to represent voltage, which is assumed to be below 150 Volts.
TYPE Voltage: INT (0..150); END_TYPE VAR Inlet: Voltage; END_VAR

The upper and lower limit is written separated by two dots with no blank in between.

Declaration of an enumeration datatype A variable of an enumerated datatype can take any one of a fixed list of values. The list of legal values is listed in the declaration of the enumeration datatype, separated by commas. An initial value may be given after the closing ); if no initial value is given, the first value will be the default. Example: Enumeration datatype Datatype TrafficLight can be red, yellow or green. Yellow shall be the default.
TYPE TrafficLight: (red, yellow, green):= yellow; END_TYPE VAR MainRoad : TrafficLight; CrossRoad : TrafficLight; StopCar: BOOL; END_VAR

In the instruction part of that POU, the defined enumerated values can be used: Example: IL
LD EQ ST MainRoad red StopCar

Declaration of an array datatype Arrays contain multiple elements of the same datatype. The keyword ARRAY is used to define an array. Each element of an array can be an elementary variable. Example: Array datatype Type Arr1 will hold five elements of type INT
PROGRAM feld TYPE Arr_5_INT:ARRAY [1..5] OF INT; END_TYPE VAR Arr1 : Arr_5_INT; END_VAR . END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

293

9 Introduction into IEC1131

Declaration of a structured datatype A structure holds multiple elements of same or different datatypes, elementary. Keyword STRUCT is used to define a structure. The individual elements of a structure are called members of that structure, and are accessed by writing the structure, followed by a dot and the name of the member. Example: Structured datatype
PROGRAM struktur TYPE RobotArm : STRUCT Angle_1 : REAL; Angle_2 : REAL; Grip: BOOL; Length: INT; END_STRUCT; END_TYPE VAR Robot1 : RobotArm; Robot2: RobotArm; END_VAR LD Robot1.Grip . . END_PROGRAM

294

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

9.2.2 Variables
Variables are names to represent memory locations which can hold different data values. There are two groups of variables: Variables mapped to physical (or logical) inputs, outputs or markers of a PLC, and Variables used only internally within the program to hold intermediate results Each variable has a name, starting with a letter (a-z) or an underscore. The variable name may contain digits, upper and lowercase letters and underscores, but not space, TAB or umlaut characters. The length of a variable name should not exceed 64 characters.

Directly represented variables Directly represented variables are those variables, that under the control of the programmer are mapped to a specific input, output or memory address. Keyword AT is used to declare this, and the address is specified in a string starting with a percent sign (%). Example: directly represented variables Declaration of a directly represented variable with and without a symbolic name
PROGRAM POU4 VAR AT %I0.0 : BOOL; In_1 AT %I0.1 : BOOL; Results : BOOL; END_VAR LD In_1 AND %I0.0 ST Results END_PROGRAM

It is strongly recommended to use symbolic names for directly represented variables, as this eases rewiring to different addresses. The declaration cannot be saved either.

Directly represented variables are only allowed in a POU of type PROGRAM!

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

295

9 Introduction into IEC1131

Syntax of the %... The syntax of the string starting with the percent sign is: % Location-Mnemonic Size-Mnemonic Number Dot Number where Location-Mnemonic is one of I: Digital-Input Q: Digital-Output M: Marker And Size-Mnemonic is one of

Mnemonic <none> X B: W: D:

Meaning Bit Bit Byte Word Doubleword

Size 1 Bit 1 Bit 8 Bit 16 Bit 32 Bit

Example %I0.0 %IX0.0 %IB0.0 %QW0.0 %ID4.0

Multiple Declaration Directly represented variables can be mapped to physical addresses so that more than one variable is mapped to the same, or partly the same address. A variable of a smaller size can be located completely within a variable of a larger datatype. This is helpful if done intentionally and disastrous if done unintentionally. Example: Multiple Declaration Variable Bit_Var will be mapped to the fifth bit of variable Word_Var. Variable Byte_Var is mapped to the higher byte of Word_Var.
VAR Bit_Var AT %I0.4:BOOL; Byte_Var AT %I1.0:BYTE; Word_Var AT %I0.0:WORD; END_VAR

Variable types All variables that you want to use in the instruction part of your POU have to be declared in the declaration part of this POU. There are different types of variables, depending on the keyword used to introduce the declaration section. The following list gives an overview:
Keywords VAR VAR_GLOBAL Usage Local Variable, only accessible in the defining POU. Global Variable, accessible from all parts of a program. Any other POU wishing to access this variable has to declare this as external. Declaration for a variable defined as global elsewhere. Input variable, only to be read from within the defining POU, and to be written by other POUs (typically the calling POU). Output variable, to be written by the defining POU and read by others (typically the calling POU) IN_OUT variable; in contrast to input and output variables, IN_OUT variables are passed by reference, not by value, i.e. the defining POU is handed a reference to the original variable by its calling POU. It may be read and written by the defining POU. Definition of local datatypes.

VAR_EXTERNAL VAR_INPUT VAR_OUTPUT VAR_IN_OUT

TYPE

296

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Each declaration section starts with the respective keyword and ends with END_VAR or END_TYPE. Local and global variable declarations can be attributed with the following attributes:
Keyword RETAIN Usage Use RETAIN to identify variables which should not be initialised at power-up (warmstart and hot-start). These variables retain there value over a power-failure (if properly supported by the controller). Use CONSTANT to flag variables that should not be written by the program. Using this keyword makes your program more self-documenting and helps you spot programming errors, if unintentionally you tried to write this variable Use AT to map variables to physical addresses

CONSTANT

AT

RETAIN typically is supported only for global variables, not for variables of a Function block. Example: Using RETAIN and CONSTANT Declaration of a remnant variable, a remnant function block instance, and a constant variable:
VAR RETAIN CounterValue : UINT; END_VAR VAR RETAIN Counter : CTU; END_VAR VAR_GLOBAL CONSTANT NullKelvin : INT := -273; END_VAR

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

297

9 Introduction into IEC1131

The following table lists which section of declarations is allowed in which type of POU: Section VAR_INPUT VAR_OUTPUT VAR_IN_OUT VAR_GLOBAL VAR_EXTERNAL VAR TYPE (1) Allowed, but only once (2) Allowed (2) (1) (2) (2) (1) (2) (1) FUNCTION (2) FUNCTION BLOCK (2) (2) (2) (2) PROGRAM

9.2.3 Instantiating Function blocks


With IEC1131, Function blocks cannot be called; only instances of function blocks can be called. Before, the instance has to be declared like any other variable. To declare an instance, declare it like any other variable by using the function block name as the datatype.
Counter1 : CTU;

This declares an instance Counter1 of function block CTU. Inputs and Outputs are parameterised with the call to an instance.

9.3 Instruction part of a POU


9.3.1 Instructions
Operator LD LDN ST STN S R AND & ANDN &N OR ORN XOR XORN ADD Operand ANY ANY_BIT ANY ANY_BIT BOOL BOOL ANY_BIT ANY_BIT ANY_BIT ANY_BIT ANY_BIT ANY_BIT ANY_BIT ANY_BIT ANY_NUM Meaning Load Operand into current result Load negated Operand into current result Store current result to operand Store negated current result to operand If current result is non-zero, set operand to TRUE. If current result is TRUE, set operand to FALSE. Boolean AND Boolean AND Negated Boolean AND Negated Boolean AND Boolean OR Negated Boolean OR Boolean exclusive OR Negated Boolean exclusive OR Addition

SUB MUL DIV GT GE EQ NE

ANY_NUM ANY_NUM ANY_NUM ANY ANY ANY ANY

Subtract Multiply Divide Compare for greater-than Compare for greater-equal Compare for equal Compare for non-equal

298

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

LE LT JMP JMPC JMPCN CAL CALC CALCN RET RETC RETCN

ANY ANY Label Label Label Instance name Instance name Instance name

Compare for less-equal Compare for less-than Unconditional jump Jump if current result is TRUE, Jump if current result is FALSE Unconditional call of function block instance If current result is TRUE, call function block instance If current result is FALSE, call function block instance Unconditional return to calling function If current result is TRUE, return to calling function If current result is FALSE, return to calling function

Syntax of an instruction
Label L1: Operator LD Operand %I0.1 Comment (* Load input bit *)

Label Operator Operand Comment

Mark the instruction to later jump here (optional) One of the available instruction, see table above typically a variable name, or instance name, or label Description of instruction (optional)

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

299

9 Introduction into IEC1131

Instruction List Syntax An instruction list sequence starts with a load-instruction (LD or LDN), or consists of a (unconditional) CAL, JMP or RET. IL sequences The following syntax graph shows the syntax for instruction list sequences.

fig. 242: definition of an IL sequence

Label-Definition Labels are used to mark instructions as a target for a jump.

300

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

9.3.1.1 Load Instructions

LD Load

Applicable Datatypes: all Description The value of the operand is evaluated and loaded into the current result. The operand is not modified. Example
Operation LD %I0.5 Operand 1 Note Assuming that %I0.5 is 1, this 1 is loaded into the current result Assuming that on Byte 0 a pattern of 11010100 is present, this 11010100 is loaded into the current result

LD %IB0.0

11010100

LDN Load negated

Applicable Datatype: ANY_BIT Description The operand is evaluated, and the current result is loaded with the negated value. The operand is not modified. Example
Operation LDN %I0.3 Operand 1 Note Assuming that a 1 is present at input it 0.3, a 0 is loaded into the current result Assuming that on Byte 0 a pattern of 11010100 is present, 00101011 is loaded into the current result

LDN %IB0.0

11010100

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

301

9 Introduction into IEC1131

9.3.1.2 Assignments
ST Assignment

Applicable Datatypes: all Description The value contained in the current result is stored to the operand. The datatype of the operand must match the datatype contained in the current result. Example
Operation ST %Q0.0 ST Result1 Current Result Note 1 Output bit 0.0 will be set to 1 1001100100001111 The bit pattern contained in the current result will be stored into Result1 Variables Val1 and Val2 will be set to 17

LD 17 ST Val1 ST Val2

STN Negated Assignment

Applicable Datatype: ANY_BIT Description The negated value of the current result will be stored into the operand. The current result will not be modified. Example
Operation STN %Q0.1 Current Result Note 1 Output 0.1 will be set to 0

302

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

S Set

Applicable Datatype: BOOL Description If the current result is TRUE, the operand will be set to TRUE. If the current result is FALSE, the operand will not be modified. The current result will not be modified in either case. Example
Operation

LD %I0.0 S %Q0.0

Current Result 1

Note

Assuming that input 0.0 is set, output 0.0 will be set

R Reset

Applicable Datatype: BOOL Description If the current result is TRUE, the operand will be set to FALSE. If the current result is FALSE, the operand will not be modified. The current result will not be modified in either case. Example
Operation

LD %I0.1 R %Q0.0

Operand values 1

Note

Assuming that input 0.1 is TRUE, output 0.0 will be reset

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

303

9 Introduction into IEC1131

9.3.1.3 Logical Operations

AND, & AND

Applicable Datatypes: ANY_BIT Description Replace the current result with the result of a binary boolean AND of the current result and the operand given. The previous value of the current result is lost, the operand is not modified. Example
Operation

LD %I0.0 AND Start

Operand status 1 0

Note

Assuming that input 0.0 is TRUE and variable Start is FALSE, variable Band will be set to FALSE. The two bitstrings will be ANDed bitwise.

ST Band LD %IB0.0

0 11001100

AND %IB1.0

10101010

ST Result

10001000

ANDN, &N negated AND

Applicable Datatypes: ANY_BIT Description Replace the current result with the result of a binary boolean AND of the current result and the negation of the operand given. The previous value of the current result is lost, the operand is not modified. Example
Operation LD %I0.1 ANDN Start ST Band LD %IB0.0 &N %IB0.1 ST Result Current Result 1 0 1 11001100 10101010 01000100 Note Assuming that input 0.1 is TRUE and variable Start is FALSE, variable Band will be set to TRUE.

The first bitstring and the negation of the second bitstring will be ANDed bitwise

304

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

OR OR

Applicable Datatypes: ANY_BIT Description Replace the current result with the result of a binary boolean OR of the current result and the operand given. The previous value of the current result is lost, the operand is not modified. Example
Operation

LD Input1 OR Input2

Current Result 1 0

Note

Assuming that Input 1 is TRUE and input2 is FALSE, variable OR_Bit will be set to TRUE

ST OR_Bit LD Byte_1

1 11001100

The two bit-strings will be ORed bitwise

OR Byte_2

10101010

ST OR_Byte

11101110

ORN negated OR

Applicable Datatypes: ANY_BIT Description Replace the current result with the result of a binary boolean OR of the current result and the negation of the operand given. The previous value of the current result is lost, the operand is not modified. Example
Operation

LD Input1

Current Result 0

Note

ORN Input2 ST ORN_Bit LD Byte_1

0 1 11001100

Assuming that Input1 is FALSE and Input2 is FALSE, variable ORN_Bit will be set to TRUE

The two bit-strings will be ORNed bitwise

ORN Byte_2 ST ORN_Byte

10101010 11011101

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

305

9 Introduction into IEC1131

XOR Exclusive OR

Applicable Datatypes: ANY_BIT Description Replace the current result with the result of a binary boolean exclusive OR of the current result and the operand given. The previous value of the current result is lost, the operand is not modified. Example
Operation

LD Input1 XOR Input2

Current Result 1

Note

Assuming that Input1 is TRUE and Input2 is TRUE, variable XOR_Bit will be set to FALSE

ST XOR_Bit LD Byte_1

0 11101111

The two bitstrings will be XORed bitwise

XOR Byte_2

10111110

ST XOR_Byte

01010001

XORN negated exclusive OR

Applicable Datatypes: ANY_BIT Description Replace the current result with the result of a binary boolean exclusive OR of the current result and the negation of the operand given. The previous value of the current result is lost, the operand is not modified. Example
Operation LD Input1 XORN Input2 ST XOR_Bit LD Byte_1 XORN Byte_2 ST XORN_Byte Current Result 1 1 1 11101111 10111110 10101110 Note Assuming that Input1 is TRUE and input2 is TRUE, variable XOR_Bit will be set to TRUE.

The two bitstrings will be XORNed bitwise

306

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

9.3.1.4 Arithmetic Operations

ADD Addition

Applicable Datatypes: ANY_NUM

Description Replace the current result with the sum of the current result and the given operand. The previous value of the current result is lost, the operand is not modified. See also function ADD in chapter 9.5.

Example
Operation LD 23 ADD Variable ST Sum Note Set Sum to the sum of variable and 23

SUB Subtraction

Applicable Datatypes: ANY_NUM

Description Replace the current result with the result of the given operand subtracted from the current result. The previous value of the current result is lost, the operand is not modified. See also function SUB in chapter 9.5

Example
Operation LD Minuend SUB Subtrahend ST Difference Note Set Difference to the difference between Minuend and Subtrahend

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

307

9 Introduction into IEC1131

MUL Multiplication

Applicable Datatypes: ANY_NUM

Description Replace the current result with the product of the current result and the given operand. The previous value of the current result is lost, the operand is not modified. See also function MUL in chapter 9.5

Example
Operation Note LD Multiplikand Set Produkt to the product of Multiplikand and MUL Multiplikator Multiplikator ST Produkt

DIV Division

Applicable Datatypes: ANY_NUM

Description Replace the current result with the quotient of the current result and the given operand. The previous value of the current result is lost, the operand is not modified. See also function DIV in chapter 9.5

Example
Operation LD Dividend DIV Divisor ST Quotient Note Set Quotient to the quotient of Dividend and Divisor

308

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

9.3.1.5 Comparisons

Applicable Datatypes: ANY Description The following comparisons are available: GT GE EQ LE LT NE greater greater or equal equal less or equal less not equal

The operand will be compared to the current result, and the current result will be set to TRUE if the comparison is correct, to FALSE else. The previous contents of the current result is lost. Example
Label Operation LD Num1 EQ Num2 JMPC M1 LD 1 ADD Num1 ST Num1 Note The variable Num1 is compared to Num2. If both are equal, a jump to label M1 will be executed, else variable Num1 will be incremented

M1:

Instructions without parentheses:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

309

9 Introduction into IEC1131

Instructions with parentheses:

310

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

9.3.1.6 Conditional and unconditional Jump

JMP Unconditional Jump

Applicable Datatype: the operand has to be a label Description The program will be continued at the label given as the operand. The label has to be set at the start of a sequence. The label and the Jump have to be within the same POU. Example
Label M1: Operation LD Num1 EQ Num2 JMPC M2 . . LD 1 ADD Num1 ST Num1 JMP M1 . . Note The following sequence will be skipped if Num1 and Num2 are equal

Increment Num1 and go back to label M1.

M2:

JMPC/JMPCN Conditional Jumps

Applicable Datatype: the operand has to be a label Description If the current result is TRUE (with JMPC) or FALSE (with JMPCN), execute a Jump to the label given, else continue with the next instruction after the Jump. The label has to be set at the start of a sequence. The label and the Jump have to be within the same POU. Example
Label M1: Operation LD Num1 EQ Num2 JMPC M2 LD 1 ADD Num1 ST Num1 JMP M1 Note Skip the following increment sequence, if Num1 equals Num2.

Increment Num1 and go back to label M1

M2:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

311

9 Introduction into IEC1131

9.3.1.7 Conditional and unconditional Return

RET Unconditional Return (RET)

Applicable Datatype: the Return instruction has no operand Description The execution of the current POU will be terminated. If programmed in a Function block or Function, execution will be transferred back to the calling POU. If programmed in a Program, execution will be transferred back to the PLC operating system. Example
Label Operation LD Error JMPCN M1 RET . . Note If Error is TRUE, the Jump will not be executed and the RET will end the current POU

M1:

RETC/RETCN Conditional Return

Applicable Datatype: the RETC and RETC instructions have no operands Description If the current result is TRUE (with RETC) or FALSE (with RETCN), a Return will be executed, else execution will be continued with the next instruction after the RETC/RETCN. Example
Operation LD Error RETC . . Note If Error is TRUE, the current POU will be terminated

312

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

9.3.1.8 Function block invocation

CAL Unconditional function block call

Description Execution will be transferred to the instance given as the argument. A CAL is not allowed in the mid of a sequence or nested in parentheses. Example
Operation . . ST Output2 CAL Block_2_Hz (Set:=Start, Period:=TimeVal) Note After the Store, instance Block_2_Hz is called

CALC/CALCN Conditional function block call

Description If the current result is TRUE(with CALC) or FALSE (with CALCN), the function block instance will be called. Example
Operation . . ST Output2 LD Result3 CALC Block_2_Hz (Set:=Start, Period:=TimeVal) . . Note If Result3 is TRUE, instance Block_2_Hz will be called

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

313

9 Introduction into IEC1131

9.3.1.9 Calling Functions

A function is called by using the function name as an operator, without any keyword. See chapter functions for more details.

9.3.2 Constants
With OpenPCS, there are two ways to use constant values: a) declare a variable with attribute CONSTANT, and assign the constant value to this value as an initial value in the declaration, b) write the constant as a literal constant directly in the instruction list. Example Variable Val1 shall be incremented by a constant value of 115, and stored into variable val2:
LD ADD ST val1 115 val2

Within a literal constant, underscores are allowed to increase readability. Such underscores have no meaning regarding the value of a constant. Literal constants for some datatypes require a special prefix:
Constant Datatype INT Example Meaning -13 Integer -13 45165 or 45_165 Integer 45165 (both) +125 Integer 125 REAL -13.12 Real 13,12 123.45 Real 123,45 0.123 Real 0,123 -1.23E-3 Real -0,00123 Dual number 2#0111_1110 or 126 126 Octal number 8#123 or 83 83 Hexadecimal number 16#123 or 291 291 BOOL 0 and 1 Boolean TRUE and FALSE values TRUE and FALSE STRING 'ABC' Character string ABC TIME T#12.3ms or Time duration of 12,3 milliseconds TIME#12.3ms T#12h34m or Time duration of 12 hours and 34 minutes T#12h_34m T#-4m Negative time duration of 4 minutes DATE DATE#1995-12-24 or Date 24.12.1995 D#1995-12-24 TIME_OF_DAY TOD#12:05:14.56 or 12 hours05 minutes and 14,56 seconds PM TIME_OF_DAY#12:05:14. 56 DATE_AND_TIME DT#1995-12-24Date and time: 12 hours05 minutes and 14,56 seconds PM 12:05:14.56 or on 24.12.1995 DATE_AND_TIME#199512-24-12:05:14.56

314

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Note: DATE, TIME_OF_DAY and DATE_AND_TIME are currently not supported by OpenPCS. Please see the important note in 2.1! Literal constants of datatypes TIME, DATE and DATE_AND_TIME uses keywords plus a hash sign #. The keywords can be written in long (e.g. DATE_AND_TIME) or short form (e.g. DT). A string constant is sequence of characters enclosed in . Special characters can be embedded within a character string literal by using escape sequences starting with the $ sign, as listed in the following table:
Predefined character Meaning constants '$'' The Apostrophe '$$' The $ sign itself '$L' or '$l' Line Feed '$N' or '$n' New Line '$P' or '$p' Form Feed '$R' or '$r' Carriage Return '$T' or '$t' Tabulator

Example
Character Constant 'A' '' '' '$R$L' '$0D$0A' Meaning and Length Single character A, length=1 Blank character, length=1 No character, length=1 Carriage Return, Line Feed, length=2 Carriage Return, Line Feed, length=2

9.3.3 Program
A program is the top-level structure of OpenPCS. A Program does contain declarations and instructions itself, but it does call other POUs to execute their code. Example Program POU1 Program POU1 with a call to function SHL (shift left) and function block CTU (count up)
PROGRAM POU1 (* Declarations *) VAR Counter1 : CTU; ShiftNum AT %IW2.0: WORD; ShiftDigits : UINT := 2; ShiftResult : WORD; Start AT %I0.0 : BOOL; AT %I0.1 : BOOL; Pulse AT %I0.2 : BOOL; AT %I0.3 : BOOL; Band AT %Q0.1 : BOOL; Stand : INT; END_VAR LD %I0.1 AND Start ST Band LD ShiftNum SHL ShiftDigits ST ShiftResult CAL Counter1(CU := Pulse, ReSet := %I0.3) LD Counter1.CV ST Stand END_PROGRAM

(* Declaration of Counter1 as CTU

*)

(* Instructions *)

(*call function and parameterise *)

(* Call FB and parameterise *)

(* Program end *)

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

315

9 Introduction into IEC1131

9.3.4 Functions
A function provides one means of re-usability. A function may have more than one input, but it always has exactly one output value (which may be an array or structure). A function is always accessible to all POUs of a project, there is no declaration needed to be able to call a function. There are no instances of functions. To call a function, the functions name is used as an operator, the current result is always used for the first parameter, more parameters are passed to the function as operands after the function name, separated by commas. The function returns its value by storing it into a variable having the name of the function (as PASCAL does). After the function call, the value returned by the function will be the current result. Function cannot store values over a call, give the same input parameters, a function shall always return the same output value. Example Function Sum Sample function Sum will compute the sum of three arguments:
FUNCTION SUM : INT VAR_INPUT A : INT; B : INT; C : INT; END_VAR LD A ADD B ADD C ST SUM END_FUNCTION
SUM INT A INT B INT C INT

(* Declarations *)

(* instructions*)

Example Program POU2 Calling Function SUM of above


PROGRAM POU2 VAR SUMMAND1 : INT:= 1; SUMMAND2 : INT:= 2; SUMMAND3 : INT:= 3; RESULT : INT; END_VAR LD SUMMAND1 SUM SUMMAND2, SUMMAND3 ST RESULT END_PROGRAM

(* Load First parameter into current result *) (* call function and pass more arguments *) (* store function result *)

A function may call other functions, but it may not instantiated nor call instances of function blocks, and function blocks are not allowed as parameters to functions. Besides defining your own userdefined functions, you can use many standard functions that come already with OpenPCS.

316

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

9.3.5 Function blocks


Besides Functions, function blocks are the second way of re-usability in IEC1131 and OpenPCS. Other than functions, a function block may have more than one output, it may store values from one call to the next. A function block may call other functions, it may instantiate other function blocks and invoke instances of function blocks.
Usage Example from within FB LD IN1 AND IN2 ST Q1 Not allowed Example from outside FB LD FBx.IN1 ST %QW3.0

Read input

Write input

Read Output

LD OUT1 AND IN1 ST OUT1 LD 1000 ST OUT1

Write Output

LD Start ST FBx.IN1 CAL FBx CAL FBx(IN1 := Ein, ...) LD FBx.OUT1 ST %QW3.0 Not allowed

A function block input may be declared as being edge detective Example Edge Detection Rising Edge VAR_INPUT Start : BOOL R_EDGE; END_VAR Falling Edge VAR_INPUT Pause : BOOL F_EDGE; END_VAR

IEC1131 defines different ways to pass parameters to function blocks. The following example will demonstrate these: Example function block average A simple function block to compute the average of two numbers, and its invocation from a program POU3
FUNCTION_BLOCK average VAR_INPUT Val1 : USINT; Val2 : USINT; END_VAR VAR_OUTPUT AvgVal : USINT; END_VAR

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

317

9 Introduction into IEC1131

LD Val1 ADD Val2 DIV 2 ST AvgVal END_FUNCTION_BLOCK

average USINT Val1 AvgVal USINT

USINT val2

Example Program POU3 Instantiate function block Average, and two different invocations
PROGRAM POU3 VAR Instance1_Name : Average; Instance2_Name : Average; MessVal1 AT %IB0.0 : USINT; MessVal2 AT %IB1.0 : USINT; Result1 AT %QB0.0 : USINT; Result2 AT %QB1.0 : USINT; END_VAR (* 1. Method of FB call *) CAL Instance1_Name (Val1:= MessVal1, Val2:= MessVal2) LD Instance1_Name.AvgVal ST Result1 (* 2. Method of FB Call *) LD MessVal1 ST Instance2_Name.Val1 LD MessVal2 ST Instance2_Name.Val2 CAL Instance2_Name LD Instance2_Name.AvgVal ST Result2 END_PROGRAM

Function block Average exists only once, but multiple instances of it may be declared with different names (here: Instance1_Name and Instance2_Name). Although not shown in this example, it is definitely possible to call one instance more than once. Each instance will receive its own copy of all data associated with function block Average. Parameters are passed to the function block a) as arguments to the CAL instruction, enclosed in parentheses b) before the call by storing some value into the proper member variable (e.g. ST Instance2_Name.Val1). c) not at all, in which case the input will be left to the value it was assigned last, or the initial value.

To access output variables, IEC1131 defines only one way, and that is to access outputs like structure members (similar to b above). But OpenPCS provides an extension to IEC1131 to access output variables directly as an argument to the CAL operation, similar to a above:

318

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Example
CAL Instance3_name (Val1:=MessVal1, Val2 := MessVal2 | Result3 := AvgVal)

9.4 Other Programming Languages


9.4.1 Other Programming Languages
Besides Instruction List, OpenPCS offers other languages. On the one hand, these are the languages as defined by IEC1131: Ladder Diagram (LD) Function Block Diagram (FBD) Structured Text (ST) Sequential Function Chart (SFC)

On the other hand, in extension to IEC1131, OpenPCS features additional the language Continuous Function Chart (CFC)

The languages Ladder Diagram and Function Block Diagram will be explained in the following chapters. For more information on the other languages and their respective editors see the other manuals. Not all these languages are supported in all versions of OpenPCS. If in doubt, check with the vendor of your controller.

9.4.2 LD and FBD: Introduction


OpenPCS supports the two graphical languages defined by IEC1131, Ladder Diagram (LD) and Function Block Diagram (FBD). A POU created in Ladder Diagram or Function Block Diagram consists of a declaration part and an instruction part, just like a POU in instruction list. The declaration part is edited with the same declaration editors as in the instruction list editor. The instruction part will be shown graphically. The instruction part is divided into networks, each network has a network number on its top. Close to the network number an optional network comment can be displayed.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

319

9 Introduction into IEC1131

9.4.3 Programming in Ladder Diagram


Programming language Ladder Diagram is suited for logical expressions of binary variables. Programs in Ladder Diagram are shown with the following graphical elements: Contact: Check variable for value TRUE Negated contact: check variable for value FALSE Coil: store result to variable Negated coil: store negated result to variable Set: set variable to TRUE if expression evaluates to TRUE Reset: set variable to FALSE if expression evaluates to TRUE Unconditional jump to label Label Conditional jump: if result is TRUE, jump to label Label Negated conditional jump: if result is FALSE, jump to label Label Unconditional return: terminate current POU and return to caller Conditional jump: if result is TRUE, terminate current POU and return to caller Negated conditional jump: if result is FALSE, terminate current POU and return to caller

Each ladder network is divided into two parts. The left part is reading input variables (contacts), the right part is using the evaluated expression and storing the result into other variables (coils), or executing conditional instructions based on the result of the expression. The terminating right part of a ladder network can be An assignment A conditional jump to a label A conditional return to the caller The result of an expression can be stored to a variable: Store result to variable Store negated result to variable: The number of output variables is unlimited. For each variable in an assignment, use at most 64 characters. The number of characters that can be displayed on screen depends on the resolution of your screen, at most three lines are being used.

320

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

AND operation An AND operation in Ladder Diagram is done by putting multiple contacts in sequence. All contacts must evaluate to TRUE to have power flow through the rung:

The logic shown will be TRUE and hence set variable AND_Result to TRUE if and only if the input contacts have the following values: Variable Input_1 Input_2 Input_3 Value 1 0 1

OR-Operation An OR-operation is done in Ladder Diagram by putting contacts in parallel. At least one of the parallel rungs must evaluate to TRUE for the logic to evaluate to TRUE.

The logic shown will be TRUE, and hence output variable OR_Result will be set to TRUE, if any of the variables has the value shown in the following table: Variable Input_1 Input_2 Input_3 Value 1 1 0

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

321

9 Introduction into IEC1131

Mixed Logic Complex expressions represented by parallel and sequential expressions in Ladder Diagram will evaluate to TRUE if any one rung has power flow from the left rail to the right rail:

The logic shown will evaluate to TRUE, and hence set variable OR_before_AND_Result to TRUE, if and only if the input variables have the values as shown in the following table: Variable Input_1 or Input_3 Input_2 Value 1 0

Negated Assignment An output variable can be assigned the negation of the current result. This will be shown by a slash in the assignment symbol.

Storing Assignment An output variable can be assigned storing, either set or reset.
Set If the current result is TRUE, the output variable will be set. If the current result is not TRUE, the output variable will not be modified. This operation is shown with the letter S in the assignment symbol. Reset If the current result is TRUE, the output variable will be reset. If the current result is not TRUE, the output variable will not be modified. This operation is shown with the letter R in the assignment symbol.

Jumps Jumps and Labels are a means of structuring your code within one POU. Jumps can be programmed to be unconditional or conditional, like in any other language of IEC1131.
Unconditional Jump An unconditional jump will be done regardless of the value of the current result. In Ladder Diagram, an unconditional jump is always a network on its own.

322

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Conditional Jump A conditional jump (JMPC) is executed if the current result is TRUE; a negated conditional jump (JMPCN) is executed if the current result is FALSE. Otherwise, execution will be continued with the first instruction after the conditional jump.

Return A Return will terminate the execution of the current POU and transfer it back to the calling POU, or the operating system of the PLC. A Return, like a jump, can be conditional or unconditional.
Unconditional Return An unconditional return will terminate the execution of the current POU. In Ladder Diagram, an unconditional return is always a network on its own.

Conditional Return A conditional Return (RETC) will terminate execution of the current POU only if the current result is TRUE; a negated conditional return (RETCN) will terminate execution of the current POU only if the current result is FALSE. Otherwise, execution will continue with the next instruction after the conditional return.

Calling Functions A network containing a function call will be displayed in language Function Block Diagram, even if edited in the Ladder Diagram editor. Functions are displayed as rectangular boxes, and more than one function can be used in one network, like in Function Block Diagram.

Calling Function blocks An invocation of a function block instances is shown as a network of its own, identically in Ladder Diagram and in Function Block Diagram. Inputs are visualised on the left side of the box, outputs on the right. On the top of the box is the name of the instance (outside the box) and the name of the function block type (inside the box). It is not required by IEC1131, and neither by OpenPCS, that any or all inputs and/or outputs of a function block be connected to symbols. Any input of a function block instance can be given a value by using it as an operand of an assignment, close or not to the function block invocation.

With OpenPCS, only unconditional calls (CAL) to function block instances are possible in graphical languages Ladder Diagram and Function Block Diagram, but no conditional calls (CALC, CALCN). Use a conditional Jump (JMPC, JMPCN) over an unconditional call if you need a conditional call to be representable in Ladder Diagram and Function Block Diagram.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

323

9 Introduction into IEC1131

9.4.4 Programming in Function Block Diagram


Programming Language Function Block Diagram displays most language elements as rectangular boxes. Multiple operations and function calls can be used in one single network, but function block calls are each displayed as networks of their own. The following elements are used in language Function Block Diagram: Operation with two input variables, used for logical, arithmetical and comparison operations. With logical operations, inputs can be negated (visualised by a small circle).

Assignment of current result to a variable

Assignment of negated current result to a variable

Set variable to TRUE if current result is TRUE Reset variable to FALSE if current result is TRUE Unconditional jump to label Label Conditional jump to label Label if current result is TRUE Conditional jump to label Label if current result is FALSE Unconditional return to caller Conditional return to caller if current result is TRUE Conditional return to caller if current result is FALSE

Function Call (manufacturer defined or user defined)

Function block invocation

Variable names are limited to a maximum of 64. At most three lines of variable names are displayed, the exact number of characters depending on your font selection, screen resolution, etc. 324
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Logical operations Logical operations AND, OR and XOR are displayed as a box with two or more inputs and one output. Individual inputs can be negated, in which case the input will be negated first, then the logical expression be evaluated. Negation is visualised by a small circle beneath the input. Like in language Ladder Diagram, the result of an expression can be used for an output operation terminating an Function Block Diagram network: Assignment Conditional jump Conditional return
AND operation The AND-operation will do a logical AND on its inputs. If used on bitstrings (BYTE, WORD, etc.), the operation is done bitwise.

In the example shown, AND_Result will be TRUE if Input_1 is TRUE and Input_2 is FALSE
OR operation The OR-operation will do a logical OR on its inputs. If used on bitstrings (BYTE, WORD, etc.), the operation is done bitwise.

In the example shown, variable OR_Result will be set to TRUE, if either (or both) of Input_1 and Input_2 is TRUE.
Exclusive OR operation The XOR-operation will do a logical XOR on its inputs. If used on bitstrings (BYTE, WORD, etc.), the operation is done bitwise.

Mixed operations A network may contain any sequence of logical operations. A logical operation that should include more than two inputs can be programmed in two different ways: a) by extending the number of inputs of one operation b) by adding another box of the same operation at one of the inputs
Negating intermediate values To negate the intermediate result of a computation, insert a NOT function call.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

325

9 Introduction into IEC1131

Assignment The current result, or the negated current result, can be assigned to any variable: Symbol for assignment:

Symbol for negated assignment:

A negated assignment of bitstrings will do the negation bitwise. The negation will not modify the current result. Only datatypes ANY_BIT can be assigned using the negated assignment.

Storing Assignment The current result can be assigned storing


Set If the current result is TRUE, the output variable will be set to TRUE. If the current result is FALSE, the output variable will be left unchanged. The Set-Assignment is visualised by a box with letter S. Reset If the current result is TRUE, the output variable will be set to FALSE. If the current result is FALSE, the output variable will be left unchanged. The Reset-Assignment is visualised by a box with letter R.

Arithmetic Operations Operations Addition, Subtraction, Multiplication and Division are available to be used with numeric datatypes.
Comparison Operations The comparison operations will compare the value of the first operand (the upper one) with the value of the second operand (the lower one). The current result will be set to reflect the result of this comparison. The comparison operations are visualised by a box with the name of the comparison written in it:

GT GE EQ NE LE LT

greater than greater or equal equal not equal less or equal less than

326

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Example: Comparison for greater-than:

The conditional jump to label mark_1 will be executed, if the value of number_1 is greater than the value of number_2.

Jumps Jumps are a means to structure the code of your application within one POU. Jumps can be programmed to be conditional or unconditional:
Unconditional jump An unconditional jump will transfer execution to the label given as an argument, regardless of the value of current result. An unconditional jump is shown as a network of its own. Conditional Jump A conditional jump will, depending on the value of the current result, transfer execution to the label given as an operand. The jump will be made if the current result is TRUE for a normal conditional jump (JMPC), and it will be made if the current result is FALSE for a negated conditional jump (JMPCN).

Return A RETURN will terminate the execution of the current POU and transfer it back to the calling POU, or the operating system of the PLC. A Return, like a jump, can be conditional or unconditional.
Unconditional Return An unconditional return will terminate the execution of the current POU. An unconditional return is shown as a network of its own. Conditional Return A conditional Return (RETC) will terminate execution of the current POU only if the current result is TRUE; a negated conditional return (RETCN) will terminate execution of the current POU only if the current result is FALSE. Otherwise, execution will continue with the next instruction after the conditional return.

Calling Functions Functions are displayed as rectangular boxes, and more than one function can be used in one network.

Calling Function blocks An invocation of a function block instances is shown as a network of its own, identically in Ladder Diagram and in Function Block Diagram. Inputs are visualised on the left side of the box,
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

327

9 Introduction into IEC1131

outputs on the right. On the top of the box is the name of the instance (outside the box) and the name of the function block type (inside the box). It is not required by IEC1131, and neither by OpenPCS, that any or all inputs and/or outputs of a function block be connected to symbols. Any input of a function block instance can be given a value by using it as an operand of an assignment, close or not to the function block invocation.

With OpenPCS, only unconditional calls (CAL) to function block instances are possible in graphical languages Ladder Diagram and Function Block Diagram, but no conditional calls (CALC, CALCN). Use a conditional Jump (JMPC, JMPCN) over an unconditional call if you need a conditional call to be representable in Ladder Diagram and Function Block Diagram.

9.5 Functions (IEC1131)


OpenPCS comes with a variety of standard functions and standard function blocks according to IEC1131. The following table provides an overview:
Function *_TO_** TRUNC ABS SQRT LN LOG EXP Purpose Type Conversion Integer part of real number Absolute value Square root of a real number Natural Logarithm of a real number Logarithm of a real number to the base 10 Exponential function of a real number to the base e Sinus of a real number Cosinus of a real number Tangens of a real number Arcus sinus of a real number Arcus cosinus of a real number Arcus tangens of a real number Addition Multiplication Subtraction Division Modulo Shift left Shift right Rotate left Rotate right Logical AND Logical OR Logical exclusive OR Bitwise negation Negation Compare for greater-than Compare for greater or equal Compare for equal Compare for less-or-equal Compare for less-than Compare for not-equal Length of character string First part of character string 1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

SIN COS TAN ASIN ACOS ATAN ADD MUL SUB DIV MOD SHL SHR ROL ROR AND, & OR XOR NOT NEG GT GE EQ LE LT NE LEN LEFT

328

9 Introduction into IEC1131

RIGHT CONCAT FIND

Last part of character string Conclusion of character strings Position of a part of a character string

For some functions, operators exist to be used in language instruction list. The following description of all standard functions shows the prototype of each function in graphical format, with datatypes and symbolic names of inputs and outputs as appropriate. Example Prototype The following textual prototype definition for standard function SHR...
FUNCTION SHR : ANY_BIT VAR_INPUT IN : ANY_BIT; N : UINT; END_VAR END_FUNCTION

...corresponds to this graphical prototype:

SHR ANY_BIT IN UINT N ANY_BIT

Overloaded Functions Some functions, like SHR shown above, can be applied not only to one datatype of operands, but to a variety of datatypes. For function SHR, this is shown by giving the generic datatype ANY_BIT as the datatype for input argument IN. Only manufacturer defined functions may be overloaded, this is not possible for userdefined functions. See fig. 241: Hierarchy of datatypes on page 292 for a list of generic datatypes and their meaning. The syntax for calling a function is language specific, see the respective sections in this manual.

Type conversion functions


*_TO_** * **

*_TO_** * **

Function name Datatype of input Datatype of output

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

329

9 Introduction into IEC1131

IEC1131, and so OpenPCS, is very strict with datatypes. Unlike in traditional PLC programming languages, the input values of an operation must have exactly the required datatypes, else the compiler will throw an error message and not compile the program. Therefore, type conversion functions are provided to implement all reasonable conversions between the individual datatypes. All type conversion functions have only one input, and this always will be the current result. Type conversion function will in general, for performance reasons, not implement any range checking. So if converting to a datatype with a restricted range, be aware of this. The following type conversion functions are available with OpenPCS:
BOOL_TO_BYTE BOOL_TO_DINT BOOL_TO_DWORD BOOL_TO_INT BOOL_TO_REAL BOOL_TO_SINT BOOL_TO_STRING BOOL_TO_UDINT BOOL_TO_UINT BOOL_TO_USINT BOOL_TO_WORD BYTE_TO_BOOL BYTE_TO_DINT BYTE_TO_DWORD BYTE_TO_INT BYTE_TO_REAL BYTE_TO_SINT BYTE_TO_STRING BYTE_TO_UDINT BYTE_TO_UINT BYTE_TO_USINT BYTE_TO_WORD DINT_TO_BOOL DINT_TO_BYTE DINT_TO_DWORD DINT_TO_INT DINT_TO_REAL DINT_TO_SINT DINT_TO_STRING DINT_TO_TIME DINT_TO_UDINT DINT_TO_UINT DINT_TO_USINT DINT_TO_WORD DWORD_TO_BOOL DWORD_TO_BYTE DWORD_TO_DINT DWORD_TO_INT DWORD_TO_REAL DWORD_TO_SINT DWORD_TO_STRING DWORD_TO_UDINT DWORD_TO_UINT DWORD_TO_USINT DWORD_TO_WORD INT_TO_BOOL INT_TO_BYTE INT_TO_DINT INT_TO_DWORD INT_TO_REAL INT_TO_SINT INT_TO_STRING INT_TO_UDINT INT_TO_UINT INT_TO_USINT INT_TO_WORD

330

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

REAL_TO_BOOL REAL_TO_BYTE REAL_TO_DINT REAL_TO_DWORD REAL_TO_INT REAL_TO_SINT REAL_TO_STRING REAL_TO_UDINT REAL_TO_UINT REAL_TO_USINT REAL_TO_WORD SINT_TO_BOOL SINT_TO_BYTE SINT_TO_DINT SINT_TO_DWORD SINT_TO_INT SINT_TO_REAL SINT_TO_STRING SINT_TO_UDINT SINT_TO_UINT SINT_TO_USINT SINT_TO_WORD STRING_TO_BOOL STRING_TO_BYTE STRING_TO_DINT STRING_TO_DWORD STRING_TO_INT STRING_TO_REAL STRING_TO_SINT STRING_TO_UDINT STRING_TO_UINT STRING_TO_USINT STRING_TO_WORD TIME_TO_DINT TIME_TO_UINT TIME_TO_USINT UDINT_TO_BOOL UDINT_TO_BYTE UDINT_TO_DINT UDINT_TO_DWORD UDINT_TO_INT UDINT_TO_REAL UDINT_TO_SINT UDINT_TO_STRING UDINT_TO_UINT UDINT_TO_USINT UDINT_TO_WORD UINT_TO_BOOL UINT_TO_BYTE UINT_TO_DINT UINT_TO_DWORD UINT_TO_INT UINT_TO_REAL UINT_TO_SINT UINT_TO_STRING UINT_TO_UDINT UINT_TO_USINT UINT_TO_WORD USINT_TO_BOOL USINT_TO_BYTE USINT_TO_DINT USINT_TO_DWORD USINT_TO_INT USINT_TO_REAL USINT_TO_SINT USINT_TO_STRING USINT_TO_UDINT USINT_TO_UINT USINT_TO_WORD WORD_TO_BOOL WORD_TO_BYTE WORD_TO_DINT WORD_TO_DWORD WORD_TO_INT
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

331

9 Introduction into IEC1131

WORD_TO_REAL WORD_TO_SINT WORD_TO_STRING WORD_TO_UDINT WORD_TO_UINT WORD_TO_USINT

332

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

ABS Absolute Value

ABS ANY_NUM ANY_NUM

Description ABS will compute the absolute value of the input.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

333

9 Introduction into IEC1131

334

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

ACOS Arcus cosinus

ACOS REAL REAL

Description ACOS will compute the arcus cosinus of the input

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

335

9 Introduction into IEC1131

ADD Addition

ADD ANY_NUM IN1 ANY_NUM IN2 . . . ANY_NUM INn ANY_NUM

Inputs IN1 First input, provided by current result IN2 more values to add . . INn Description All inputs applied will be summed. All inputs have to be of the same datatype. The output will have the same datatype as all inputs. Example Addition of numeric values
PROGRAM add3 VAR A : INT := 7; B : INT := 2; Sum : INT; END_VAR LD 3 ADD A ADD B ST Sum (* Sum: 12 *) END_PROGRAM

Example Functioncall ADD In instruction list, ADD is an instruction and not a function, so it cannot be extended. The first ADD sequence will compile, the latter one will cause a compiler error:
LD Var1 ADD Var2 (* ok *) ADD Var3 (* ok *) ST Result LD Var1 ADD Var2, Var3 (* error *) ST Result

336

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

337

9 Introduction into IEC1131

ASIN Arcus sinus

ASIN REAL REAL

Describtion ASIN will compute the arcus sinus of the input

338

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

339

9 Introduction into IEC1131

ATAN Arcus tangens

ATAN REAL REAL

Describtion ATAN will compute the arcus tangens of the input

340

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

341

9 Introduction into IEC1131

CONCAT Conclusion of character strings

CONCAT STRING IN1 STRING IN2 . . . STRING INm STRING

Inputs IN1 First string, provided by current result IN2 Further strings to append . . INn Describtion CONCAT will append IN2,...,INn to IN1 and deliver the conclusion to the current result.

342

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

343

9 Introduction into IEC1131

COS Cosinus

COS REAL REAL

Describtion COS will compute the cosinus of the input

344

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

DIV Division of numeric values

DIV ANY_NUM IN1 ANY_NUM IN2 ANY_NUM

Inputs IN1 Dividend, provided by current result IN2 Divisor All inputs have to have the same datatype, and the output will have the same datatype as all inputs. Description The first input will be divided by the second input. Example Division
PROGRAM divide VAR A : INT := 15; B : INT := 3; Quotient : INT; END_VAR LD A DIV B ST Quotient END_PROGRAM

(* Quotient: 5 *)

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

345

9 Introduction into IEC1131

346

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

EXP Exponential function to the base e

EXP REAL REAL

Describtion EXP will compute the exponential function of the input to the base e.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

347

9 Introduction into IEC1131

FIND Position of a part of a character string

FIND STRING IN1 STRING IN2 INT

Inputs IN1 Character string, provided by current result IN2 Part of the character string Describtion FIND will return the position of the substring IN2 within the string IN1. If IN2 isnt part of IN1 FIND will return 0.

348

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

LEFT First part of character string


LEFT STRING IN ANY_INT L STRING

Inputs IN Character string, provided by current result L Length of the part Describtion LEFT will deliver the first L characters of IN to current result.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

349

9 Introduction into IEC1131

LEN determine length of character string

LEN STRING INT

Description LEN computes the length of a character string Example Get length of string
PROGRAM how_long VAR Text : STRING := hello world; Textlen : INT; END_VAR LD Text LEN ST Textlen (* Textlen: 11 *) END_PROGRAM

350

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

351

9 Introduction into IEC1131

LN Natural Logarithm

LN REAL REAL

Describtion LN will compute the logarithm of the input to the base e.

352

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

353

9 Introduction into IEC1131

LOG

354

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Logarithm to the base 10

LOG REAL REAL

Describtion LOG will compute the logarithm of the input to the base 10.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

355

9 Introduction into IEC1131

356

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

MAX Maximum

MAX ANY IN1 ANY IN2 . . . ANY INm ANY

Inputs IN1 First input, provided by current result IN2 Further inputs . . INn All inputs have to have the same datatype, and the output will have the same datatype as all inputs. Describtion MAX will deliver the greatest input-value to current result.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

357

9 Introduction into IEC1131

358

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

MIN Minimum

MIN ANY IN1 ANY IN2 . . . ANY INm ANY

Inputs IN1 First input, provided by current result IN2 Further inputs . . INn All inputs have to have the same datatype, and the output will have the same datatype as all inputs. Describtion MIN will deliver the smallest input-value to current result.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

359

9 Introduction into IEC1131

MOD Modulo

MOD ANY_INT IN1 ANY_INT IN2 ANY_INT

Inputs IN1 Dividend, provided by current result IN2 Divisor All inputs have to have the same datatype, and the output will have the same datatype as all inputs. Description The first input will be divided by the second input. MOD delivers the residue to current result.

360

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

MUL Multiplication of numeric values

MUL ANY_NUM IN1 ANY_NUM IN2 . . . ANY_NUM INn ANY_NUM

Inputs IN1 First input, provided by current result IN2 more values to be multiplied . . INn All inputs have to have the same datatype, and the output will have the same datatype as all inputs. Description1) The first input will be multiplied by the second, then by the third input etc. Example Multiplication
PROGRAM mul3 VAR A : SINT := 5; B : SINT := 2; C : SINT := 3; Product_3 : SINT; END_VAR LD A MUL B MUL C ST Product_3 (* Product_3: 30 *) END_PROGRAM

Example Function Call MUL in Function Block Diagram In the graphical languages Ladder Diagram and Function Block Diagram, function MUL is extensible, i.e. additional inputs can be created at will. To multiply with more than one value at a time, insert a MUL and extend it.

Example Function Call MUL in IL In instruction list, MUL is an instruction and not a function, so it cannot be extended. The first MUL sequence will compile, the latter one will cause a compiler error:
LD Var1 MUL Var2 (* ok *) MUL Var3 (* ok *) ST Result LD Var1 MUL Var2, Var3 (* error *) ST Result

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

361

9 Introduction into IEC1131

NEG

362

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

Negation

NEG ANY_NUM ANY_NUM

Description NEG changes the sign of the input. The input must be a signed variable of the type INT, SINT, DINT or REAL.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

363

9 Introduction into IEC1131

NOT Bitwise Negation

NOT ANY_BIT ANY_BIT

Description The input is negated. If the input is a bitstring, this negation is done bitwise. Example Function NOT
LD Bitpattern NOT

Example Binary Complement


PROGRAM negation VAR Bitfolge : BYTE := 2#00110101; Negations_Result : BYTE; END_VAR LD Bitfolge NOT ST Negations_Result (* Negations_Result 2#11001010 *) END_PROGRAM

364

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

RIGHT Last part of character string


RIGHT STRING IN ANY_INT L STRING

Inputs IN Character string, provided by current result L Length of the part Describtion RIGHT will deliver the last L characters of IN to current result.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

365

9 Introduction into IEC1131

ROL Rotate left

ROL ANY_BIT IN UINT N ANY_BIT

Inputs IN the bitstring to be rotated, should be of datatype BYTE, WORD or DWORD. N number of digits to rotate Description The first input (the current result) will be rotated left as many digits as given by the second input. The output will be of the same datatype as the input. Bits shifted out to the left (most significant) will be shifted in into the rightmost (least significant) bit. Example Rotate pattern left
PROGRAM rot_le VAR BitPattern: BYTE := 2#01110001; Numb : UINT := 3; NewPattern: BYTE; END_VAR LD BitPattern ROL Numb ST NewPattern (*NewPattern: 2#10001011 *) END_PROGRAM

366

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

ROR Rotate right

ROR ANY_BIT IN UINT N ANY_BIT

Inputs IN the bitstring to be rotated, should be of datatype BYTE, WORD or DWORD. N number of digits to rotate Description The first input (the current result) will be rotated right as many digits as given by the second input. The output will be of the same datatype as the input. Bits shifted out to the right (least significant) bit will be shifted in into the left (most significant) bit. Example Rotate pattern right
PROGRAM rot_re VAR BitPattern: BYTE := 2#01110001; Numb : UINT := 3; NewPattern: BYTE; END_VAR LD BitPattern ROR Numb ST NewPattern (*NewPattern: 2#01011100 *) END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

367

9 Introduction into IEC1131

SHL Shift left

SHL ANY_BIT IN UINT N ANY_BIT

Inputs IN The bitstring ( BYTE, WORD or DWORD) to be shifted. N number of digits to shift Description The first input will be shifted to the left as many digits as given by the second input. Zeros will be used to fill the rightmost (least significant) bit. The datatype of the output is the same as that of the first input. Example Shift pattern left
PROGRAM shft_l VAR Bitpattern : BYTE := 2#00111011; Digits : UINT := 3; NewPattern : BYTE; END_VAR LD Bitpattern SHL Digits ST NewPattern (* NewPattern 2#11011000 *) END_PROGRAM

368

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

SHR Shift Right

SHR ANY_BIT IN UINT N ANY_BIT

Inputs IN The bitstring ( BYTE, WORD or DWORD) to be shifted. N number of digits to shift Description The first input will be shifted to the right as many digits as given by the second input. Zeros will be used to fill the leftmost (most significant) bit. The datatype of the output is the same as that of the first input. Example Shift pattern right
PROGRAM shft_r VAR Bitpattern : BYTE := 2#00111011; Digits: UINT:= 2; NewPattern : BYTE; END_VAR LD Bitpattern SHR Digits ST NewPattern (* NewPattern: 2#00001110 *) END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

369

9 Introduction into IEC1131

370

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

SIN Sinus

SIN REAL REAL

Describtion SIN will compute the sinus of the input

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

371

9 Introduction into IEC1131

372

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

SQRT Square root

SQRT REAL REAL

Describtion SQRT will compute the square root of the input

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

373

9 Introduction into IEC1131

SUB Subtract numeric values

SUB ANY_NUM IN1 ANY_NUM IN2 ANY_NUM

Inputs IN1 Minuend, the value to subtract from IN2 Subtrahend, the value to subtract Description The second input will be subtracted from the first. All inputs have to be of the same datatype, and the output will be of the same datatype as all inputs are. Example Subtract numeric values
PROGRAM aminusb VAR A : INT:= 123; B : INT:= 12; Difference : INT; END_VAR LD A SUB B ST Difference (* Difference: 111 *) END_PROGRAM

374

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

375

9 Introduction into IEC1131

TAN Tangens

TAN REAL REAL

Describtion TAN will compute the tangens of the input

376

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

TRUNC Integer part of real number

TRUNC REAL ANY_INT

Description TRUNC truncates a real number to its integer part. Example


PROGRAM IntNum VAR CommaNum : REAL := 123.5; IntPart : INT; END_VAR LD CommaNum TRUNC ST IntPart (* IntPart: 123 *) END_PROGRAM

9.6 Function blocks (IEC1131)


OpenPCS comes with a variety of predefined standard function blocks. Most of these are defined by IEC1131. Function blocks defined by IEC1131 are vendor-independent, and chances are excellent that you will find these on other controllers that are IEC1131 compliant. The following table gives an overview, with more description to follow:
Function block F_TRIG R_TRIG RS SR TOF TON TP CTD CTU CTUD Purpose Edge-Detection (falling) Edge-Detection (rising) RS-Flip-Flop SR-Flip-Flop Time Delayed Off Time Delayed On Timed Pulse Count Down Count Up Count up and/or down

The function blocks will be described giving their interface prototype, as we did for the standard functions. A graphical prototype will be shown, with inputs shown on the left side, and outputs on the right side of the function block box. Example Prototype The following textual prototype of function block R_TRIG...
FUNCTION_BLOCK R_TRIG VAR_INPUT CLK : BOOL; END_VAR VAR_OUTPUT Q : BOOL; END_VAR END_FUNCTION_BLOCK

...corresponds to the following graphical prototype:


1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

377

9 Introduction into IEC1131

R_TRIG BOOL CLK Q BOOL

Other than functions, function blocks cannot be called, only instances of function blocks can be called (or invoked). For more information, see chapter 9.3.1.8 on page 313.

378

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

CTD Count Down


CTD BOOL CD BOOL LOAD INT PV Q BOOL CV INT

Inputs
CD LOAD PV Q CV Count Pulse (rising edge) Set Initial Value Preset Counter Value Status (Counter ==0) Counter Value

Description CTD counts down on each rising edge on input CD. With a 1 on input LOAD, the value of PV is used to initialise the counter value, which defaults to 0. CV delivers the current counter value, output Q is set TRUE if the current counter value reaches 0.

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

379

9 Introduction into IEC1131

CTU Count Up
CTU BOOL CU BOOL RESET INT PV Q BOOL CV INT

Inputs
CU RESET PV Q CV Count Pulse (rising edge) Reset Preset Counter Limit Status: Counter == Limit Counter Value

Description CTU counts up on each rising edge of input CU. The counter starts off with a value of 0. A 1 on input Reset will reset the counter value to 0. Output CV delivers the current counter value. Output Q is set to 1 once the current counter value has reached the counter limit.

380

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

CTUD Count up and down


CTU BOOL CU BOOL CD BOOL RESET BOOL LOAD INT PV QU BOOL QD BOOL CV INT

Inputs
CU CD RESET LOAD PV QU QD CV Count up on rising edge Count down on rising edge Reset counter Load preset value Preset counter value Status: Counter Value >= PV Status: Counter Value <= 0 Current Counter Value

Description CTUD counts up and down. The counter is initialised to 0, and counted up on each rising edge of input CU, and counted down on each rising edge on input CD. A Value of 1 on input LOAD will set the current counter value to the value of PV. A value of 1 on input RESET will set the current counter value to 0. Output CV delivers the current counter value. Output QU is set to TRUE once the counter has reached "PV. QD is set to TRUE once the counter has reached 0. Example Count Up and Down
PROGRAM Visitors VAR PersonCounter : CTUD; Sensor1 AT %I0.2 : BOOL; Sensor 2 AT %I0.3 : BOOL; Reset AT %I0.1 : BOOL; PersonNum AT %QW0.0 : INT; END_VAR CAL PersonCounter(CU := Sensor 1, CD := Sensor 2, ReSet:= Reset) LD PersonCounter.CV ST PersonNum END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

381

9 Introduction into IEC1131

F_TRIG Detect falling edge

F_TRIG BOOL CLK Q BOOL

Inputs
CLK Q Signal to detect falling edge from Status: TRUE on a falling edge of CLK

Description F_TRIG monitors its input CLK and delivers a TRUE on output Q anytime that a transition from 1 to 0 is detected on input CLK. Example Edge Detect
PROGRAM Edges VAR Signal1_raising : R_TRIG; Signal1_falling : F_TRIG; Signal1 AT %I0.2 : BOOL; Impuls_0_1 : BOOL; Impuls_1_0 : BOOL; END_VAR CAL Signal1_raising(CLK := Signal1) LD Signal1_raising.Q ST Impuls_0_1 CAL Signal1_falling(CLK := Signal1) LD Signal1_falling.Q ST Impuls_1_0 END_PROGRAM

382

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

RS Flip-Flop reset dominant

RS BOOL SET BOOL RESET1 Q1 BOOL

Inputs
SET RESET1 Q1 Set Reset Status

Description RS implements a Flip-Flop. Output Q1 delivers the current state of that Flip-Flop. The initial value of the Flip-Flop is FALSE. TRUE on input SET will set the Flip-Flop, TRUE on input RESET1 will reset the Flip-Flop to FALSE. If both SET and RESET1 are TRUE in one call, RS is reset dominant, which means the RESET will override the SET and the Flip-Flop will hence be reset.

Example Valve Control


PROGRAM Fill VAR Vent1 : RS; Position AT %I0.0 : BOOL; VesselFull AT %I0.1 : BOOL; Halt AT %I0.2 : BOOL; Vent1_shut : BOOL; Vent1_open_shut AT %Q0.3 : BOOL; END_VAR LD VesselFull OR Halt ST Vent1_shut CAL Vent1(SET := Position, RESET1 := Vent1_shut) LD Vent1.Q1 ST Vent1_open_shut END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

383

9 Introduction into IEC1131

SR Flip-Flop set dominant


SR BOOL SET1 BOOL RESET Q1 BOOL

Inputs
SET RESET1 Q1 Set Reset Status

Description SR implements a Flip-Flop. Output Q1 delivers the current state of that Flip-Flop. The initial value of the Flip-Flop is FALSE. TRUE on input SET will set the Flip-Flop, TRUE on input RESET1 will reset the Flip-Flop to FALSE. If both SET and RESET1 are TRUE in one call, SR is set dominant, which means the SET will override the RESET and the Flip-Flop will hence be set. Example Alarm Notification
PROGRAM Alarm VAR Fault1_indicate : SR; Fault1 AT %I0.0 : BOOL; Verify_Alert AT %I0.1 : BOOL; Display_Alert AT %Q0.6 : BOOL; END_VAR CAL Fault1_indicate(SET1 := Fault1, RESET := Verify_Alert) LD Fault1_indicate.Q1 ST Display_Alert END_PROGRAM

384

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

TOF Timed Off Delay


TOF BOOL IN TIME PT Q BOOL ET TIME

Inputs
IN PT Q ET Start Condition Preset Time Status Elapsed Time

Description

Time Diagram (TOF)

If Input IN is TRUE, output Q will immediately be set to TRUE as well. With the falling edge of input IN, the timer will start and output Q will be kept to TRUE for the time given by input PT. Input PT will be sampled only on the rising edge of input IN, later changes have no effect. Output ET gives the time elapsed since the falling edge of input IN, but it will not go negative. Example Delay for 125 milliseconds
PROGRAM time2 VAR Timer3 : TOF; Start AT %I0.0 : BOOL; Duration : TIME := T#125ms; Output AT %Q0.0 : BOOL; ActTime : TIME; END_VAR CAL Timer3(IN := Start, PT := Duration) LD Timer3.Q ST Output LD Timer3.ET ST ActTime END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

385

9 Introduction into IEC1131

TON Timed On Delay


TON BOOL IN TIME PT Q BOOL ET TIME

Inputs
IN PT Q ET Start Condition Preset Time Status Elapsed Time

Description

Time diagram (TON)

The rising edge of input IN will start the timer. Output Q will go to TRUE after the time given by PT has elapsed after the rising edge of input IN. If IN is FALSE, Q will always be set to FALSE. PT is sampled only on the rising edge of input IN, later changes will have no effect. Output ET delivers the time elapsed since the rising edge of IN, but will not go higher than PT. If IN is FALSE, ET will be 0. Example Off-Delay by 12 milliseconds
PROGRAM time1 VAR Timer2 : TON; Start AT %I0.0 : BOOL; Duration : TIME := T#12ms; Output AT %Q0.0 : BOOL; ActTime : TIME; END_VAR CAL Timer2(IN := Start, PT := Duration) LD Timer2.Q ST Output LD Timer2.ET ST ActTime END_PROGRAM

386

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

TP Timed Pulse
TP BOOL IN TIME PT Q BOOL ET TIME

Inputs
IN PT Q ET Start Condition Preset Time Status Elapsed Time

Description

Time Diagram (TP)

The rising edge of input IN will start the timer, but only if it is idle. Output Q will be set to TRUE for the time given by input PT. A falling edge on IN will not stop the timer nor change the output Q while the timer is running, neither will another rising edge during this time restart the timer. Input PT is samples only on the rising edge of IN starting the timer, later changes will have no effect. Example 125 ms pulse
PROGRAM pulse VAR Timer1 : TP; Start AT %I0.0 : BOOL; PulseDuration: TIME := T#125ms; OutputPulse: BOOL; ActTime : TIME; END_VAR CAL Timer1(IN := Start, PT := PulseDuration) LD Timer1.Q ST OutputPulse LD Timer1.ET ST ActTime END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

387

9 Introduction into IEC1131

9.7 Functions (OpenPCS)


GETTIME Get current system time

GETTIME TIME IN1 TIME

Inputs IN1 Previous time Description GETTIME will retrieve the time elapsed since the controller has last been switched on, less the time value supplied as an input. This can be used to easily measure time spans. Example Stop Watch
PROGRAM StopW VAR begin, result : TIME; END_VAR start: LD t#0ms GETTIME ST begin ... stop: LD begin GETTIME ST result END_PROGRAM

388

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

9 Introduction into IEC1131

GETTIMECS Get current system time

GETTIME TIME IN1 TIME

Inputs IN1 Previous time Description GETTIME will retrieve the time elapsed at the last system control point since the controller has last been switched on, less the time value supplied as an input. This can be used to easily measure time spans. Compared to GETTIME, GETTIMECS will return the same value when called multiple times within the same cycle. Example Stop Watch
PROGRAM StopW VAR begin, result : TIME; END_VAR ... start: LD t#0ms GETTIMECS ST begin ... stop: LD begin GETTIMECS ST result END_PROGRAM

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

389

9 Introduction into IEC1131

9.8 Language Extensions


Single-Bit Access With OpenPCS, each individual bit of BYTE or WORD variable can be accessed by writing the bitnumber, separated by a dot, after the variable name Example
PROGRAM Only_1_Bit VAR Bitpattern1 : BYTE := 2#10101010; Bitpattern2 AT %IW0.0 : WORD; END_VAR LD Bitpattern2.15 (* Copy bit 15 *) ST Bitpattern1.0 (* into bit 0 *) . . END_PROGRAM

Passing Output Parameters IEC1131 defines two ways of passing parameters. OpenPCS provides, as a legal extension to IEC1131, a means to directly pass output parameters. You can pass output parameters within the line of the CAL instruction by using a vertical slash | instead of a comma, and giving the actual parameter on the left side of the assignment: Example
CAL SR_Instance_1(SET1 := On, RESET := Off | Result := Q1)

Declaration of derived datatypes Local type definitions cannot be used for passing parameters to functions or function blocks. Though the names and definitions of the types might be identical, to the compiler these are distinct types. With OpenPCS, you can add global type definitions by adding them in file USERTYPE.TYP, to be located in the root directory of your project. Use the standard windows editor (notepad) to edit this file.

Comments Comments may be nested, which eases out-commenting of entire program sections which should contain comments on their own.

390

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

10 Forms Editor

10 Forms Editor 10.1 Overview


Use the forms editor to create your own forms to be used with printing in OpenPCS.

fig. 243: Forms Editor

Draw your form using lines to structure the page, insert logos and other graphical entities, using the forms editor. Store these forms with file extension .wmf. The forms editor features a tool-bar, allowing you to easily insert date, page numbers, file names etc. within your forms, and to determine the region to be used for program output. With OpenPCS, several standard forms are delivered to be used right from the start.

10.2 Design a form


To create a new form, you either take an existing one an modify it to your taste, or you start from scratch. Precondition: The forms editor is running and showing a form, either a new one created with FileNew or an existing one created with FileOpen.... Select FilePage Setup... and choose proper page format and orientation. Select the region to be used for program output later by clicking the respective symbols. You can modify this region by moving these symbols with the mouse button pressed after you have selected InsertEdit Elements. The name and size of the font used for printing in this region is as by the time of the definition of the printing region Add other elements. If, e.g. you want to draw a rectangle, click on the rectangle icon and place it onto the form or select InsertRectangle To add fixed text, select ExtrasFont..., choose the proper font and then click the symbol for insert text or select InsertText

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

391

10 Forms Editor

To modify the type or name of the font used for program output, choose the Edit Elementsmode, double-click into the printing region and select the proper font in the dialog box. Fonts of fixed text will not be modified by that. Store the new form using FileSave As...

10.3 Using fixed text in a form


Precondition: The forms editor is running, with a form opened. Select ExtrasFont... and select the proper font. Click the symbol Insert Text or select InsertText, then click on the very spot of the form, where you want to insert the fixed text. Insert your text. Use Backspace to correct typing mistakes. While you enter your text, it will be displayed in a standard font. This does not affect later print-out

End the text by hitting the Enter key. Your text will now be displayed in the font you selected. To move text, click the symbol edit element, then click your text and move it with the mouse button pressed. To edit your text, click the symbol edit element, then double-click your text.

10.4 Form preview


Precondition: The forms editor is running with a form opened. Select FilePrint Preview. For variable elements, like date, filename, only placeholders will be displayed.

10.5 Editing elements


Precondition: The forms editor is running with a form opened. Select ElementsEdit Elements or click the arrow symbol Select the element you want to edit or move the element to the desired new position.

Be careful to store all Bitmaps that you embedded into a form in the same directory as the form.

392

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

11 FXF Import/Export

11 FXF Import/Export
FXF is the abbreviation of File Exchange Format. The File Exchange Format is a file format to allow for the exchange of code units (functions and function blocks) between IEC1131 programming systems from different vendors. Use the FXF Import/Export Utility to transfer code between OpenPCS and other programming systems supporting FXF, in both directions. The File Exchange Format has been defined by PLCopen: PLCopen P.O. Box 2015 NL 5300 CA Zaltbommel The Netherlands Tel. +31-418-541139 http://www.plcopen.org/ OpenPCS supports version 1 of the File Exchange Format for language instruction list. With cross-compilation, ladder diagram and function block diagram can be imported and exported as well.

11.1 Export to FXF


To export POUs to FXF, proceed as follows: Launch the FXF Import/Export utility (fxf.exe):

fig. 244: FXF main window

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

393

11 FXF Import/Export

Press Button Add... and locate all POUs you want to export. See the list Project Files updated accordingly.

fig. 245: FXF with files added to export

394

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

11 FXF Import/Export

Fill in the fields provided in the upper half of the screen to describe the archive you are going to create:

fig. 246: FXF export

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

395

11 FXF Import/Export

Press Button Export..., and enter the filename of your new FXF archive:

fig. 247: FXF specify export archive name

Successful export will be reported by a message box, close this with OK.

fig. 248: FXF reporting success

Exit the program by clicking the cross in the very right of the title bar, or press Reset to create another FXF archive.

You cannot use the FXF import/export utility provided with OpenPCS to create FXF archives for other programming systems. Instead, use the tools supplied with the other IEC1131 programming system.

396

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

11 FXF Import/Export

11.2 Import from FXF


To import POUs from an FXF archive, created with OpenPCS or any other IEC1131 programming system, proceed as follows: Start the FXF Import/Export Utility (fxf.exe), or press button Reset if it is already running

fig. 249: FXF main window

Press button Import. Enter the name of the FXF archive first, then the path of the directory where you want the FXF import/export utility to store the extracted POUs.

fig. 250: FXF import archive dialog

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

397

11 FXF Import/Export

After the successful import, the screen will be updated to show the project information from the FXF archive in the upper half, and the list of extracted files in the list Project Files. The directory that you specify as the target directory to hold the extracted files must exist, and for your convenience it should be empty.

fig. 251: FXF import successful

The FXF import/export utility does not register the POUs with an OpenPCS project. So, to use the extracted POUs within an OpenPCS project, proceed as follows: Copy the POUs in the directory of the project, where you want to use them Start OpenPCS, and use the Browser to open this project Select ProjectAdd File or the corresponding symbol in the toolbar and choose the file you want to add to the project. The file appears now in the project tree. Double click on the new file to open it in the POU editor Select File Syntaxcheck , to create a prototype and ensure correctness

Repeat this for all POUs you want to use within this project.

398

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

12 IEC1131-3 Compliance Statement


The following tables have the same numbering as those in the IEC 1131-3/EN 61131-3 standard. Tables showing features not yet supported by this version of OpenPCS are not listed. Some tables in IEC1131-3 do not contain features, so missing table numbers do not necessarily imply missing features. To understand this document, you will want to consult IEC1131-3. OpenPCS 4.1 complies with the requirements of IEC1131-3, for the following language features:

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

399

12 IEC1131-3 Compliance Statement

12.1 Common Elements


12.1.1 Table 1:
No. 1 2 3a 3b 4a 4b 5a 5b 6a 6b Description Required character set Lower case Number sign (#) or Pound sign () Dollar sign ($) or Currency sign Vertical bar (|) or Exclamation mark (!) Subscript delimiters: brackets [ ] or parentheses ( )

Character set features


Yes x x x x x x x x x x No

12.1.2 Table 2:
No. 1 2 3 Description

Identifier features
Yes x x x No

Upper case and numbers Upper and lower case, numbers, embedded underlines Upper and lower case, numbers, leading or embedded underlines

12.1.3 Table 3:
No. 1 Description Comments

Comment features
Yes x No

12.1.4 Table 4:
No. 1 2 3 4 5 6 7 8 400 Description Integer literals Real literals

Numeric Literals
Yes x x x x x x x x
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

No

Real literals with exponents Base 2 literals Base 8 literals Base 16 literals Boolean zero and one Boolean FALSE and TRUE

12 IEC1131-3 Compliance Statement

12.1.5 Table 5:
No. 1 Description

Character string literal features


Yes x x x No

Empty string (length zero) String of length one containing the single character A String of length one containing the space character

String of length one containing the single quote character x String of length two containing CR und LF x String of length five which would print as $1.00 x

12.1.6 Table 6:
No. 2 3 4 5 6 7 8 Description Dollar sign ($$) Single quote ($)

Two character combinations in character strings


Yes x x x x x x x No

Line feed ($L or $l) New line ($N or $n) New page ($P or $p) Carriage return ($R or $r) Tab ($T or $t)

12.1.7 Table 7:
No. 1a 1b 2a 2b Description

Duration literal features


Yes x x x x No

Duration literals without underlines: Short prefix Long prefix Duration literal with underlines Short prefix Long prefix

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

401

12 IEC1131-3 Compliance Statement

12.1.8 Table 8:
No. 1 2 3 4 5 6 Description

Date and time of day literals


Yes No x x x x x x

Date literals (long prefix: DATE#) Date literals (short prefix: D#) Time of day literals (long prefix: TIME_OF_DAY#) Time of day literals (short prefix: TOD#) Date and time literals (long prefix: DATE_AND_TIME#) Date and time literals (short prefix: DT#)

12.1.9 Table 10:


No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Keyword BOOL SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL TIME DATE

Elementary data types


Data type Boolean Short integer Integer Double integer Long integer Unsigned short integer Unsigned integer Unsigned double integer Unsgined long integer Real numbers Long reals Duration Date (only) Time of day (only) x x x x x x x x x Yes x x x x x No

TIME_OF_DAY or TOD DATE_AND_ TIME or TD STRING BYTE WORD DWORD LWORD

15 16 17 18 19 20

Date and time Variable-length character string Bit string of length 8 Bit string of length 16 Bit string of length 32 Bit string of length 64 x x x x

402

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

12.1.10 Table 12: Data type declaration feature


No. 1 2 3 4 5 Description Direct derivation from elementary types Enumerated data types Subrange data types Array data types Structured data types x x Yes x x x No

12.1.11 Table 13: Default initial values


Description BOOL, SINT, INT DINT, LINT, USINT, UINT, UDINT, ULINT BYTE, WORD, DWORD, LWORD REAL, LREAL TIME DATE TIME_OF_DAY DATE_AND_TIME STRING Initial value 0 0 0 0.0 T#0s D#0001-01-01 TOD#00:00:00 DT#0001-01-01-00:00:00 "(the empty string) x Yes x x x x x x x x No

12.1.12 Table 14: Data type initial value declaration features


No. 1 2 3 4 5 6 Description Initialization of directly derived types Initialization of enumerated data types Initialization of subrange data types Initialization of array data types Initialization of structured data types Initialization of derived structured data types x x Yes x x x x No

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

403

12 IEC1131-3 Compliance Statement

12.1.13 Table 15: Location and size prefix features for directly represented variables
No. 1 2 3 4 5 6 7 8 9 Description I: Input location Q: Output location M: Marker location X: (Single) bit size None: (Single) bit size B: Byte (8 bits) size W: Word (16 bits) size D: Double word (32 bits) size L: Long word (64 bits) size Yes x x x x x x x x x No

12.1.14 Table 16: Variable keywords for variable declaration


Keyword VAR VAR_INPUT VAR_OUTPUT VAR_IN_OUT VAR_EXTERNAL VAR_GLOBAL VAR_ACCESS RETAIN CONSTANT AT x x x Yes x x x x x x x No

12.1.15 Table 17: Variable type assignment features


No. 1 2 3 4 5 6 7 8 Description Declaration of directly represented, non-retentive variables Declaration of directly represented, retentive variables Declaration of locations of symbolic variables Array location assignment Automatic memory allocation of symbolic variables Array declaration Retentive array declaration Declaration of structured variables x x x x Yes x x x x No

404

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

12.1.16 Table 18: Variable initial value assignment features


No. 1 2 3 4 5 6 7 8 9 Description Initialization of directly represented, retentive variables Location and initial value assignment to symbolic variables Array location assignment and initialization Initialization of symbolic variables Array initialization Retentive array declaration and initialization Initialization of structured variables Initialization of constants x x x x x Yes x x x No Initialization of directly represented, non-retentive variables x

12.1.17 Table 19: Graphical negation of Boolean signals


No. 1 2 Description Negated input Negated output Yes x x No

12.1.18 Table 20: Use of EN input and ENO output


No. 1 2 3 Description Use of EN and ENO Use of EN and ENO FBD without EN and ENO x Yes No x x

12.1.19 Table 21: Typed and overloaded functions


No. 1 2 Description Overloaded functions (non type-dependent) Typed functions Yes x x No

12.1.20 Table 22: Type conversion function features


No. 1 2 3 4 Description *_TO_** TRUNC BCD_TO_** *_TO_BCD Yes x x x x No

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

405

12 IEC1131-3 Compliance Statement

12.1.21 Table 23: Standard functions of one numeric variable


No. 1 2 3 4 5 6 7 8 9 10 11 Description ABS SQRT LN LOG EXP SIN COS TAN ASIN ACOS ATAN Yes x x x x x x x x x x x No

12.1.22 Table 24: Arithmetic standard functions


No. 12 13 14 15 16 17 18n 18s Name ADD MUL SUB DIV MOD EXPT MOVE := x ** Symbol + * / Yes x x x x x x x No

12.1.23 Table 25: Standard bit shift functions


No. 1 2 3 4 Name SHL SHR ROR ROL Yes x x x x No

12.1.24 Table 26: Standard bitwise Boolean functions


No. 5 6 7 8 Name AND OR XOR NOT Yes x x x x No

406

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

12.1.25 Table 27: Standard selection functions


No. 1 2a 2b 3 4 Name SEL MAX MIN LIMIT MUX x x x x Yes No x

12.1.26 Table 28: Standard comparison functions


No. 5 6 7 8 9 10 Name GT GE EQ LE LT NE Yes x x x x x x No

12.1.27 Table 29: Standard character string functions


No. 1 2 3 4 5 6 7 8 9 Name LEN LEFT RIGHT MID CONCAT INSERT DELETE REPLACE FIND x x x x x Yes x x x x No

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

407

12 IEC1131-3 Compliance Statement

12.1.28 Table 30: Functions of time data types


No. 1 2 3 4 5 6 7 8 9 10 11 12 MUL DIV CONCAT SUB Name ADD Operation TIME + TIME = TIME TOD + TIME = TOD DAT + TIME = DAT TIME - TIME = TIME DATE - DATE = TIME TOD - TIME = TOD TOD - TOD = TIME DAT - TIME = DAT DAT - DAT = TIME TIME * ANY_NUM = TIME TIME / ANY_NUM = TIME DATE TOD = DAT Type conversion functions 13 14 DATE_AND_TIME_TO_TIME_OF_DAY DATE_AND_TIME_TO_DATE x x x x x x x x x x x Yes x x x No

12.1.29 Table 31: Functions of enumerated data types


No. 1 2 3 4 Name SEL MUX EQ NE Yes No x x x x

408

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

12.1.30 Table 33: Function block declaration features


No. 1 2 3 4a 4b 5a 5b 6a 6b 7a 7b Description RETAIN qualifier on internal variables RETAIN qualifier on output variables RETAIN qualifier on internal function blocks Input/output declaration (textual) Input/output declaration (graphical) Function block instance name as input (textual) Function block instance name as input (graphical) Function block instance name as input/output (textual) Function block instance name as input/output (graphical) Function block instance name as external variable (textual) Function block instance name as external variable (graphical) Textual declaration of 8a 8b 9a 9b - rising edge inputs - falling edge inputs Graphical declaration of - rising edge inputs - falling edge inputs x x x x x x x x x x x x Yes x x x No

12.1.31 Table 34: Standard bistable function blocks


No. 1 2 3 Name SR RS SEMA Yes x x x No

12.1.32 Table 35: Standard edge detection function blocks


No. 1 2 Name R_TRIG F_TRIG Yes x x No

12.1.33 Table 36: Standard counter function blocks


No. 1 2 3 Name CTU CTD CTUD Yes x x x No

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

409

12 IEC1131-3 Compliance Statement

12.1.34 Table 37: Standard timer function blocks


No. 1 2a 2b 3a 3b 4 Name TP (Pulse) TON (on-delay) T---0 (on-delay) TOF (off-delay) 0---T (off-delay) RTC (real-time clock) x x x Yes x x x No

12.1.35 Table 39: Program declaration features


No. 1 2 3 4a 4b 5a 5b 6a 6b 7a 7b Description RETAIN qualifier on internal variable RETAIN qualifier on output variable RETAIN qualifier on internal function blocks Input/output declaration (textual) Input/output declaration (graphical) Function block instance name as input (textual) Function block instance name as input (graphical) Function block instance name as input/output (textual) Function block instance name as input/output (graphical) Function block instance name as external variable (textual) Function block instance name as external variable (graphical) Textual declaration of: - rising edge inputs - falling edge inputs Graphical declaration of: - rising edge inputs - falling edge inputs Formal input and output parameters Declaration of directly represented, non-retentive variables Declaration of directly represented, retentive variables Declaration of locations of symbolic variables Array location assignment Initialization of directly represented, non-retentive variables Initialization of directly represented, retentive variables Location and initial value assignment to symbolic variables Array location assignment and initialization x x x x x x x x Yes x x x x x x x x x x x x x x x x No

8a 8b 9a 9b 10 11 12 13 14 15 16 17 18

410

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

19 20 21

Use of directly represented variables VAR_GLOBAL .. END_VAR Declaration within a PROGRAM VAR_ACCESS .. END_VAR Declaration within a PROGRAM

x x x

12.1.36 Table 40: Step features


No. 1 2 3a 3b 4 Description Step graphical Initial step graphical Step textual Initial Step textual Step flag general form Step flag - direct connection of boolean variable Step elapsed time Yes x x x x x x x No

12.1.37 Table 41: Transitions and Transition conditions


No. 1 2 3 4 4a 4b 5 6 7 7a 7b 7c 7d Description Transition condition using ST language Transition condition using LD language Transition condition using FBD language Use of connector Transition condition using LD language Transition condition using FBD language Textual transition in ST Textual transition in IL Transition name Transition condition using LD language Transition condition using FBD language Transition condition using IL language Transition condition using ST language x x x x x x Yes No x x x x x x x

12.1.38 Table 42: Declaration of actions


No. 1 2l 2s 2f 3s 3i Description boolean variable as action graphical declaration in LD language inclusion of SFC elements in action graphical declaration in FBD language textual declaration in ST language graphical declaration in IL language x 411 Yes No x x x x x

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

12.1.39 Table 43: Step/action association


No. 1 2 3 4 Description action block concatenated action blocks textual step body action block "d" field x x Yes No x x

12.1.40 Table 44: Action block features


No. 1 2 3 4 5 6 7 8 9 Description qualifier as per 2.6.4.4 action name boolean indicator variables IL language ST language LD language FBD language action blocks in ladder diagrams action block in function block diagrams x x x x x x x x Yes No x

12.1.41 Table 45: Action qualifiers


No. 1 2 3 4 5 6 7 8 9 10 Description none N (non-stored) R (overriding reset) S (set stored) L (time limited) D (time delayed) P (pulse) SD (stored and time delayed) DS (delayed and stored) SL (stored and time limited) Yes x x x x x x x x x x No

12.1.42 Table 46: Sequence evolution


No. 1 2a 2b 2c 3 4 5 412 Description single sequence divergence of sequence selection (left-to-right) divergence of sequence selection (with priorities) divergence of sequence selection (with mutual exclusion) convergence of sequence evolution simultanouse sequences divergence simultanouse sequences convergence x x x
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

Yes x x

No

x x

12 IEC1131-3 Compliance Statement

5a 5b 5c 6a 6b 6c 7

sequence skip (left-to-right) sequence skip (with priorities) sequence skip (with mutual exclusion) sequence loop (left-to-right) sequence loop (with priorities) sequence loop (with mutual exclusion) directional arrows

x x x x x x x

12.2 IL Language Elements


12.2.1 Table 52:
No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Operator LD ST S R AND & OR XOR ADD SUB MUL DIV GT GE EQ NE LE LT JMP CAL RET ) N,( N,( N,( N,( ( ( ( ( ( ( ( ( ( ( C, N C, N C, N

Instruction list (IL) operators


Modifiers N N Yes x x x x x x x x x x x x x x x x x x x x x x No

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

413

12 IEC1131-3 Compliance Statement

12.2.2 Table 53:


No. 1 2 3 Description

Function block invocation feature for IL language


Yes x x x No

CAL with input list CAL with load/store of inputs Use of input operators

12.3 ST Language Elements


12.3.1 Table 55:
No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Description Parenthisization Function evaluation Exponentiation Negation Complement Multiply Divide Modulo Add Subtract Comparision Equality Inequality Boolean AND Boolean AND Boolean Exclusive XOR Boolean OR x x x x x x x x x x x x x x

Operators of the ST language


Yes x x x No

12.3.2 Table 56:


No. 1 2 3 4 5 6 7 Description Assignment

ST language statements
Yes x x x x x x x No

Function block invocation and FB output usage RETURN IF CASE FOR WHILE

414

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

No. 8 9 10

Description REPEAT EXIT Empty Statement

Yes x x x

No

12.4 Common graphical Elements


12.4.1 Table 57:
No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Description Horizontal lines: ISO/IEC 646 minus character graphic or semigraphic Vertical lines: ISO/IEC 646 vertical line character graphic or semigraphic Horizontal/vertical connection: ISO/IEC 646 plus character graphic or semigraphic Line crossing without connection: ISO/IEC 646 characters graphic or semigraphic Connected and non-connecte corners: ISO/IEC 646 characters graphic or semigraphic Blocks with connecting lines ISO/IEC 646 characters graphic or semigraphic Connectors using ISO/IEC 646 chararcters: Connector, Continuation of a connected line graphic or semigraphic x x x x x x x x x x x x x x

Representation of lines and block


Yes No

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

415

12 IEC1131-3 Compliance Statement

12.4.2 Table 58:


No. 1 2 3 4 5 6 7 8 Description

Graphic execution control elements


Yes x x x x x x x x x No

Unconditional Jump FBD language LD language Conditional Jump (FBD language) Conditional Jump (LD language) Conditional Return LD language FBD language Unconditional Return from Function from Function Block Alternative Representation in LD language

12.5 LD language Elements


12.5.1 Table 59:
No. 1 2 Description Left power rail Right power rail

Power rails
Yes x x No

12.5.2 Table 60:


No. 1 2 Description Horizontal link

Link Elements
Yes x x No

vertical link with attached horizontal links

12.5.3 Table 61:


No. 1 2 Description

Contacts
Yes x x No

Normally open contact

Normally closed contact 3 4 Positive tranisition-sensing contact 5 6 416 x x


1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

x x

12 IEC1131-3 Compliance Statement

No. 7 8

Description Negative transition-sensing contact

Yes

No x x

12.5.4 Table 62:


No. 1 2 3 4 5 6 7 8 9 Description Coil Negated Coil SET (latch) coil

Coils
Yes x x x x x x x x x No

RESET (unlatch) coil Retentive (Memory) coil SET retentive (Memory) coil RESET retentive (Memory) coil Positive transition-sensing coil Negative transition-sensing coil

12.6 FBD language elements


[Note: this chapter is empty because the corresponding chapter in IEC1131-3 does not list any features to be referenced here].

12.7 Annex D Implementation-dependent parameters


12.7.1 Table D.1: Implementation-dependent parameters
Clause 1.5.1 2.1.1 2.1.2 2.1.5 2.2.3.1 2.3.1 Parameter Error handling procedures National characters used Maximum length identifiers Maximum comment length Range of values of duration Range of values for variables of type TIME Precision of representation of seconds in type TIME_OF_DAY and DATE_AND_TIME 2.3.3 Maximum number of array subscripts array size number of structure elements - structure size 6 < 4KB per POU < 8KB per POU Values see next chapter see table 1 above 256 >512 +/- 24,85 days +/- 24,85 days

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

417

12 IEC1131-3 Compliance Statement

2.3.3.1 2.3.3.2

number of variables per declaration < 64 KB per POU

Maximum number of enumerated values

Default maximum length of STRING 32 variables Maximum permissible length of STRING 253 [see note 1] variables Maximum number of hierarchical levels Logical or physical mapping 5

2.4.1.1

2.4.1.2

Maximum number of subscripts Maximum number of subscript values Maximum number of levels of structures

>512 The value of the system inputs correponds to their physical values < 8 KB per POU

2.4.2

Initialization of system inputs

2.4.3 2.5 2.5.1.1 2.5.1.3 2.5.1.5 2.5.1.5.1 2.5.1.5.2 2.5.2 2.5.2.3.3 2.5.3 2.6 2.6.2

Maximum number of variables per declaration

Information to determine execution times of program organisation units No Method of function representation Maximum number of function specifications Textual limited only by available memory

Maximum number of inputs of extensible IL: 2, LD/FBD: unlimited functions Effects of type conversions on accuracy Accuracy of functions of one variable Implementation of arithmetic functions Maximum number of function blocks and ca. 8000 instantiations PVmin, PVmax of counters Program size limitations Timing and postability effects of execution control elements Precision of step elapsed time Maximum number of steps per SFC minimum/maximum value of respective data type limited only by available memory truncated Currently not supported

2.6.3 2.6.4 2.6.4.2 2.6.5

Maximum number of transitions per SFC and per step Action control mechanism Maximum number of action blocks per step Graphic indication of step state Transition clearing time -

418

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

12 IEC1131-3 Compliance Statement

Maximum width of diverge/converge constructs 2.7.1 2.7.2 Content of RESOURCE libraries Maximum number of tasks Task interval resolution Pre-emptive or non-pre-emptive scheduling 3.3.1 3.3.2 3.3.2.3 4.1.1 Maximum length of expressions unlimited Partial evaluation of Boolean expressions no Maximum length of statements Maximum number of CASE selections Graphic/semigraphic representation Restrictions on network topology 4.1.3 Evaluation order of feedback loops unlimited unlimited graphic -

note 1: OpenPCS is highly configurable, so this parameter may vary depending on your hardware. If in doubt, consult the documentation of your hardware.

12.8 Appendix E (normative): Error conditions


12.8.1 Table E.1:
Clause 2.3.3.1 2.4.2 2.5.1.5.1 2.5.1.5.2

Error conditions
system response Syntax error; overflow can be scanned during run time

Error conditions Value of a variable exceeds the specified subrange

Length of initialisation list doesnt match Syntax error the number of array entries Type conversion errors Numerical result exceeds range for data type Division by zero Mixed input data types to a selection function Selector (K) out of range for MUX function Syntax error Can be monitored Can be monitored Syntax

2.5.1.5.4

2.5.1.5.5

Invalid character position specified Result exceeds maximum string length

2.5.1.5.6 2.6.2

Result exceeds range for data type Zero or more than one initial step in the SFC network User program attempts to modify step

Restriction to maximum value (see 2.2.3.1) -

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

419

12 IEC1131-3 Compliance Statement

state or time 2.6.2.5 2.6.3 2.6.4.5 2.6.5 2.7.1 2.7.2 Simultaneously true, non-prioritized transitions in a selection divergence Side effects in evaluation of transition condition Action control contention error Unsafe or Unreachable SFC Data type conflict in VAR_ACCESS Tasks require too many processor resources Execution deadline not met Other task scheduling conflicts 3.2.2 3.3.1 3.3.2.1 3.3.2.4 4.1.1 4.1.4 4.1.5 Numerical result exceeds range for data type Division by zero Invalid data type for operation Return from function without value assigned Iteration fails to terminate Same identifier as connector label and element name Uninitialised feedback variable Numerical result exceeds range for data type Division by 0 Scan via functions Syntax error can be monitored -

420

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

13 Index

13 Index 13.1 Table of figures


fig. 1:Project management (demo-project pre-selected)..................................................................... 17 fig. 2:Dialogbox New Project .................................................................................................... ........ 18 fig. 3: Minimum Project Structure.................................................................................................. ..... 19 fig. 4: Creating a new POU .......................................................................................................... ........ 20 fig. 5: Project structure after insert of a POU ..................................................................................... 21 fig. 6: POU-editor with syntax driven declaration editor, and IL-editor............................................ 22 fig. 7: Buttons to select declaration types (from function blocks) ....................................................... 23 fig. 8: Declaration Edit Fields .............................................................................................................. 23 fig. 9: Declaration list ........................................................................................................................... 24 fig. 10 The completed sample program................................................................................................ 25 fig. 11:Dialog box Error Messages ................................................................................................... 25 fig. 12: Definition of a resource ............................................................................................................ 28 fig. 13: Project Tree with a resource.................................................................................................... 29 fig. 14: Task Properties ........................................................................................................................ 30 fig. 15: Compiler-Messages .................................................................................................................. 31 fig. 16: The SmartSIM32...................................................................................................................... 32 fig. 17: Test and Commissioning .......................................................................................................... 33 Fig 18: Messages of the PLC ................................................................................................................ 33 fig. 20: TUI window with watch variables ........................................................................................... 34 fig. 21: Set variable.............................................................................................................................. 35 fig. 22: POSITION marked .............................................................................................................. 35 fig. 23: Online editor ............................................................................................................................ 36 fig. 24: Programming Language LD .................................................................................................... 37 fig. 25: Programming Language FBD .................................................................................................. 38 fig. 26: Programming Language CFC.................................................................................................. 39 fig. 27: Free Declaration Editor ........................................................................................................... 41 fig. 28: The project manager ............................................................................................................... 44 fig. 29: Dialog box Create new project............................................................................................ 46 fig. 30: Open project............................................................................................................................. 47 fig. 31: Display of entire paths ............................................................................................................ 47 fig. 32: Copying a project .................................................................................................................... 48 fig. 33: Create backup copy................................................................................................................. 48 fig. 34: Selection of the safe copy of a project which must be restored .............................................. 49 fig. 35: Selection of the project directory............................................................................................ 49 fig. 36: Additional accepting for deleting the project......................................................................... 50 fig. 37: Rename project ........................................................................................................... ............ 50 fig. 38: Project tree of the project Bsp ............................................................................................ . 51 fig. 39: Subdirectory of a project (in this case Bsp)......................................................................... 51 fig. 40: The branch Configuration consists the resources of the project ......................................... 51 fig. 41: The branch Project files ...................................................................................................... 52 fig. 42: Create new module................................................................................................................... 52 fig. 43: POU-and CFC- Modules in the branch Project files.......................................................... 53 fig. 44: Creation of a new declaration of global variables .................................................................. 54 fig. 45: Declaration of variables in the branch Project files ........................................................... 54 fig. 46: Standard-type definition Usertype.typ ............................................................................... 55 fig. 47: Create new type definition ...................................................................................................... 55 fig. 48: Type definitions in the branch Project files....................................................................... 55 fig. 49: Create new resource................................................................................................................ 56 fig. 50: Editing resource ...................................................................................................................... 57 fig. 51: Define a network protocol of a resource ................................................................................. 58 fig. 52: Task properties ....................................................................................................................... 58
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

421

13 Index

fig. 53: Selection of the files which will be added ............................................................................... 59 fig. 54: Selection of the type definition file.......................................................................................... 60 fig. 55: Compiler messages during the compilation of the resource Bsp_res ................................. 61 fig. 56: Error messages during compilation ........................................................................................ 61 fig. 57: Install Library.......................................................................................................................... 68 fig. 58: The SmartSIM32..................................................................................................................... 71 fig. 59: Test and commissioning .......................................................................................................... 72 fig. 61: Variable listing of the task POSITION.............................................................................. 74 fig. 62: Test and commissioning-window with watched variables .................................................. 74 fig. 63: Set variable.............................................................................................................................. 75 fig. 64: Resource Bsp_res with the task POSITION was compiled and transmitted to the PLC ................................................................................................................................... 75 fig. 65: Online-editor with state display.............................................................................................. 76 fig. 66: Information about the used hardware .................................................................................... 76 fig. 67: Information about the resource............................................................................................... 77 fig. 68: Settings ..................................................................................................................................... 78 fig. 69: Directory structure.................................................................................................................. 79 fig. 70: Logical structure ..................................................................................................................... 79 fig. 71: With variable knots.................................................................................................................. 79 fig. 72: Without variable knots............................................................................................................. 79 fig. 73: Printer settings ........................................................................................................................ 80 fig. 74: POU-Editor with declarations part (at the top), and instruction part (at the bottom) .......... 82 fig. 75: Create new POU....................................................................................................................... 83 fig. 76: Elements of a declaration......................................................................................................... 88 fig. 77: Tool buttons free-mode and syntax-mode ................................................................................ 88 fig. 78: Editor options to adjust free/syntax-mode ............................................................................... 88 fig. 79: Possible variable sections for the POU-type Program......................................................... 89 fig. 80: Message after incorrectly edited line....................................................................................... 89 fig. 81:Declaration part in syntax-mode: Selection of the data type ................................................... 90 fig. 82: Context menu in the declaration part...................................................................................... 90 fig. 83: Menu Insert .......................................................................................................................... 90 fig. 84: Example: Insert of elementary data types ............................................................................... 91 fig. 85: Example: Insert of manufacturer-function-block.................................................................... 91 fig. 86: Free variable-editor ................................................................................................................. 93 fig. 87: Declaration line in the free mode............................................................................................. 93 fig. 88: Exception: Address without variable name ............................................................................. 93 fig. 89: Example for the variable declaration in the Free-mode...................................................... 94 fig. 90: Example: Elementary data types ............................................................................................ 95 fig. 91: Standard-toolbar ...................................................................................................................... 96 fig. 92: Use of the IL-editor .............................................................................................................. 96 fig. 93: Syntax of an IL-line with operator........................................................................................... 96 fig. 94: Syntax of a call of a function block instance........................................................................... 97 fig. 95: Calls can be spread out over several lines ............................................................................... 97 fig. 96: Insert of a variable or function block instance ........................................................................ 98 fig. 97: FB-Instance with call-template ............................................................................................ .... 98 fig. 98: The toolbox .............................................................................................................. ................. 99 fig. 99: Selection of an operator which is to insert............................................................................... 99 fig. 100: Function Insert ................................................................................................................. 100 fig. 101: Tool-button Use of the LD-editor ..................................................................................... 102 fig. 102: Accept variable into LD ....................................................................................................... 102 fig. 103: Button of the tool panel ....................................................................................................... 103 fig. 104: Toolbox of the operators....................................................................................................... 103 fig. 105: Conditioned operation.......................................................................................................... 104 fig. 106: LD branch label................................................................................................................. 104 fig. 107: Name element: branch label ................................................................................................ 104 fig. 108: Select function block instances............................................................................................. 105 422
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

13 Index

fig. 109: LD - Network-Label ............................................................................................................. 106 fig. 110: LD-network with branch label............................................................................................. 106 fig. 111: Place for insertion is marked ............................................................................................... 107 fig. 112: AND-operation inserted ....................................................................................................... 107 fig. 113: An Input is marked to which a parallel contact should be created..................................... 107 fig. 114: Parallel contact inserted....................................................................................................... 108 fig. 115: Position of inserting a new termination is marked: Termination is inserted under Output_1............................................................................................................................ 108 fig. 116: List of branch operators....................................................................................................... 108 fig. 117: New output above Output_2 inserted.............................................................................. 109 fig. 118: Connecting ending points are marked................................................................................ 109 fig. 119: Vertical connection was inserted ......................................................................................... 110 fig. 120: Deleting connection is marked ............................................................................................. 110 fig. 121: Connection is deleted............................................................................................................ 110 fig. 122: The element, which is to negate, is marked ......................................................................... 110 fig. 123: Element was negated ............................................................................................................ 111 fig. 124: The element, which is to name, is marked........................................................................... 111 fig. 125: Name LD - Element.............................................................................................................. 111 fig. 126: The jump instruction, which is to define, is marked ........................................................... 112 fig. 127: Name LD - Element as label................................................................................................. 112 fig. 128: Jump operation is defined .................................................................................................... 112 fig. 129: Enter LD - network-comment.............................................................................................. 113 fig. 130: Network-comment is inserted .............................................................................................. 113 fig. 131: Network-Label...................................................................................................................... 115 fig. 132: Network-comment ................................................................................................................ 115 fig. 133: Network-graphic .................................................................................................................. 116 fig. 134: LD/FBD-toolbar ................................................................................................................... 117 fig. 135: Tool-button Use of the FBD-editor................................................................................... 117 fig. 136: FBD Accept variable .......................................................................................................... 117 fig. 137: The toolbox ........................................................................................................................... 118 fig. 138: Insert operator...................................................................................................................... 118 fig. 139: FBD branch label .............................................................................................................. 119 fig. 140. Accept declared function block ............................................................................................ 120 fig. 141: Function block inserted........................................................................................................ 120 fig. 142: Position for insertion is marked ........................................................................................... 121 fig. 143: FBD insert function ........................................................................................................... 121 fig. 144: Function ispositive was inserted ....................................................................................... 122 fig. 145: FBD Function inserted incorrectly ................................................................................... 122 fig. 146: FBD - Network-label ............................................................................................................ 123 fig. 147: Network was provided with a label...................................................................................... 123 fig. 148: Position for insertion is marked ........................................................................................... 124 fig. 149: List of logical operators........................................................................................................ 125 fig. 150: Operand AND was inserted ............................................................................................. 126 fig. 151: Circuit symbol to delete is marked ...................................................................................... 126 fig. 152: Circuit symbols and no longer connected circuit symbols were deleted ............................. 127 fig. 153: Input, behind which a new input should be inserted, is marked......................................... 128 fig. 154: New input was inserted ........................................................................................................ 128 fig. 155: Input to delete is marked ..................................................................................................... 129 fig. 156: Input was deleted.................................................................................................................. 129 fig. 157: If the position in front of the output is marked, the new output will be inserted above the existing one ........................................................................................................... 130 fig. 158: New output was inserted above the output fault indicator .............................................. 131 fig. 159: If an existing output is marked, the new output will be inserted below the existing one ......................................................................................................................................... 131 fig. 160: A new output was inserted under the output fault indicator .......................................... 132 fig. 161: The outputs to delete are marked ........................................................................................ 132
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

423

13 Index

fig. 162: The marked outputs was deleted.......................................................................................... 133 fig. 163: The input to negate is marked ............................................................................................. 134 fig. 164: The marked input was negated............................................................................................ 134 fig. 165: The output to negate is marked............................................................................................ 135 fig. 166: The marked output was negated .......................................................................................... 135 fig. 167: Name FBD - element ............................................................................................................ 136 fig. 168: Insert variable ...................................................................................................................... 137 fig. 169: Name FBD - element ............................................................................................................ 137 fig. 170: The jump instruction, which is to defined, is marked ......................................................... 138 fig. 171: Name FBD - element as branch destination ........................................................................ 138 fig. 172: Branch destination was entered........................................................................................... 138 fig. 173: FBD - network-comment...................................................................................................... 139 fig. 174: Network-comment was inserted........................................................................................... 139 fig. 175: Button for switching to ST ................................................................................................... 140 fig. 176: Instructions in ST ................................................................................................................. 141 fig. 177: List of operators ................................................................................................................... 147 fig. 178: Dialog box manufacturer function block ............................................................................. 148 fig. 179: Dialog box manufacturer function ....................................................................................... 149 fig. 180: Tool-button for switchover the programming language ...................................................... 150 fig. 181: POU-part cant be displayed graphically ............................................................................ 150 fig. 182: Global user-defined data types ............................................................................................ 155 fig. 183: Syntax check with error message......................................................................................... 156 fig. 184: Cross-reference list............................................................................................................... 157 fig. 185:Take the cursor to a definite line .......................................................................................... 157 fig. 186: Change POU-Type ............................................................................................................... 158 fig. 187: Change function type............................................................................................................ 158 fig. 188: Dialog field Print .............................................................................................................. 159 fig. 189: a washing process as SFC-plan ............................................................................................ 248 fig. 190: valid predecessors and successors of SFC-elements ............................................................ 249 fig. 191 : the layout of the SFC-editor ................................................................................................ 250 fig. 192: the SFC-plan of a new created document ............................................................................ 250 fig. 193 : Marking a single element by aid of the mouse ................................................................... 251 fig. 194 : Marking of several elements region marks ..................................................................... 252 fig. 195 : Insert position of a jump ..................................................................................................... 254 fig. 196 : Editing of the IL-code of a step........................................................................................... 255 fig. 197: SFC jump with no valid target............................................................................................. 257 fig. 198: SFC jump with no unique target.......................................................................................... 258 fig. 199: SFC jump into a simultaneous sequence .............................................................................. 258 fig. 200: SFC chart with no initial step .............................................................................................. 259 fig. 201: SFC dialog "GoTo IL-Line" ................................................................................................ 259 fig. 202: SFC Error messages on error in declarations ..................................................................... 260 fig. 203 : Display of the active steps in the online-modus .................................................................. 260 fig. 204: CFC Editor ........................................................................................................................... 264 fig. 205 : CFC-Editor toolbar ............................................................................................................. 264 fig. 206 : CFC-Editor with no chart opened ...................................................................................... 266 fig. 207: empty chart in CFC Editor .................................................................................................. 267 fig. 208: CFC Editor with grid shown................................................................................................ 267 fig. 209: CFC-Editor: Insert Function Block dialog .......................................................................... 268 fig. 210: block inserted into CFC chart.............................................................................................. 269 fig. 211: connected blocks in CFC-Editor .......................................................................................... 269 fig. 212: Output and Input connector marked ................................................................................... 270 fig. 213: Output and Input connector connected ............................................................................... 270 fig. 214: Ouput and multiple Inputs marked ..................................................................................... 270 fig. 215: Output and multiple Inputs connected................................................................................. 271 fig. 216: Connection line and Input marked ...................................................................................... 271 fig. 217: Input added to connection line ............................................................................................. 272 424
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

13 Index

fig. 218:Properties margin connector dialog...................................................................................... 273 fig. 219: Margin connector named ..................................................................................................... 274 fig. 220: Margin connector marked ................................................................................................... 275 fig. 221: Input connected to margin connector .................................................................................. 275 fig. 222: Margin connector properties dialog .................................................................................... 276 fig. 223: Input connected to margin bar with address....................................................................... 277 fig. 224: constant value input.............................................................................................................. 277 fig. 225: sample chart window............................................................................................................ 278 fig. 226: sample chart window zoomed out ........................................................................................ 278 fig. 227: CFC chart............................................................................................................................. 279 fig. 228: Moving block to empty field................................................................................................. 280 fig. 229: block moved to empty field .................................................................................................. 280 fig. 230: sample chart with block dragged......................................................................................... 280 fig. 231: block dragged to empty field................................................................................................ 281 fig. 232: multiple blocks marked........................................................................................................ 281 fig. 233: multiple blocks dragged ....................................................................................................... 282 fig. 234: sample chart ......................................................................................................................... 282 fig. 235: blocks pasted ........................................................................................................................ 283 fig. 236: margin bar properties dialog ............................................................................................... 284 fig. 237: TUI window .......................................................................................................................... 286 fig. 238: block interface modified warning message.......................................................................... 287 fig. 239: Find-dialog............................................................................................................................ 287 fig. 241: Hierarchy of datatypes......................................................................................................... 292 fig. 242: definition of an IL sequence ................................................................................................. 300 fig. 243: Forms Editor ........................................................................................................................ 391 fig. 244: FXF main window ................................................................................................................ 393 fig. 245: FXF with files added to export............................................................................................. 394 fig. 246: FXF export............................................................................................................................ 395 fig. 247: FXF specify export archive name ........................................................................................ 396 fig. 248: FXF reporting success .......................................................................................................... 396 fig. 249: FXF main window ................................................................................................................ 397 fig. 250: FXF import archive dialog ................................................................................................... 397 fig. 251: FXF import successful .......................................................................................................... 398

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

425

13 Index

13.2 Keywords
Add Step/Transition Right (Insert Menu / SFC) 173 addition 144, 301, 330 Address 23 Adresse 85 Alt+F10 152 AND 144, 236, 292, 298, 315, 319 AND Contact (Insert Menu / Ladder) 188 ANDN 292, 298 ANY_BIT 320, 323 Anzeigen Toolbox 101, 116 Apostrophe 309 arithmetic operators 301 Arrange Icons (Window Menu / SFC) 179 ARRAY 287 Assigning a Constant 271 assignment 138, 296 AT 289, 291 %I 266 %Q 266 Attribut 85 Attribute 23 Aufrufe von Funktionsbausteinen 98 Available variable types 163

$
$ 309 $$ 395 $ 395 $L 395 $N 395 $P 395 $R 395 $T 395

%
% 289 I 290 M 290 Q 290

&
& 292, 298 &N 292, 298

B *
** 400 *_TO_** 323 *_TO_BCD 399 B 85 BCD_TO_** 399 Bearbeiten Alles markieren 154 Ausschneiden 154 Ersetzen 154 Gehe zu... 154 Kopieren 154 Lschen 154 Rckgngig 154 Suchen 154 Betragsbildung 329, 332, 334, 336, 351, 353 block 262, 263 adding 262 Copying 275 Copying a Group of 275 delete 277 drag 274 drop 275 fields 262 invalid 281 move 273, 274 Placing 262 Positioning 262 Selecting 262 Shifting a Group of 275 blocks

0
0---T 404

8
80386 15

A
About SFC Editor (Help Menu / SFC) 180 ABS 217, 327, 329, 332, 334, 336, 351, 353 Absolute Value 327 ACTIVATE_STEP 250 ADD 218, 292, 330, 402 numeric 301 Add Step/Transition Left (Insert Menu / SFC) 173

426

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

13 Index

Connecting 263 BOOL 308 F_EDGE 286 R_EDGE 286 boolean AND 144 OR 144 XOR 144 bsp 18 BY 141

C
CAL 293, 307, 317, 322 CALC 293, 317, 322 CALCN 293, 317, 322 Carriage Return 309 Cascade (Window Menu / SFC) 179 CASE 140 CFC 37, 39, 284, 313 CFC-Editor Overview of 257 Change POE-Type (File Menu / Ladder) 182 Change Size 164 clipboard 276 Close (Basic Commands) 165 Close (File Menu / Ladder) 181 Close (File Menu / SFC) 166 Coil 314 Coil (Insert Menu / Ladder) 189 Coils 200 Cold Start 33 columns 262 Commands "Edit" Menu (Ladder) 184 Commands "Edit" Menu (SFC) 168 Commands "File" Menu (Ladder) 181 Commands "File" Menu (SFC) 166 Commands "Help" Menu (SFC) 179 Commands "Insert" Menu (Ladder) 187 Commands "Insert" Menu (SFC) 172 Commands "Online" Menu (Ladder) 190 Commands "Online" Menu (SFC) 177 Commands "View" Menu (Ladder) 190 Commands "View" Menu (SFC) 174 Commands "Window" Menu (SFC) 178 comment 16, 23, 293 nested 384 Comments 197 comparison 144, 303 Compile 30 complement 144 Compound Block add input 283 add output 283 convert blocks 283 insert new 283 nesting 282 CONCAT 402 Connection Add another Input 265 Connecting Blocks 263
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

Connection Tool 266 delete 277 Deleting 277 Input to Constant 271 Output to Input 264 Output to more than one input 264 connection channels 262 Connection Properties 63 Connection Setup 61 Connection Tool 266 constant 271 Assigning to an Input Connector 271 character constants 309 literal 308 predefined character constants 309 Strings 309 CONSTANT 291, 308 Contact 314 Contacts 200 Content and Index (Help Menu / SFC) 180 Continuous Function Chart 37, 284, 313 Control Relay (Insert Menu / Ladder) 189 Control Relays 201 Copy (Edit Menu) 170, 185 Create Ladder Diagramm 193 Create Ladder Logic 193 CTD 210, 373 Ctrl + C 255 Ctrl + S 255 Ctrl + V 255 Ctrl + X 255 Ctrl + Y 255 Ctrl + Z 255 CTRL Key 107, 264, 265 CTRL+SHIFT 32 CTU 211, 309, 374 CTUD 212, 375 Cursor keys 246 Cut (Edit Menu) 170, 185 cyclic 142

D
D 308 D# 396 datatypes 285 derived 286 elementary 285 generic 323 Datatypes User defined function blocks... 68 DATE 308, 396, 397 DATE# 396 DATE_AND_ TIME 396 DATE_AND_TIME 308, 397 DATE_AND_TIME# 396 DATE_AND_TIME_TO_DATE 402 DATE_AND_TIME_TO_TIME_OF_DAY 402 Datei Drucken... 155

427

13 Index

POE-Typ wandeln 154, 155 Syntaxprfung 152 Datentyp 85 Ddeclaration Attributes 291 DEACTIVATE_ALL_STEPS 250 DEACTIVATE_STEP 250 Debug Add watch variable 33 Debugging 279 declaration part 284 declaration sections overview 290 declaration sections 292 Declarations 163 DEL Key 30, 277 DELETE 401 Delete (Edit Menu) 171, 186 Deleting Connection 277 DEMO 15 derived datatypes array 287 enumeration 287 structure 288 sub-range 286 Description of the Output Window (View Menu / SFC) 176 Description of the Status Bar 176 Descripton of the Toolbar 175 Digital-Ausgang 85 Digital-Eingang 85 Direct Help 180 directly represented variable 289 declaration 289 symbolic name 289 syntax of %... 290 DIV 221, 292, 339, 402 numeric 302 division 144, 302, 339 DO 141 drag 274 Drag-and-Drop 29 driver 61 drop 275 DT 308 DT# 396 Dual number 308 DW 85

E
Edit (Edit Menu / SFC) 172 Edit Resource 64 Edit Copy 247, 255 cut 255 Edit 250 Insert Replace 255 Redo 255 Replace 247

Undo 255 Einfgen Anfangs-KOP-Netzwerk 101, 117 Eingang einfgen 125 Element benennen... 110, 135 Funktionen... Anwender 119 Funktionen... Hersteller 119 Netzwerkabschlu 102, 117 Netzwerk-Kommentar... 111 Netzwerk-Kommentar.... 136 Netzwerk-Label 104, 121 Operatoren... 105, 122, 127 Variable 102, 110, 117, 133, 134 Eingabetaste 110 Eingabetaste 102, 109, 117, 133, 134 elementary datatypes 285 ELSE 140 EN 399 END_CASE 140 END_FOR 141 END_REPEAT 142 END_TYPE 286, 291 END_VAR 291 END_WHILE 141 ENO 399 Enter 102, 109, 117, 133, 134 ENTF 104, 120, 123, 126, 129 EQ 228, 292, 303, 320, 402 equality 144 escape sequences 309 EXAMPLES add3 330 Addition 330 Alarm 378 aminusb 368 Arrays 287 Bit Addressing 384 CTUD 375 directly represented variables 289 divide 339 Edge Detection 376 Edges 376 F_TRIG 376 feld 287 Fill 377 Flip-Flop 377, 378 Function Call 310 Functionblock Call 312 how_long 344 IntNum 371 LEN 344 mul3 355 Multiplication 355 negation 358 Only_1_Bit 384 poe1 309 poe2 310 poe3 312 poe4 289 PROGRAM 309 pulse 381 rot_le 360
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

428

13 Index

rot_re 361 Rotate 360, 361 RS 377 shft_l 362 shft_r 363 Shift 362, 363 smpl_pou 284 SR 378 structures 288 struktur 288 Subtract 368 time1 380 time2 379 TOF 379 TON 380 TP 381 TRUNC 371 typical elements of a POU 284 Visitors 375 Exchange Format 387 Exclusive OR 300 execution sequence 280 EXIT 142 Exit (File Menu) 168, 183 exponentiation 144 Exponentiation 408 EXPT 400 Extern 84

F
F_TRIG 203, 376 FALSE 285 FALSE 394 FBD 37, 313 File Exchange Format 387 File New 245 New Resource 28 New Task 29 Save 255 Syntaxcheck 25, 66, 392 Flip-Flop reset dominant 377 set dominant 378 FOR 141 Form Feed 309 Forms Editor Editing elements 386 Fixed Text 386 Overview 385 Printing a form 386 Free Declaration Editor 40 Function 213, 310 Calling 308 Calling in Function Block Diagram 321 Calling in Ladder Diagram 317 Example 310 overloaded 323 Overview 322 Standard Functions 322
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

FUNCTION 26, 39, 145, 292 Call 144 Invocation 144 Function (Insert Menu / Ladder) 188 Function Block 202 Function Block (Insert Menu / Ladder) 188 Function Block Diagram 37, 313 AND 319 Assignment 320 Calling Functionblocks 321 Calling Functions 321 Conditional Jump 321 JMPC 321 JMPCN 321 negate intermediate result 319 OR 319 programming 318 R 320 RET 321 RETC 321 RETCN 321 Return 321 S 320 Unconditional jump 321 XOR 319 Programming Language 318 Function Blocks 202 Function of the Output Window 160 FUNCTION_BLOCK 26, 39 Functionblock 311 Call 143 Calling in Function Block Diagram 321 Calling in Ladder Diagram 317 conditional call 147 example 311 Instance 312 instantiating 292 Overview 371 parameter passing 312 passing output parameters 384 Standard Functionblocks 322 unconditional call 307 functionblock list 262 Functions and Function Blocks 199 FXF 387

G
GE 227, 292, 303, 320 General Information 157 General Information on Ladder Diagram Editor 192 General information on Ladder Logic 192 General Information on the Online Editor 239 generic datatype 323 GETTIME 382 GETTIMECS 383 Global 83 Go To (Edit Menu / Ladder) 187 Go To AWL-row (Edit Menu / SFC) 172

429

13 Index

Grid Show/Hide 261 GT 226, 292, 303, 320

Jump (Insert Menu / SFC) 173

H
hard disk drive 15 Help 3 Hexadecimal number 308 Hide Grid 261 Hot Start 33

K
Kaltstart 72 keywords_ declaration 290 Kommentar 85 Kontakte 98

L
Label 293, 294 Ladder Diagram 196, 313 AND operation 315 Calling Functionblocks 317 Calling Functions 317 JMPC 317 JMPCN 317 Jump 316 negated assignment 316 negated assignment symbol 316 OR-operation 315 reset 316 RETC 317 RETCN 317 Return 317 set 316 unconditional jump 316 Ladder Editor 158 LD 292, 295, 313 LDN 292, 295 LE 229, 293, 303, 320 Leertaste 105, 108, 131, 132 LEN 232, 344 libraries 65 Library Add 68 Install 67 Install 67 Uninstall 68 licence 15 licence code 15 LIMIT 233, 401 Line Feed 309 Line number 25 LINT 396 literal constant 308 Literals 144 Load Instructions 295 Location-Mnemonic 290 Logical Connections 199 logical operations 298 Lokal 84 LREAL 396 LT 230, 293, 303, 320 LWORD 396

I
IEC1131 266 AT %I 266 AT %Q 266 Declaration 266 IF 139 IL 37 inequality 144 Initial step 241 Initial value 23 Initialwert 85 input operators 408 Insert Compound Block 283 INSERT 401 Insert Step/Transition (Insert Menu / SFC) 173 instance 292, 312, 372 instruction arithmetic operators 301 assignment 296 comparisons 303 conditional jump 305 Function call 308 functionblock call 307 Load 295 logical operations 298 syntax 293 unconditional jump 305 instruction list 37 instruction part 284 Introduction 162 invalid block 281 invoked 372 ISO/IEC 646 409

J
JMP 293, 305 JMPC 293, 317, 322 JMPCN 293, 317, 322 Jump 242, 314 Conditional 305 in Ladder Diagram 316 instruction 305 unconditional 305

430

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

13 Index

M
margin bars 259 margin connectors 266 marginbar 266 Marker 290 Maximize (Basic Commands) 165 member 288 Menu 192 Merker 85 microprocessor 15 Microsoft Windows 15 MID 401 Minimize (Basic Commands) 165 Mixed combinations 238 Mixed Logic 316 MOD 144, 234 modulo 144 mouse 15 move 273, 274 Move 164 MOVE 235, 400 Move Left (Edit Menu / SFC) 171 Move Right (Edit Menu / SFC) 171 MUL 219, 292, 355, 402 numeric 302 multiplication 144, 302, 355 MUX 401, 402

N
Name 23 NE 231, 292, 303, 320, 402 Negate (Edit Menu / Ladder) 185 negation 144, 358 Network 197 Network (Insert Menu / Network) 187 Network Settings 64 Netzwerkgrafik 112, 113 Netzwerkkommentar 113 Netzwerkkommentar 112 Netzwerkmarke 112, 113 New Line 309 Next (Basic Commands) 165 NOT 144, 358 function 319 NT 15

unconditional jump 305 Operator 293 arithmetic operators 301 CAL 307 comparisons 303 Load 295 logical 298 operators input operators 408 Operators 198 Operators 144 Optionen Programmiersprache ST 137 Variableneditor Freier Modus 86 Variableneditor Freier-Modus 155 Variableneditor Syntax Modus 86 Options (Extra Menu / Ladder) 190 Options Free Mode 40 Programming Language 147 Syntaxcontrolled Mode 40 OR 144, 237, 292, 299, 319 Or Contact (Insert Menu / Ladder) 189 ORN 292, 299 OR-operation 315 Others (Insert Menu / Ladder) 189 Output 83 Output Window 157 Output Window (View Menu / SFC) 175 overloaded 285 Overloaded Functions 323

P
Page Setup (File Menu) 167, 182 PASCAL 310 Paste / Add Left (Edit Menu) 170 Paste / Add right (Edit Menu / SFC) 171 Paste / Substitute (Edit Menu) 170, 186 Pentium 15 PLC ColdStart 33 Hot Start 33 Stop 33 Warm Start 33 plcOpen 4 PLCopen 387 POE bearbeiten 154 position 16 Position.poe 29 POU declaration part 284 instruction part 284 Program Organisation Units 284 POU Editor IL switch to LD/FBD 147 POU Editor LD/FBD Switch to IL 147 Presentation 160 Print 279

O
Octal number 308 OF 140 Offline (Online Menu / SFC) 178 Online 195, 279 Operand 144, 293 Operations assignment 296 conditional jump 305 Function call 308

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

431

13 Index

Print (File Menu) 167, 182 Print Preview (File Menu / SFC) 168, 183 Printer configuration 279 Program 309 Storing 279 PROGRAM 16, 26, 40, 292 Program Organisation Units 284 Programm Test 279 Programming Language graphical languages 313 Ladder Diagram 314 switching 147 Project Browser 17 Project New 18 New... 65, 67 Properties (Edit Menu / SFC) 172 Property Sheet 271

Q
question marks 281

R
R 292, 297, 320 R_TRIG 204 RAM 15 Redo (Edit Menu) 169, 185 reference points 263 REPLACE 401 Replace (Edit Menu / Ladder) 186 Replace Declaration of variables 187 Reset 297, 314, 320 resource 26, 28 Restore 164 RET 293, 306 RETAIN 291 RETC 293 RETCN 293 return 306, 314 RETURN 143 rewiring 289 robot arm 16 ROL 224, 360 ROR 225, 361 rows 262 RS 205, 377 RTC 404

Search (Edit Menu) 171, 186 Search for Declaration of variables (Edit Menu / Ladder) 187 SEL 401, 402 Select All (Edit Menu) 172, 186 SEMA 403 sequence of execution 280 sequences 294 serial number 15 Set 297, 314, 320 SETUP.EXE 15 SFC Editor 159 SFC-editor 244 SHL 222, 309, 362 Show Grid 261 SHR 223, 363 Simultaneous sequences 241 Single-Bit Access 384 Size-Mnemonic 290 Spacebar 107 Springer Verlag 3 Sprunganweisungen 98 Spulen 98 SR 206, 378 ST 37, 292, 296, 313 Standard Functionblocks 322, 371 Standard Functions 145, 322 Shift 362 type conversion 323 Start (Online Menu / Ladder) 190 State Notice (Online Menu / SFC) 177 Status Bar (View Menu / SFC) 175 status line 259 Step 241 STN 292, 296 STOP 33 Stop (Online Menu / Ladder) 191 STRING 308 STRUCT 288 structure 288 member 288 Structured Text 37, 313 Strukturierter Text 37 SUB 220, 292, 368, 402 numeric 301 subtraction 144, 301 Survey "Help" Menu (Ladder) 191 Survey "Window" Menu (Ladder) 191 Survey of Menus (Ladder-Editor) 180 Survey of menus (SFC Editor) 166 syntax check 25 Syntax Check 195 Syntax Check (File Menu / Ladder) 182

S
S 292, 297, 320 Save 194 Save (File Menu / Ladder) 181 Save (File Menu / SFC) 167

T
T 308 T---0 404 Tabulator 309 task 26, 29 TD 396
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

432

13 Index

Test and Commissioning 279 The commands 1 2... (Window Menu / SFC) 179 The standard IEC-61131-3 157 Tile (Window Menu / SFC) 179 Tile Horizontally (Window Menu / SFC) 179 Tile Vertically (Window Menu / SFC) 179 TIME 308 TIME_OF_DAY 308, 397 TIME_OF_DAY 396 TIME_OF_DAY# 396 TO 141 TOD 308, 396 TOD# 396 TOF 207, 379 TON 208, 380 toolbar 258 Toolbar 193 Toolbar (View Menu / SFC) 174 Toolbox 101, 116 TP 209, 381 Training 3 Transition 241 Transitionsbedingung 405 TRUE 285, 394 TRUNC 216, 371, 399 TUI 279 Type 23, 84 TYPE 84, 286, 290, 292 Type Convention 214 Type Conversion Functions 215

VAR_INPUT 83, 290, 292 VAR_OUTPUT 83, 290, 292 variable 144, 289 AT 291 Attributes 291 CONSTANT 291 directly represented 289 global 290 IN_OUT 290 input 290 local 290 output 290 RETAIN 291 status display 33 Variable (Insert Menu / Ladder) 188 Variable Editor 157 Variablennamen 85 Verbindungen 98 VGA 15 View Level Up 282 View Zoom In 255 Zoom Out 255

W
W 85 Warmstart 33 washing machine 243 WHILE 141 Windows 95 15 Windows NT 15

U
ULINT 396 undef_opd 109 underscore 308 Undo (Edit Menu) 169, 184 UNTIL 142 Use Help (Help Menu / SFC) 180 Use of Functions 213 Using the Online Editor 239

X
X 85 XOR 144, 292, 300, 319 XORN 292, 300

Z V
VAR 84, 290, 292 VAR_ACCESS 398 VAR_EXTERNAL 83, 84, 290, 292 VAR_GLOBAL 83, 290, 292 VAR_IN_OUT 83, 290, 292 Zoom Factor Zoom In 272 Zoom Out 272 Zoom In (View Menu / SFC) 177 Zoom Out (View Menu / SFC) 177

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

433

13 Index

For internal use only: Document D:\Produkte\v4.1\User Manuals\OpenPCS 41E1.doc Version 4.1 Status Draft Datum 12.3.2001

434

1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de

Das könnte Ihnen auch gefallen