
- •1 A Brief Introduction to CoDeSys
- •1.1 What is CoDeSys
- •1.2 Overview of CoDeSys Functions...
- •1.3 Overview on the user documentation for CoDeSys
- •2 What is What in CoDeSys
- •2.1 Project Components...
- •2.2 Languages...
- •2.2.1 Instruction List (IL)...
- •2.2.2 Structured Text (ST)...
- •2.2.3 Sequential Function Chart (SFC)...
- •2.2.4 Function Block Diagram (FBD)...
- •2.2.5 The Continuous Function Chart Editor (CFC)...
- •2.2.6 Ladder Diagram (LD)...
- •2.3 Debugging, Online Functions...
- •2.4 The Standard...
- •3 We Write a Little Program
- •3.1 Controlling a Traffic Signal Unit...
- •3.2 Visualizing a Traffic Signal Unit...
- •4 The Individual Components
- •4.1 The Main Window...
- •4.3 Managing Projects...
- •4.4 Managing Objects in a Project...
- •4.5 General Editing Functions...
- •4.8 Help when you need it...
- •5 Editors in CoDeSys
- •5.1 This is for all Editors...
- •5.2 Declaration Editor...
- •5.2.1 Working in the Declaration Editor
- •5.2.3 Pragma instructions in the Declaration Editor
- •5.3 The Text Editors...
- •5.3.1 Working in text editors
- •5.3.2 The Instruction List Editor...
- •5.3.3 The Editor for Structured Text...
- •5.4 The Graphic Editors...
- •5.4.1 Working in graphic editors
- •5.4.2 The Function Block Diagram Editor...
- •5.4.3 The Ladder Editor...
- •5.4.4 The Sequential Function Chart Editor...
- •5.4.5 The Continuous Function Chart Editor (CFC)...
- •6 The Resources
- •6.1 Overview of the Resources
- •6.2 Global Variables, Variable Configuration, Document Frame
- •6.2.1 Global Variables...
- •6.2.2 Variable Configuration...
- •6.2.3 Document Frame...
- •6.3 Alarm Configuration
- •6.3.1 Overview
- •6.3.2 General information on alarms, Terms
- •6.3.3 Alarm classes
- •6.3.4 Alarm groups
- •6.3.5 Alarm saving
- •6.3.6 'Extras' Menu: Settings
- •6.4 Library Manager...
- •6.6 PLC Configuration...
- •6.6.1 Overview
- •6.6.2 Working in the PLC Configuration...
- •6.6.3 General Settings in the PLC Configuration
- •6.6.4 Custom specific parameter dialog
- •6.6.5 Configuration of an I/O Module...
- •6.6.6 Configuration of a Channel
- •6.6.7 Configuration of Profibus Modules...
- •6.6.8 Configuration of CAN modules...
- •6.6.9 Configuration of a CanDevice (CANopen Slave)
- •6.6.10 PLC Configuration in Online Mode
- •6.6.11 Hardware scan/State/Diagnosis information from the PLC
- •6.7 Task Configuration...
- •6.7.1 Working in the Task Configuration
- •6.7.2 System Events
- •6.7.3 Taskconfiguration in Online Mode
- •6.8 Watch and Receipt Manager...
- •6.8.1 Overview
- •6.8.2 Watch and Receipt Manager in the Offline Mode
- •6.8.3 Watch and Receipt Manager in the Online Mode
- •6.9 The Sampling Trace
- •6.9.1 Overview and Configuration
- •6.9.2 Display of the Sampling Trace
- •6.9.3 'Extras' 'Save Trace'
- •6.9.4 'Extras' 'External Trace Configurations'
- •6.10 Workspace
- •6.11 Parameter Manager ..
- •6.11.1 Overview, Activating
- •6.11.2 The Parameter Manager Editor, Overview
- •6.11.3 Parameter List Types and Attributes
- •6.11.4 Managing parameter lists
- •6.11.5 Editing parameter lists
- •6.11.6 Parameter Manager in Online Mode
- •6.11.7 Export / Import of parameter lists
- •6.12 Target Settings
- •6.13 The PLC-Browser
- •6.14 Tools
- •6.14.1 Properties of available Tool Shortcuts (Object Properties)
- •6.14.2 Managing Tool Shortcuts
- •6.14.3 Frequently asked questions on Tools
- •7.1 What is ENI
- •7.2 Preconditions for Working with an ENI project data base
- •7.3 Working with the ENI project data base in CoDeSys
- •7.4 Object categories concerning the project data base
- •8 DDE Interface
- •8.1 DDE interface of the CoDeSys programming system...
- •8.2 DDE communcation with the GatewayDDE Server...
- •9 The License Management in CoDeSys
- •9.1 The License Manager
- •9.1.1 Creating a licensed library in CoDeSys
- •10 APPENDIX
- •Appendix A: IEC Operators and additional norm extending functions
- •Arithmetic Operators...
- •Bitstring Operators...
- •Selection Operators
- •Comparison Operators...
- •Address Operators...
- •Calling Operators...
- •Type Conversions...
- •Numeric Operators...
- •Appendix B: Operands in CoDeSys
- •Constants
- •Variables
- •Addresses
- •Functions
- •Appendix C: Data types in CoDeSys
- •Standard data types
- •Defined data types
- •Appendix D: The CoDeSys Libaries
- •The Standard.lib library
- •String functions...
- •Bistable Function Blocks...
- •Trigger...
- •Counter...
- •Timer...
- •The Util.lib library
- •BCD Conversion
- •Bit-/Byte Functions
- •Mathematic Auxiliary Functions
- •Controllers
- •Signal Generators...
- •Function Manipulators...
- •Analog Value Processing...
- •The AnalyzationNew.lib library
- •The CoDeSys System Libraries
- •Appendix E: Operators and Library Modules Overview
- •Appendix F: Command Line-/Command File
- •Command Line Commands
- •Command File (cmdfile) Commands
- •Appendix G: Siemens Import
- •Import from a SEQ Symbol File
- •Import from a S5 Project File
- •Converting S5 to IEC 61131-3
- •Appendix H: Target Settings in Detail
- •Settings in Category Target Platform
- •Appendix I: Use of Keyboard
- •Appendix J: Compiler Errors and Warnings
- •Warnings
- •Errors

