
- •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.7Task Configuration...
6.7.1Working in the Task Configuration
In addition to declaring the special PLC_PRG program, you can also control the processing of your project using the task management.
A Task is a time unit in the processing of an IEC program. It is defined by a name, a priority and by a type determining which condition will trigger the start of the task. This condition can be defined by a time (cyclic, freewheeling) or by an internal or external event which will trigger the task; e.g. the rising edge of a global project variable or an interrupt event of the controller.
For each task you can specify a series of programs that will be started by the task. If the task is executed in the present cycle, then these programs will be processed for the length of one cycle.
The combination of priority and condition will determine in which chronological order the tasks will be executed.
Each task can be enabled or disabled explicitly.
For each task you can configure a watch dog (time control) can be configured. In the Online Mode the task processing can be monitored in a diagram.
Additionally there is the possibility to link System events (e.g. Start, Stop, Reset) directly with the execution of a project POU.
The Task Configuration is found as an object in the Resources tab the Object Organizer. The Task editor is opened in a bipartite window.
Example for a Task Configuration
In the left part of the window the tasks are represented in a configuration tree. At the topmost position you will always find the entry 'Task configuration'. Below there are the entry 'System events' and the entries for the particular tasks, represented by the task name. Below each task entry the assigned program calls are inserted. Each line is preceded by an icon.
In the right part of the window a dialog will be displayed which belongs to the currently marked entry in the configuration tree. Here you can configure the tasks (Task properties), program calls (Program call) resp. define the linking of system events (System events). It depends on the target which options are available in the configuration dialogs. They are defined by a description file which is referenced in the target file. If the standard descriptions are extended by customer specific definitions, then those will be displayed in an additional tab 'Parameter' in the right part of the window.
Note: Please do not use the same string function (see standard.lib) in several tasks, because this may cause program faults by overwriting.
The most important commands you find in the context menu (right mouse button).
CoDeSys V2.3 |
6-45 |

