Transcription of User Manual for PLC Programming
1 User Manual for PLC Programming with CoDeSys 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 Document Version , CoDeSys Of Content CoDeSys i Content 1 A Brief introduction to CoDeSys 1-1 What is Overview of CoDeSys.
2 1-1 Overview on the user documentation for CoDeSys ..1-3 2 What is What in CoDeSys 2-1 Project ..2-1 ..2-9 Instruction List (IL)..2-9 Structured Text (ST)..2-11 Sequential Function Chart (SFC)..2-16 Function Block Diagram (FBD)..2-21 The Continuous Function Chart Editor (CFC)..2-21 Ladder Diagram (LD)..2-22 Debugging, Online The ..2-26 3 We Write a Little Program 3-1 Controlling a Traffic Signal ..3-1 Visualizing a Traffic Signal ..3-11 4 The Individual Components 4-1 The Main ..4-1 Project ..4-3 Managing ..4-22 Managing Objects in a ..4-53 General Editing General Online ..4-67 Window set ..4-83 Help when you need ..4-83 5 Editors in CoDeSys 5-1 This is for all Declaration Editor ..5-3 Working in the Declaration Editor ..5-3 Declaration Editors in Online Mode ..5-10 Pragma instructions in the Declaration The Text Working in text editors.
3 5-21 The Instruction List Editor ..5-25 The Editor for Structured The Graphic Editors ..5-26 Working in graphic editors ..5-26 The Function Block Diagram Editor ..5-30 The Ladder Editor ..5-35 The Sequential Function Chart Table Of Content ii CoDeSys The Continuous Function Chart Editor (CFC) ..5-49 6 The Ressources 6-1 Overview of the Ressources ..6-1 Global Variables, Variable Configuration, Document Frame ..6-2 Global Variable Document Frame ..6-7 Alarm Configuration ..6-8 Overview ..6-8 General information on alarms, Alarm Alarm Alarm saving ..6-15 'Extras' Menu: Library Manager ..6-16 Log ..6-18 PLC Overview ..6-20 Working in the PLC General Settings in the PLC Configuration ..6-23 Custom specific parameter Configuration of an I/O Module ..6-25 Configuration of a Channel.
4 6-28 Configuration of Profibus Modules ..6-29 Configuration of CANopen Configuration of a CanDevice (CANopen Slave) ..6-41 Configuration of DeviceNet PLC Configuration in Online Hardware scan/State/Diagnosis information from the PLC ..6-50 Task Configuration ..6-51 Overview ..6-51 Working in the Task Configuration ..6-52 System Events ..6-55 Task Configuration in Online Watch- and Recipe Manager ..6-57 Overview ..6-57 Creating Watch Lists, Recipes ..6-59 Watch- and Recipe Manager in the Online Mode ..6-63 The Sampling Overview and Generating a Trace Sampling ..6-66 Looking at the Sampling Trace ..6-67 'Extras' 'Save trace values'..6-69 'Extras' 'External Trace Configurations'..6-69 Workspace .. 6-70 Parameter Manager ..6-70 Overview, The Parameter Manager Editor, Parameter List Types and Attributes.
5 6-73 Managing parameter Editing parameter Parameter Manager in Online Mode ..6-78 Export / Import of parameter lists ..6-79 Table Of Content CoDeSys iii Target The PLC-Browser ..6-80 General remarks concerning PLC-Browser operation ..6-80 Command entry in the PLC-Browser ..6-81 Use of macros during the command entry in Further PLC-Browser options ..6-83 Tools ..6-84 Properties of available Tool Shortcuts (Object Properties) ..6-84 Managing Tool Shortcuts ..6-87 Frequently asked questions on Tools ..6-88 7 ENI 7-1 What is ENI ..7-1 Preconditions for Working with an ENI project data Working with the ENI project data base in CoDeSys ..7-2 Object categories concerning the project data 8 DDE Interface 8-1 DDE interface of the CoDeSys Programming DDE communcation with the GatewayDDE.
6 8-2 9 The License Management in CoDeSys 9-1 The License Manager ..9-1 Creating a licensed library in CoDeSys ..9-1 10 APPENDIX 10-1 Appendix A: IEC Operators and additional norm extending functions 10-1 Arithmetic .. 10-1 Bitstring .. 10-4 Bit-Shift .. 10-6 Selection Operators .. 10-8 Comparison Address Calling ..10-14 Type ..10-14 Numeric Initialization Operator ..10-24 Appendix B: Operands in CoDeSys 10-25 Variables ..10-27 Addresses ..10-29 Functions ..10-30 Appendix C: Data types in CoDeSys 10-31 Standard data Defined data types ..10-33 Appendix D: The CoDeSys Libaries 10-39 The String ..10-39 Table Of Content iv CoDeSys Bistable Function ..10-42 ..10-45 ..10-47 The library ..10-50 BCD Conversion ..10-50 Bit-/Byte Functions ..10-50 Mathematic Auxiliary Functions.
7 10-51 Signal ..10-57 Function Analog Value ..10-60 The library ..10-61 CoDeSys System Libraries ..10-62 Appendix E: Operators and Library Modules Overview 10-63 Operators in CoDeSys ..10-63 Elements of the : ..10-66 Elements of the ..10-66 Appendix F: Command Line-/Command File 10-69 Command Line Commands ..10-69 Command File (cmdfile) Appendix G: Siemens Import 10-79 Import from a SEQ Symbol File ..10-79 Import from a S5 Project File ..10-80 Converting S5 to IEC 61131-3 ..10-80 Appendix H: Target Settings in Detail 10-85 Settings in Category Target Platform ..10-85 Target system Intel 386 compatible, Category Target Platform ..10-85 Target system Motorola 68K, Category Target Target system Infineon C16x, Category Target Platform ..10-87 Target systems Intel StrongARM und Power PC, Category Target Target system MIPS, Category Target Platform.
8 10-89 Target system 'Hitachi SH', Category Target Target system '8051 compatible', Category Target Platform ..10-91 Target System 'TriCore , Categorie Target platform ..10-91 Target Settings for Category Memory Layout ..10-92 Target Settings in Category Target Settings in Category Networkfunctionality ..10-96 Target Settings in Category Visualization ..10-97 Appendix I: Use of Keyboard 10-99 Use of Keyboard ..10-99 Key Combinations ..10-99 Appendix J: Recommendations on the naming of identifiers 10-103 Naming of identifiers ..10-103 Identifiers for variables (variable names) ..10-103 Identifiers for user-defined data types (DUT) ..10-105 Table Of Content CoDeSys v Identifiers for functions, function blocks, programs (POU)..10-105 Identifiers for Visualizations ..10-106 Appendix K: Compiler Errors and Warnings 10-107 Errors.
9 10-113 11 Index CLI Table Of Content vi CoDeSys 1 - A Brief introduction to CoDeSys CoDeSys 1-1 1 A Brief introduction to CoDeSys 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++). Overview of CoDeSys 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).
10 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.