6 - The Resources
6.6.9Configuration of a CanDevice (CANopen Slave)
A PLC which is programmable with CoDeSys can be used as a CANopen Slave (CANopen-Node, called "CanDevice" in the following) in a CAN network.
For this purpose the PLC can be configured in the CoDeSys PLC Configurator and the configuration can be saved in an EDS-file. This EDS-file (device file) later can be used in any CANopen Master configuration.
Preconditions for creating a CanDevice in the CoDeSys PLC Configurator: 1. The libraries
3S_CanDrv.lib
3S_CanOpenManager.lib
3S_CanOpenDevice.lib
must be included in the CoDeSys project. They are needed for running the PLC as an CANopen device.
2. In the configuration file (*.cfg) on which the configuration is basing, an appropriate entry for a CanDevice must be inserted. Only then in the PLC Configuration Editor a subelement 'CanDevice' can be appended and parameterized in the three configuration dialogs which will be described in the following:
Base settings CAN settings
Default PDO mapping
Base settings of a CanDevice
Dialog Base settings
Bus identifier: currently not used.
Name of updatetask: Name of the task, in which the CanDevice is called. A selection list will provide all tasks which are available in the project.
EDS file generation: Activate this option if you want to generate a device file (EDS file) from the current configuration settings in order to be able to use the CanDevice later in any master configuration. Enter a path and name for the file in the field Name of EDS file. Optionally a manually created template file can be defined (Template for EDS file), which will be supplemented with the settings done in the configuration dialogs. For example you could create a text file containing certain EDS file entries, save it as "EDS_template.txt" and enter the path of this template in the current dialog.
CoDeSys V2.3 |
6-41 |

PLC Configuration...
If you then generate an EDS file "device_xy.eds" from the current project, the entries resulting from the project will be merged with those of the template and will be saved in "device_xy.eds". (Do not use the extension ".eds" for the template file !) If entries are created by the current project which are already defined by the template, the template definitions will not be overwritten.
For entering the file paths you can use the standard dialog for browsing for a file which can be opened by using the button Browse....
CAN settings of a CanDevice
Dialog CAN settings
Here you can set the Node id and the Baud rate. The node id is a node number which is used by the master for addressing the device in a CANopen network.
A configuration of Nodeguarding, Heartbeat and Emergency Telegram functionality is possible.
Please see the corresponding descriptions for the configuration of CAN modules and masters. Heartbeat is currently not supported.
6-42 |
CoDeSys V2.3 |