Task Configuration...
•At the heading of the Task Configuration are the words "Task Configuration." If a plus sign is located before the words, then the sequence list is closed. By double-clicking on the list or pressing <Enter>, you can open the list. A minus sign now appears. By double-clicking once more, you can close the list again. For every task, there is a list of program call-ups attached. Likewise, you can open and close this list the same way.
•With the 'Insert' 'Insert Task' command, you can insert a task.
•With the 'Insert' 'Append Task' command, you can insert a task at the end of the configuration tree.
•With the 'Insert' 'Insert Program Call', a program call will be assigned to the task which is actually selected in the configuration tree.
•Further on for each entry in the configuration tree an appropriate configuration dialog will appear in the right part of the window. There options can be activated/deactivated resp. inputs to editor fields can be made. Depending on which entry is selected in the configuration tree, there will be the dialog for defining the 'Taskattributes' (see 'Insert Task'), the dialog for defining a 'Program Call' (see 'Insert Program Call') or the table of 'System events. The settings made in the dialogs will be taken over to the configuration tree as soon as the focus is set to the tree again.
•A task name or program name can also get edited in the configuration tree. For this perform a mouse click on the name or select the entry and press the <Space> button to open an edit frame.
•You can use the arrow keys to select the previous or next entry in the configuration tree.
•By clicking on the task or program name, or by pressing the <Space bar>, you can set an edit control box around the name. Then you can change the designation directly in the task editor.
'Insert' 'Insert Task' or 'Insert' 'Append Task'
With this command you can insert a new task into the Task Configuration. The entries each consist of a symbol and the task name.
If a task or the entry 'System events' is selected, then the 'Insert Task' command will be at your disposal. The new task will be inserted after the selected one. If the entry 'Task Configuration' is selected, then the 'Append Task' is available, and the new task will be appended to the end of the existing list. The maximum number of tasks is defined by the target system. Please regard that a certain number of tasks already might be reserved for modules of the PLC Configuration (defined in the cfg-file).
When inserting a task, the dialog for setting the Task attributes will be opened.
Dialog for Setting the Task attributes
6-46 |
CoDeSys V2.3 |
6 - The Resources
Insert the desired attributes:
Name: a name for the task; with this name the task is represented in the configuration tree; the name can be edited there after a mouseclick on the entry or after pressing the <Space> key when the entry is selected.
Priority (0-31): (a number between 0 and 31; 0 is the highest priority, 31 is the lowest), Type:
cyclic ( ) : The task will be processed cyclic according to the time definition given in the field 'Interval' (see below).
freewheeling ( ) : The task will be processed as soon as the program is started and at the end of one run will be automatically restarted in a continuous loop. There is no cycle time defined.
triggered by event (): The task will be started as soon as the variable, which is defined in the Event field gets a rising edge.
triggered by external event (): The task will be started as soon as the system event, which is defined in the Event field, occurs. It depends on the target, which events will be supported and offered in the selection list. (Not to be mixed up with system events
Properties:
Interval (for Type 'cyclic' or 'freewheeling'): the period of time, after which the task should be restarted. If you enter a number, then you can choose the desired unit in the selection box behind the edit field: milliseconds [ms] or microseconds [µs]. Inputs in [ms]-format will be shown in the TIME format (e.g. "t#200ms") as soon as the window gets repainted; but you also can directly enter the value in TIME format. Inputs in [ms] will always be displayed as a pure number (e.g. "300").
Single (for Type 'triggered by event' or 'triggered by external event'): a global variable which will trigger the start of the task as soon as a rising edge is detected. Use button ... or the input assistant <F2> to get a list of all available global variables.
If there is no entry in both of these fields, then the task interval will depend on which runtime system is used (see runtime documentation); e.g. in this case for CoDeSys SP NT V2.2 and higher an interval of 10 ms will be used).
Watchdog
Activate watchdog: When this option is activated () then the task will be terminated in error status as soon as the processing takes longer than defined in the 'Time' field (see below).
Time (e.g.: t#200ms): Watchdog time; after the expiration of this term the watchdog will be activated unless the task has not been terminated already.
Sensitivity: Number of overruns of the watchdog time, which are accepted without generating an error.
'Insert' 'Insert Program Call' or 'Insert' 'Append Program Call'
With these commands you will open the dialog box for entering a program call to a task in the Task
Configuration. Each entry in the task configuration tree consists of a symbol () and the program name.
With 'Insert Program Call', the new program call is inserted before the selected program call, and with 'Append Program Call' the program call is appended to the end of the existing list or program calls.
CoDeSys V2.3 |
6-47 |

Task Configuration...
Dialog box for Program Call Entry
In the field 'program call' specify a valid program name out of your project or open the Input Assistant with the Select button to select a valid program name. The program name later also can be modified in the configuration tree. For this select the entry and press the <Space> key or just perform a mouse click to open an editor field. If the selected program requires input variables, then enter these in their usual form and of the declared type (for example, prg(invar:=17)).
The processing of the program calls later in online mode will be done according to their order (top down) in the task editor..
Please regard: Do not use the same string function in several tasks (see Standard Library Elements), because in this case values might be over stroke during processing of the tasks.
6.7.2System Events
Instead of a "task" also a "system event" can be used to call a POU of your project. The available system events are target specific (definition in target file). The list of the standard events of the target may be extended by customer specific events. Possible events are for instance: Stop, Start, Online Change.
The assignment of system events to POUs is also done in the Task configuration editor. Use the dialog 'Events', which will be opened as soon as the entry " System-events" is selected in the task configuration tree:
Table for Assigning POUs to System Events
Each event is represented in a line: Name and Description are displayed as defined in the target file, in the column called POU you can enter the name of the project POU which should be called and processed as soon as the event occurs.
6-48 |
CoDeSys V2.3 |