ebook img

User Manual for PLC Programming PDF

469 Pages·2010·2.32 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview User Manual for PLC Programming

User Manual for PLC Programming with CoDeSys 2.3 Copyright  1994, 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by 3S-Smart Software Solutions GmbH All rights reserved. We have gone to great lengths to ensure this documentation is correct and complete. However, since it is not possible to produce an absolutely error-free text, please feel free to send us your hints and suggestions for improving it. Trademark Intel is a registered trademark and 80286, 80386, 80486, Pentium are trademarks of Intel Corporation. Microsoft, MS and MS-DOS are registered trademarks, Windows and Intellisense are trademarks of Microsoft Corporation. Publisher 3S - Smart Software Solutions GmbH Memminger Straße 151 D-87439 Kempten Tel. +49 831 5 40 31 - 0 Fax +49 831 5 40 31 – 50 Last update 28.10.2010 Document Version 6.0, CoDeSys V.2.3.9.24 Table Of Content Content 1 A Brief Introduction to CoDeSys 1-1 1.1 What is CoDeSys...............................................................................................1-1 1.2 Overview of CoDeSys Functions.......................................................................1-1 1.3 Overview on the user documentation for CoDeSys...........................................1-3 2 What is What in CoDeSys 2-1 2.1 Project Components..........................................................................................2-1 2.2 Languages.........................................................................................................2-9 2.2.1 Instruction List (IL).............................................................................................2-9 2.2.2 Structured Text (ST)..........................................................................................2-11 2.2.3 Sequential Function Chart (SFC).......................................................................2-16 2.2.4 Function Block Diagram (FBD)..........................................................................2-21 2.2.5 The Continuous Function Chart Editor (CFC)....................................................2-21 2.2.6 Ladder Diagram (LD).........................................................................................2-22 2.3 Debugging, Online Functions.............................................................................2-23 2.4 The Standard.....................................................................................................2-26 3 We Write a Little Program 3-1 3.1 Controlling a Traffic Signal Unit.........................................................................3-1 3.2 Visualizing a Traffic Signal Unit.........................................................................3-11 4 The Individual Components 4-1 4.1 The Main Window..............................................................................................4-1 4.2 Project Options..................................................................................................4-3 4.3 Managing Projects.............................................................................................4-22 4.4 Managing Objects in a Project...........................................................................4-53 4.5 General Editing Functions..................................................................................4-61 4.6 General Online Functions..................................................................................4-67 4.7 Window set up...................................................................................................4-83 4.8 Help when you need it.......................................................................................4-83 5 Editors in CoDeSys 5-1 5.1 This is for all Editors...........................................................................................5-1 5.2 Declaration Editor..............................................................................................5-3 5.2.1 Working in the Declaration Editor......................................................................5-3 5.2.2 Declaration Editors in Online Mode...................................................................5-10 5.2.3 Pragma instructions in the Declaration Editor....................................................5-11 5.3 The Text Editors.................................................................................................5-21 5.3.1 Working in text editors.......................................................................................5-21 5.3.2 The Instruction List Editor..................................................................................5-25 5.3.3 The Editor for Structured Text............................................................................5-26 5.4 The Graphic Editors...........................................................................................5-26 5.4.1 Working in graphic editors.................................................................................5-26 5.4.2 The Function Block Diagram Editor...................................................................5-30 5.4.3 The Ladder Editor..............................................................................................5-35 5.4.4 The Sequential Function Chart Editor................................................................5-41 CoDeSys V2.3 i Table Of Content 5.4.5 The Continuous Function Chart Editor (CFC)....................................................5-49 6 The Ressources 6-1 6.1 Overview of the Ressources..............................................................................6-1 6.2 Global Variables, Variable Configuration, Document Frame.............................6-2 6.2.1 Global Variables.................................................................................................6-2 6.2.2 Variable Configuration........................................................................................6-6 6.2.3 Document Frame...............................................................................................6-7 6.3 Alarm Configuration...........................................................................................6-8 6.3.1 Overview............................................................................................................6-8 6.3.2 General information on alarms, Terms...............................................................6-9 6.3.3 Alarm classes.....................................................................................................6-10 6.3.4 Alarm groups......................................................................................................6-13 6.3.5 Alarm saving......................................................................................................6-15 6.3.6 'Extras' Menu: Settings.......................................................................................6-16 6.4 Library Manager.................................................................................................6-16 6.5 Log.....................................................................................................................6-18 6.6 PLC Configuration..............................................................................................6-20 6.6.1 Overview............................................................................................................6-20 6.6.2 Working in the PLC Configuration......................................................................6-21 6.6.3 General Settings in the PLC Configuration........................................................6-23 6.6.4 Custom specific parameter dialog......................................................................6-24 6.6.5 Configuration of an I/O Module..........................................................................6-25 6.6.6 Configuration of a Channel................................................................................6-28 6.6.7 Configuration of Profibus Modules.....................................................................6-29 6.6.8 Configuration of CANopen modules...................................................................6-36 6.6.9 Configuration of a CanDevice (CANopen Slave)...............................................6-41 6.6.10 Configuration of DeviceNet Modules..................................................................6-45 6.6.11 PLC Configuration in Online Mode.....................................................................6-49 6.6.12 Hardware scan/State/Diagnosis information from the PLC................................6-50 6.7 Task Configuration.............................................................................................6-51 6.7.1 Overview............................................................................................................6-51 6.7.2 Working in the Task Configuration.....................................................................6-52 6.7.3 System Events...................................................................................................6-55 6.7.4 Task Configuration in Online Mode....................................................................6-55 6.8 Watch- and Recipe Manager.............................................................................6-57 6.8.1 Overview............................................................................................................6-57 6.8.2 Creating Watch Lists, Recipes...........................................................................6-59 6.8.3 Watch- and Recipe Manager in the Online Mode..............................................6-63 6.9 The Sampling Trace...........................................................................................6-64 6.9.1 Overview and Configuration...............................................................................6-64 6.9.2 Generating a Trace Sampling............................................................................6-66 6.9.3 Looking at the Sampling Trace..........................................................................6-67 6.9.4 'Extras' 'Save trace values'.................................................................................6-69 6.9.5 'Extras' 'External Trace Configurations'..............................................................6-69 6.10 Workspace.........................................................................................................6-70 6.11 Parameter Manager...........................................................................................6-70 6.11.1 Overview, Activating...........................................................................................6-71 6.11.2 The Parameter Manager Editor, Overview.........................................................6-72 6.11.3 Parameter List Types and Attributes..................................................................6-73 6.11.4 Managing parameter lists...................................................................................6-75 6.11.5 Editing parameter lists........................................................................................6-76 6.11.6 Parameter Manager in Online Mode..................................................................6-78 6.11.7 Export / Import of parameter lists.......................................................................6-79 ii CoDeSys V2.3 Table Of Content 6.12 Target Settings...................................................................................................6-79 6.13 The PLC-Browser..............................................................................................6-80 6.13.1 General remarks concerning PLC-Browser operation.......................................6-80 6.13.2 Command entry in the PLC-Browser.................................................................6-81 6.13.3 Use of macros during the command entry in PLC-Browser...............................6-83 6.13.4 Further PLC-Browser options............................................................................6-83 6.14 Tools..................................................................................................................6-84 6.14.1 Properties of available Tool Shortcuts (Object Properties)................................6-84 6.14.2 Managing Tool Shortcuts...................................................................................6-87 6.14.3 Frequently asked questions on Tools................................................................6-88 7 ENI 7-1 7.1.1 What is ENI........................................................................................................7-1 7.1.2 Preconditions for Working with an ENI project data base..................................7-1 7.1.3 Working with the ENI project data base in CoDeSys.........................................7-2 7.1.4 Object categories concerning the project data base..........................................7-2 8 DDE Interface 8-1 8.1 DDE interface of the CoDeSys programming system........................................8-1 8.2 DDE communcation with the GatewayDDE Server...........................................8-2 9 The License Management in CoDeSys 9-1 9.1 The License Manager........................................................................................9-1 9.1.1 Creating a licensed library in CoDeSys.............................................................9-1 10 APPENDIX 10-1 Appendix A: IEC Operators and additional norm extending functions 10-1 10.1 Arithmetic Operators..........................................................................................10-1 10.2 Bitstring Operators.............................................................................................10-4 10.3 Bit-Shift Operators.............................................................................................10-6 10.4 Selection Operators...........................................................................................10-8 10.5 Comparison Operators.......................................................................................10-11 10.6 Address Operators.............................................................................................10-13 10.7 Calling Operators...............................................................................................10-14 10.8 Type Conversions..............................................................................................10-14 10.9 Numeric Operators.............................................................................................10-20 10.10 Initialization Operator.........................................................................................10-24 Appendix B: Operands in CoDeSys 10-25 10.11 Constants...........................................................................................................10-25 10.12 Variables............................................................................................................10-27 10.13 Addresses..........................................................................................................10-29 10.14 Functions...........................................................................................................10-30 Appendix C: Data types in CoDeSys 10-31 10.15 Standard data types...........................................................................................10-31 10.16 Defined data types.............................................................................................10-33 Appendix D: The CoDeSys Libaries 10-39 10.17 The Standard.lib library......................................................................................10-39 10.17.1 String functions..................................................................................................10-39 CoDeSys V2.3 iii Table Of Content 10.17.2 Bistable Function Blocks....................................................................................10-42 10.17.3 Trigger................................................................................................................10-44 10.17.4 Counter..............................................................................................................10-45 10.17.5 Timer..................................................................................................................10-47 10.18 The Util.lib library...............................................................................................10-50 10.18.1 BCD Conversion................................................................................................10-50 10.18.2 Bit-/Byte Functions.............................................................................................10-50 10.18.3 Mathematic Auxiliary Functions.........................................................................10-51 10.18.4 Controllers..........................................................................................................10-54 10.18.5 Signal Generators..............................................................................................10-57 10.18.6 Function Manipulators........................................................................................10-59 10.18.7 Analog Value Processing...................................................................................10-60 10.19 The AnalyzationNew.lib library...........................................................................10-61 10.20 CoDeSys System Libraries................................................................................10-62 Appendix E: Operators and Library Modules Overview 10-63 10.21 Operators in CoDeSys.......................................................................................10-63 10.22 Elements of the Standard.lib:.............................................................................10-66 10.23 Elements of the Util.lib.......................................................................................10-66 Appendix F: Command Line-/Command File 10-69 10.24 Command Line Commands...............................................................................10-69 10.25 Command File (cmdfile) Commands..................................................................10-70 Appendix G: Siemens Import 10-79 10.26 Import from a SEQ Symbol File.........................................................................10-79 10.27 Import from a S5 Project File.............................................................................10-80 10.28 Converting S5 to IEC 61131-3...........................................................................10-80 Appendix H: Target Settings in Detail 10-85 10.29 Settings in Category Target Platform.................................................................10-85 10.29.1 Target system Intel 386 compatible, Category Target Platform.........................10-85 10.29.2 Target system Motorola 68K, Category Target Platform....................................10-86 10.29.3 Target system Infineon C16x, Category Target Platform...................................10-87 10.29.4 Target systems Intel StrongARM und Power PC, Category Target Platform.....10-88 10.29.5 Target system MIPS, Category Target Platform................................................10-89 10.29.6 Target system 'Hitachi SH', Category Target Platform.......................................10-90 10.29.7 Target system '8051 compatible', Category Target Platform.............................10-91 10.29.8 Target System 'TriCore’, Categorie Target platform..........................................10-91 10.30 Target Settings for Category Memory Layout....................................................10-92 10.31 Target Settings in Category General..................................................................10-94 10.32 Target Settings in Category Networkfunctionality..............................................10-96 10.33 Target Settings in Category Visualization..........................................................10-97 Appendix I: Use of Keyboard 10-99 10.34 Use of Keyboard................................................................................................10-99 10.35 Key Combinations..............................................................................................10-99 Appendix J: Recommendations on the naming of identifiers 10-103 10.36 Naming of identifiers..........................................................................................10-103 10.37 Identifiers for variables (variable names)...........................................................10-103 10.38 Identifiers for user-defined data types (DUT).....................................................10-105 iv CoDeSys V2.3 Table Of Content 10.39 Identifiers for functions, function blocks, programs (POU).................................10-105 10.40 Identifiers for Visualizations...............................................................................10-106 Appendix K: Compiler Errors and Warnings 10-107 10.41 Warnings............................................................................................................10-107 10.42 Errors.................................................................................................................10-113 11 Index CLI CoDeSys V2.3 v Table Of Content vi CoDeSys V2.3 1 - A Brief Introduction to CoDeSys 1 A Brief Introduction to CoDeSys 1.1 What is CoDeSys CoDeSys is a complete development environment for your PLC. (CoDeSys stands for Controlled Development System). CoDeSys puts a simple approach to the powerful IEC language at the disposal of the PLC programmer. Use of the editors and debugging functions is based upon the proven development program environments of advanced programming languages (such as Visual C++). 1.2 Overview of CoDeSys Functions... How is a project structured? A project is put into a file named after the project. The first POU (Program Organization Unit) created in a new project will automatically be named PLC_PRG. The process begins here (in compliance with the main function in a C program), and other POUs can be accessed from the same point (programs, function blocks and functions). Once you have defined a Task Configuration, it is no longer necessary to create a program named PLC_PRG. You will find more about this in the Task Configuration chapter. There are different kinds of objects in a project: POUs, data types, display elements (visualizations) and resources. The Object Organizer contains a list of all the objects in your project. How do I set up my project? First you should configure your PLC in order to check the accuracy of the addresses used in the project. Then you can create the POUs needed to solve your problem. Now you can program the POUs you need in the desired languages. Once the programming is complete, you can compile the project and remove errors should there be any. How can I test my project? Once all errors have been removed, activate the simulation, log in to the simulated PLC and "load" your project in the PLC. Now you are in Online mode. Now open the window with your PLC Configuration and test your project for correct sequence. To do this, enter input variables manually and observe whether outputs are as expected. You can also observe the value sequence of the local variables in the POUs. In the Watch- and Recipe Manager you can configure data records whose values you wish to examine. Debugging In case of a programming error you can set breakpoints. If the process stops at such a breakpoint, you can examine the values of all project variables at this point in time. By working through sequentially (single step) you can check the logical correctness of your program. Additional Online Functions Further debugging functions: You can set program variables and inputs and outputs at certain values. CoDeSys V2.3 1-1 Overview of CoDeSys Functions... You can use the flow control to check which program lines have been run. A Log records operations, user actions and internal processes during an online session in a chronological order. If activated in the target settings the Sampling Trace allows you to trace and display the actual course of variables over an extended period of time. Also a target specific function is the PLC Browser which can serve to request certain information from the PLC. Once the project has been set up and tested, it can be loaded down to the hardware and tested as well. The same online functions as you used with the simulation will be available. Additional CoDeSys Features The entire project can be documented or exported to a text file at any time. For communication purposes CoDeSys has a symbolic interface and a DDE interface. A Gateway Server plus OPC Server and DDE Server are components of the CoDeSys-standard installation packet. Using the appropriate target settings, which can be loaded with the aid of a target file (Target Support Package) allows to load the same CoDeSys project to various target systems. Network global variables and a Parameter Manager might be available, if activated by the current target settings, for data exchange within a network of controllers. ENI: The 'Engineering Interface' can be used to access any desired source code management program via the ENI Server, which is running as an independent process. CoDeSys POUs and compile files can be filed in that data base and are by that accessible also by other clients of the ENI Server. This allows multi user operation during the work on a CoDeSys project, it provides a common data pool for different tools besides CoDeSys and it makes possible a version management. Tools: This functionality also is target dependent and allows to start target-specific executable files in a CoDeSys project. Besides that files can be defined, which should be loaded to the controller. Connections to external tools can be pre-defined in the target file or/and inserted in the project Resource tree. A CoDeSys visualization can be processed target specifically to be available as Web-Visualization and/or Target-Visualization. This allows to run and view the visualization via Internet or on a PLC- monitor. 1-2 CoDeSys V2.3

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.