6 - The Resources
Default PDO mapping of a CanDevice
Dialog Default PDO mapping
In this dialog the entries of the local Parameter Manager can be assigned to PDOs, which will be sent/received by the CanDevice. The PDOs then will be available for the PDO mapping in any master configuration where the CanDevice is integrated.
In the Parameter Manager lists the parameter entries are linked to project variables via index/subindex.
Please regard: Subindex 0 of an index, which implies more than one subindex, will be used implicitly for storing the number of subindices. For this reason do not use subindex 0 in the Parameter Manager. Also regard that the parameters of a particular index must be entered in ascending order (subindices 1,2,3...) in the Parameter Manager.
List of mapable objects: Choose from the selection list the variables' parameter list, for whose entries the CanDevice should generate PDOs. If supported by the target system, parameter lists of type 'Mapping' can be created in the Parameter Manager, which contain process variables especially intended for the PDO mapping of a CANDevice. In this case only these parameter lists will be offered here in the mapping dialog. Otherwise all available parameter lists of type 'Variables' and 'Instance' will be offered.
According to the chosen parameter list the Objects will appear in the left window. In the right window you create the desired PDO configuration (PDO's). Via the buttons Insert receive PDO resp. Insert send PDO there you can insert 'Receive PDOs' and 'Send PDOs' below the corresponding list organizing elements. In order to assign an object of the left window to one of these send or receive PDOs, mark the object in the left window and also the PDO in the right window and then press >>. Thereupon the object will be inserted below the PDO in the right window. The Properties of the PDO can be defined in a dialog which is also used for the PDO configuration of other CAN modules.
By using button Delete the PDO currently marked in the right window will be removed from the configuration.
CoDeSys V2.3 |
6-43 |

PLC Configuration...
Example:
objective: On the first Receive PDO (COB-Id = 512 + NodeId) of the CanDevice the variable PLC_PRG.a should be received.
Thus in the Parameter Manager in a variable list a index/subIndex must be assigned to variable PLC_PRG.a. The Parameter Manager can only be opened, if it is activated in the target settings in category 'Network functionality' and if valid index and subindex ranges are defined there.
Now in the dialog 'Default PDO-Mapping' of the CanDevice the index/subindex entry of the respective parameter list can be assigned to a Receive PDO,
6.6.10PLC Configuration in Online Mode
In online mode the PLC configuration displays the states of the inputs and outputs of the PLC. If a boolean input or output has the value TRUE, the little box at the beginning of the entry line in the configuration tree will get blue, non-boolean values will be added at the end of the entry line (e.g. "=12").
The boolean inputs can be toggled by mouse-clicks. At other inputs a mouse-click on the beginning of the line opens a dialog, where the value can be modified. The modified value will be set in the PLC as soon as the dialog is closed with OK.
Also regard the target specific possibilities for online diagnosis.
6.6.11Hardware scan/State/Diagnosis information from the PLC
If supported by the target system and the actual configuration file (*.cfg), information on the structure, the status and diagnosis results of the currently connected hardware can be get from the PLC and displayed in the PLC Configuration in CoDeSys:
Scan module configuration
If supported by the target system and the actual configuration file (*.cfg), the command Scan module configuration will be available in the context menu for the module which is currently selected in the PLC Configuration tree.
This command is only available in offline mode. If it is activated, the actual hardware configuration of the particular module on the PLC will be scanned and automatically be offered for inserting in the configuration tree of the CoDeSys PLC Configuration. Thus the existing module configuration can easily be mapped in CoDeSys.
Load module state
If supported by the target system and the actual configuration file (*.cfg), the command Load module state will be available in the context menu for the module which is currently selected in the PLC Configuration tree.
This command is only available in online mode. If it is activated, the actual status of the module will be read from the PLC and get displayed by a special color in the configuration tree:
Black: Module existing and parameterized correctly. Blue: Module existing but parameterized incorrectly. Red: Module not found.
An update of the status display also automatically will be done at each download.
Show diagnosis messages
If supported by the target system and the actual configuration file (*.cfg), the command Show diagnosis messages will be available in the context menu for the module which is currently selected in the PLC Configuration tree. This command is only available in online mode. If it is activated, actual diagnosis messages for the module coming from the PLC will be displayed in a CoDeSys window.
6-44 |
CoDeSys V2.3 |