Beruflich Dokumente
Kultur Dokumente
User Manual
1. Edition
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
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.
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
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
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
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
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
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
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
7.1 7.2
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
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
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
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
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
13
14
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.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.
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.
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
2 Introduction
(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).
17
2 Introduction
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
2 Introduction
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.
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:
19
2 Introduction
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
2 Introduction
21
2 Introduction
22
2 Introduction
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.
In our example, we will only need local declarations. This is the default, but to be sure, select Local again.
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.
23
2 Introduction
(*switch motor on *)
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
2 Introduction
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.
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.
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.
27
2 Introduction
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.
28
2 Introduction
The branch Configuration has a new entry representing the resource we just defined.
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.
29
2 Introduction
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
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
2 Introduction
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.
31
2 Introduction
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
2 Introduction
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.
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.
33
2 Introduction
34
2 Introduction
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.
35
2 Introduction
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
2 Introduction
37
2 Introduction
AT %I0.0
(* 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
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:
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
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.
41
2 Introduction
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
2 Introduction
43
4 3
44
(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.
45
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.
46
By the toolbar: Click on the button Open Project: By the menu: Click on Project Open Project in the main menu.
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:
47
Enter the destination path, and start with the button 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
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:
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.
49
Hint: When renaming a project, please consider the restrictions given in chapter 3.3.1 for names and paths of projects.
50
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.
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
51
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:
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
53
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:
54
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:
55
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.
56
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.
To change the network settings, click on the button Network settings. The following dialog will appear:
57
Select in this dialog box the communication protocol of the control system.
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
58
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.
Select the file which you will assign to the resource, and accept this by the button Open.
59
Mark the type definition, which you want to add to the resource, and accept by Open-button.
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
fig. 55: Compiler messages during the compilation of the resource Bsp_res
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.
61
If a .PCD file has not already been loaded via a particular connection, a question mark (?)will appear as Code-Repository path.
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.
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:
63
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
65
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.
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 ;
ST LD ST
67
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
) 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
69
70
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:
71
72
PLC Warmstart
PLC Hotstart
73
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:
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.
74
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.
75
76
77
3.14.1 Settings
Select in the project browser the menu item Extras Options. The following window will be opened:
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
Hide variable nodes: The listing of variables of a resource block can be shown or hidden. Only variables of compiled resources can be displayed.
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.
79
80
81
4 The POU-Editor
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
4 The POU-Editor
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.
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.
Delete declarations of variables and function block instances which you dont need anymore. Otherwise you waste memory on your PLC.
84
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
85
4 The POU-Editor
Local
86
4 The POU-Editor
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
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.
88
4 The POU-Editor
89
4 The POU-Editor
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
90
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.
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.
92
4 The POU-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
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):
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 *)
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;
Counter1 : CTU;
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
4 The POU-Editor
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.
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
Direct help
.
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:
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
4 The POU-Editor
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.
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:
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.
98
4 The POU-Editor
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:
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.
99
4 The POU-Editor
Select a function from the list and insert at cursor position with OK.
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
4 The POU-Editor
Activate the POU-editor LD (Extras Programming Language create a POU in the programming language LD.
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.
101
4 The POU-Editor
In the menu Insert the following actions are available for the program development:
For an easier program editing, you can also use the buttons of the toolbar:
102
4 The POU-Editor
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.
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.
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.
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.
Accept by the Enter-key. The window Name element" will be opened, in which you specify the branch label:
104
4 The POU-Editor
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.
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 .
105
4 The POU-Editor
Use delete key DEL" or Edit The marked network will be deleted.
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:
106
4 The POU-Editor
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.
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.
107
4 The POU-Editor
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.
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
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.
109
4 The POU-Editor
Delete vertical line Mark the vertical line that you want to delete.
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:
Hit the spacebar. The marked element will be negated. You can also carry out this action by the toolbar or the toolbox.
110
4 The POU-Editor
Hit the Enter key. The dialog field Name element will be opened:
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.
Hit the Enter key. This action is also available in the menu Insert Name Element... .
Enter the name of the branch destination and hit the OK"-button.
112
4 The POU-Editor
Enter the comment, then press OK". The entered comment appears in the network heading below the network number.
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.
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.
FBD-networks consist of the graphical objects: Network label, Network comment, and Network graphic,
114
4 The POU-Editor
115
4 The POU-Editor
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.
116
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 .
Declare the variables, as declared in chapter 4.2, and press the tool-button Use of the FBDeditor:
In the menu Insert the following actions are available for the program development:
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.
Activate the toolbox by the menu item View Toolbox and click on the corresponding operator for retrieving.
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.
118
4 The POU-Editor
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.
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.
Accept by the Enter-key. The window Name element" appears, in which you enter the branch label.
119
4 The POU-Editor
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.
120
4 The POU-Editor
Select the function from a list which you can open by the menu item with Insert Manufacturer/User Functions... or by the context menu.
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.
121
4 The POU-Editor
If you try to insert a function at a incorrect position, the following error message will be displayed:
122
4 The POU-Editor
Select all .
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:
123
4 The POU-Editor
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.
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
4 The POU-Editor
125
4 The POU-Editor
Hit the button OK. The symbol of the operator appears behind the marked position:
126
4 The POU-Editor
fig. 152: Circuit symbols and no longer connected circuit symbols were deleted
127
4 The POU-Editor
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.
Should an input be inserted below, the lower input or the circuit symbol can be marked in order to do it.
128
4 The POU-Editor
129
4 The POU-Editor
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.
131
4 The POU-Editor
fig. 160: A new output was inserted under the output fault indicator
132
4 The POU-Editor
133
4 The POU-Editor
Hit the spacebar. The marked input will be negated. You can also carry out this action by the tool panel or the toolbox.
134
4 The POU-Editor
Hit the spacebar. The marked output will be negated. You can also carry out this action by the toolbar or the toolbox.
135
4 The POU-Editor
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:
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
4 The POU-Editor
Name output Mark the output for which you want to enter a variable name. Hit "Enter". The dialog field Name element" will be opened:
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.
137
4 The POU-Editor
Hit "Enter". The action is also available in the menu Insert The dialog field Name element" will be opened: Name element... .
138
4 The POU-Editor
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.
139
4 The POU-Editor
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
140
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;
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
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.
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
END_IF;
An instruction block represents one or more instructions. Note that every instruction block is finished by a semicolon.
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
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.
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.
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
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 *)
145
4 The POU-Editor
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.
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
4 The POU-Editor
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
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 *)
Mark the name of a function block instance Close the dialog box with OK.
4 The POU-Editor
Select Insert
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 (.
149
4 The POU-Editor
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.
To work around restrictions in cross-compiling from IL to LD and FBD, see the following chapters.
150
4 The POU-Editor
| full := Q, := CV )
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:
151
4 The POU-Editor
152
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
153
4 The POU-Editor
154
4 The POU-Editor
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.
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:
155
4 The POU-Editor
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.
156
4 The POU-Editor
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.
157
4 The POU-Editor
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.
4.15 Printing
4.15.1 Print a POU
Select File Print,
158
4 The POU-Editor
Select the button OK". Afterward the print will be sent to the printer.
159
5 ControlX Editor
160
5 ControlX Editor
161
5 ControlX Editor
Further information: General Information General Information on Ladder Logic Variable Editor Output - Window Ladder Diagram
162
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
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
5 ControlX Editor
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
165
5 ControlX Editor
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:
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.
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
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.
Shortcut: Keyboard:
Shortcut: Keyboard:
STRG+F6
168
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
169
5 ControlX Editor
170
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.
171
5 ControlX Editor
Keyboard:
ALT+F4
Cut
Copy
Paste / Replace
Delete Move Left Move Right Search Go to AWL row Select All Edit
Properties
172
5 ControlX Editor
173
5 ControlX Editor
STRG+L
174
5 ControlX Editor
STRG+R
ENTF
ALT+L
ALT+R
Shortcut:
1996-2001 infoteam Software GmbH, D-91088 Bubenreuth http://www.infoteam.de
175
5 ControlX Editor
Keyboard:
STRG+Q
STRG+F
STRG+A
RETURN
ALT+RETURN
176
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
Jump
5.4.2.4.2.1
STRG+ALT+L
STRG+ALT+R
177
5 ControlX Editor
Shortcut: Keyboard:
STRG+ALT+J
178
5 ControlX Editor
179
5 ControlX Editor
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 .
180
5 ControlX Editor
Hilfe zum Gebrauch des Ausgabefensters finden Sie unter Description of the Output Window.
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
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)
181
5 ControlX Editor
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
Offline
5.4.2.6.1.1
182
5 ControlX Editor
5.4.2.6.2.1
183
5 ControlX Editor
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
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.
184
5 ControlX Editor
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
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
186
5 ControlX Editor
Alt+F10
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.
188
5 ControlX Editor
Keyboard:
ALT+F4
Go To ...
5 ControlX Editor
Space
190
5 ControlX Editor
ENTF
STRG+A
Shortcut: Keyboard:
STRG+Q
191
5 ControlX Editor
192
5 ControlX Editor
F12
Strtg+Alt+B
Strg+Alt+F
Shortcut Alt + V Alt + I Alt + O Alt + N Alt + L Alt + G Alt + E Alt + F Toolbar:
F9
193
5 ControlX Editor
Strg+F9
F10
F11
Action Inserts Reset as beginning symbol Inserts Set as beginning symbol Inserts Jump as beginning symbol Inserts Return as beginning symbol
194
5 ControlX Editor
Start Stop
Connection to control and statustest of an active program Closes the connection to the control
195
5 ControlX Editor
Next pane
196
197
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
198
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
199
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
See also: General Information on Ladder Logic Operators Function and Function Blocks Logical Connection
201
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:
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
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
Coils:
Jump:
203
See also: General Information on Ladder Logic Contacts Coils Functions and Functions Blocks Logical Connections
Function Blocks:
See also: General Information on Ladder Logic Functions and Functions Blocks Use of Functions Use of Function Blocks Logical Connections
204
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.
205
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
206
See also: General Information on Ladder Logic Operators Function and Function Blocks Logical Connections
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.
207
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
Meaning of operands: CLK: input operand whose falling edge is to be recognized Q: output operand; signals if "CLK" has a falling edge
208
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
209
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
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
211
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
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
213
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
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
215
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
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
217
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.
218
MOVE
Assignment
Choose a function from the table to see a graphical representation. Further Information General Information on Ladder Logic Functions and Function Blocks
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.
219
220
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
221
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
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
223
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
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
225
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
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
227
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
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
229
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
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
231
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
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
233
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
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
235
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
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
237
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
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:
239
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
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
241
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
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
243
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
244
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
245
7 The SFC-Editor
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
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.
247
7 The SFC-Editor
Step 2
Step 3
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
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
Detailed explanations about the programming with the sequential function chart could be founded in [IEC1131] or [John & Tiegelkamp, 1995], for example.
249
7 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).
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.
250
7 The SFC-Editor
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.
The mark of a single element can be transformed into a neighbour element by aid of the cursor keys (,,,) of the keyboard.
251
7 The SFC-Editor
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
252
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.
253
7 The SFC-Editor
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.
254
7 The SFC-Editor
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!
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.
Step1 _Step1
S_1 1Step
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.
256
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
2.
257
7 The SFC-Editor
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.
258
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
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:
259
7 The SFC-Editor
File Edit
Save Cut
Ctrl + S Ctrl + X
Saving of the active document Cut the marked elements into the clipboard
260
7 The SFC-Editor
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
Cancel the last alteration Cancel the command cancel again Help to the menu items
261
7 The SFC-Editor
262
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.
263
8 The 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:
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
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.
265
8 The CFC-Editor
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
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
8 The CFC-Editor
267
8 The CFC-Editor
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
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.
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.
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.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.
270
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:
Choose Insert Single Connection. The existing connection will be extended with an additional input. In the example above it is represented by reference points.
271
8 The CFC-Editor
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 The CFC-Editor
of a global variable.
273
8 The CFC-Editor
274
8 The CFC-Editor
Choose Insert Single Connection. The selected block connector and the margin connector will be connected
275
8 The CFC-Editor
Choose the OK button. The memory location appears in the corresponding symbol of the margin connector
276
8 The CFC-Editor
The input value appears in the status line of the main window when the connector is selected .
277
8 The CFC-Editor
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
Choose View Zoom In if you want to enlarge the blocks of the function chart.
278
8 The CFC-Editor
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
279
8 The CFC-Editor
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
280
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.
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
281
8 The CFC-Editor
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
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
283
8 The CFC-Editor
uncheck use I/O and press OK. The connection to the physical address will be deleted
284
8 The CFC-Editor
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).
285
8 The CFC-Editor
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
286
8 The CFC-Editor
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. ..
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
287
8 The CFC-Editor
288
8 The CFC-Editor
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.
2. 3.
289
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
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:
291
ANY
ANY_NUM
ANY_BIT
ANY_DATE
STRING
TIME
Abgeleitete Datentypen
REAL
ANY_INT
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
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
293
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
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.
295
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:
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.
TYPE
296
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
297
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
This declares an instance Counter1 of function block CTU. Inputs and Outputs are parameterised with the call to an instance.
Subtract Multiply Divide Compare for greater-than Compare for greater-equal Compare for equal Compare for non-equal
298
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 *)
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)
299
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.
300
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
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
301
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
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
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
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
303
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
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
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
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
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
0 1 11001100
Assuming that Input1 is FALSE and Input2 is FALSE, variable ORN_Bit will be set to TRUE
10101010 11011101
305
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
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
XOR Byte_2
10111110
ST XOR_Byte
01010001
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.
306
ADD Addition
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
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
307
MUL Multiplication
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
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
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:
309
310
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
M2:
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.
M2:
311
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:
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
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
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
313
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
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
*)
(* Instructions *)
(* Program end *)
315
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*)
(* 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
Read input
Write input
Read Output
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
317
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
Example
CAL Instance3_name (Val1:=MessVal1, Val2 := MessVal2 | Result3 := AvgVal)
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.
319
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
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
321
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
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.
323
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
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
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.
325
Assignment The current result, or the negated current result, can be assigned to any variable: Symbol for 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.
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
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
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.
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
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
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.
*_TO_** * **
329
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
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
332
333
334
335
ADD Addition
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
337
338
339
340
341
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
343
COS Cosinus
344
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 *)
345
346
Describtion EXP will compute the exponential function of the input to the base e.
347
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
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.
349
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
351
LN Natural Logarithm
LN REAL REAL
352
353
LOG
354
Describtion LOG will compute the logarithm of the input to the base 10.
355
356
MAX Maximum
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.
357
358
MIN Minimum
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.
359
MOD Modulo
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
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
361
NEG
362
Negation
Description NEG changes the sign of the input. The input must be a signed variable of the type INT, SINT, DINT or REAL.
363
Description The input is negated. If the input is a bitstring, this negation is done bitwise. Example Function NOT
LD Bitpattern NOT
364
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.
365
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
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
367
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
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
369
370
SIN Sinus
371
372
373
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
375
TAN Tangens
376
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
377
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
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.
379
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
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
381
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
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.
383
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
Inputs
IN PT Q ET Start Condition Preset Time Status Elapsed Time
Description
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
385
Inputs
IN PT Q ET Start Condition Preset Time Status Elapsed Time
Description
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
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
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
387
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
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
389
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
10 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.
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...
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.
Be careful to store all Bitmaps that you embedded into a form in the same directory as the form.
392
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.
393
11 FXF Import/Export
Press Button Add... and locate all POUs you want to export. See the list Project Files updated accordingly.
394
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:
395
11 FXF Import/Export
Press Button Export..., and enter the filename of your new FXF archive:
Successful export will be reported by a message box, close this with OK.
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
11 FXF Import/Export
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.
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.
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
399
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.1.5 Table 5:
No. 1 Description
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 ($)
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 literals without underlines: Short prefix Long prefix Duration literal with underlines Short prefix Long prefix
401
12.1.8 Table 8:
No. 1 2 3 4 5 6 Description
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#)
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
403
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
404
405
406
407
408
409
8a 8b 9a 9b 10 11 12 13 14 15 16 17 18
410
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
Yes x x
No
x x
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
413
CAL with input list CAL with load/store of inputs Use of input operators
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
No. 8 9 10
Yes x x x
No
415
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
Power rails
Yes x x No
Link Elements
Yes x x No
Contacts
Yes x x No
x x
No. 7 8
Yes
No x x
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
417
2.3.3.1 2.3.3.2
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
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
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
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
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.
Error conditions
system response Syntax error; overflow can be scanned during run time
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
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
419
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
13 Index
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
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
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
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
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
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
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