
- •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

8 - DDE Interface
8 DDE Interface
DDE Communication with CoDeSys
CoDeSys has a DDE (dynamic data exchange) interface for reading data. CoDeSys uses this interface to provide other applications that also use a DDE Interface with the contents of control variables and IEC addresses
If the GatewayDDEServer is used, which works with symbols, CoDeSys is not needed to read variables values from the PLC and to transfer them to applications with an DDE interface.
Attention: Direct addresses cannot be read over the DDE server ! For this case you have to define variables in CoDeSys which are assigned to the desired addresses (AT).
Attention: Direct addresses cannot be read via the DDE Server! For this case in CoDeSys variables with the appropriate address assignment (AT) have to be declared.
Attention: The DDE interface has been tested with Word 97 and Excel 97 on Windows NT 4.0. If the DDE communication fails caused by a mismatch of other versions or additionally installed programs on a computer, 3S – Smart Software Solutions cannot take any responsibility.
8.1DDE interface of the CoDeSys programming system...
Activating the DDE Interface
The DDE interface becomes active as soon as the PLC (or the simulation) is logged in.
General Approach to Data
A DDE inquiry can be divided into three parts:
1.Name of the program (here: CoDeSys),
2.File name and
3.Variable name to be read.
Name of the program: CoDeSys
File name: complete project path (c:\example\example.pro).
Variable name: The name of a variable as it appears in the Watch and Receipt Manager .
Which variables can be read?
All addresses and variables are readable. Variables or addresses should be entered in the format used in the Watch and Receipt Manager
Examples:
%IX1.4.1 |
(* Reads the input 1.4.1*) |
PLC_PRG.TEST (* Reads the variable TEST from the POU PLC_PRG*)
.GlobVar1 |
(* Reads the global variable GlobVar1 *) |
Linking variables using WORD
In order to get the current value of the variable TEST from the POU PLC_PRG through the DDE interface in Microsoft WORD, a field (e.g., the date) must be inserted in WORD ('Insert' "Field"). Now when you click on the field with the right mouse button and select the command "Toggle Field Codes" you can change the field function for the chosen text. In our example, this would look as follows:
{ DDEAUTO CODESYS "C:\CODESYS\PROJECT\IFMBSP.PRO" "PLC_PRG.TEST" }
Click on the field with the right mouse button again, then click on "Update Field" and the desired variable content appears in the text.
CoDeSys V2.3 |
8-1 |

DDE communcation with the GatewayDDE Server...
Linking variables using EXCEL
The following must be entered in Microsoft EXCEL before you can assign a variable to a cell.
=CODESYS|'C:\CODESYS\PROJECT\IFMBSP.PRO'!PLC_PRG.TEST'
When you click on 'Edit' then "Links", the result for this link will be:
Type: CODESYS
Source file: C:\CODESYS\PROJECT\IFMBSP.PRO
Element: PLC_PRG.TEST
Accessing variables with Intouch
Link with your project a DDE Access Name <AccessName> with the application name CODESYS and the DDE topic name C:\CODESYS\PROJECT\IFMBSP.PRO.
Now you can associate DDE type variables with the access name <AccessName>. Enter the name of the variable as the Item Name (e.g., PLC_PRG.TEST).
8.2DDE communcation with the GatewayDDE Server...
Handling of the GatewayDDE Server
The GatewayDDE Server can use the symbols which are created in CoDeSys for a project to communicate with other clients or the PLC. (see 'Project' 'Options' 'Symbolconfiguration'). It can serve the DDE interfaces of applications like e.g. Excel. This allows to transmit the variables values of the PLC to an applications, e.g. for the purpose of monitoring.
At start of the GatewayDDE Server a window opens, where the configuration of start and communication parameters can be done. A already existing configuration file can be called or the parameters can be set newly.
Starting dialog of the GatewayDDE Server
Using the command 'File' 'Open' you can call an already existing file which stores a set of configuration parameters. The standard dialog for selecting a file will open and available files with the extension ".cfg" will be offered. If a configuration file is selected, the configuration parameters and the defined target device are displayed
If the option 'File' 'Autoload' is activated, the GatewayDDE Server automatically opens with that configuration, which was active before the last terminating of the server.
If the server is started without any predefined configuration and without the setting Autoload, then in the configuration window 'Gateway:' und 'Device:' are displayed. Then you have to set up a new configuration.
The command 'File' 'Settings' opens the dialog 'Server settings', in which the following parameters can be set:
8-2 |
CoDeSys V2.3 |

8 - DDE Interface
Dialog for configuring the GatewayDDE Server
Motorola byteorder |
Motorola Byteorder used |
Check identity |
It will be checked, whether the project ID given by the symbol file is the same |
|
as that stored in the PLC. |
Updaterate [ms] |
Time interval for reading all symbol values from the PLC. |
Timeout [ms] |
Communication timeout for the used driver. |
Tries |
Number of retries of the communication driver to transfer a data block (not |
|
supported by all drivers !) |
To set up the connection to the Gateway, the dialog 'Communication Parameters' is opened by the command 'Online' 'Parameters'. It is the same dialog as you get in CoDeSys with the command 'Online' 'Communication parameters'. The settings you do here must be the same as in the corresponding CoDeSys Project.
The actual configuration of the GatewayDDE Server can be stored in a file by the command 'File' 'Save'. The standard dialog for saving a file will open, default for the extension of the file is *.cfg.
To get the gateway in active mode, log in by the command 'Online' 'Login'. (The gateway symbol in the status bar will get lightened then.) At login the desired connection will be built up and the available symbols can be accessed.. These must have been created before in the CoDeSys Project!
To log out use the command 'Online' Logout'.
General Approach to Data
A DDE inquiry can be divided into three parts:
1.Name of the program (here: CoDeSys),
2.File name and
3.Variable name to be read.
Name of the program: CoDeSys
File name: complete project path (c:\example\example.pro).
Variable name: The name of a variable as it appears in the Watch and Receipt Manager .
Which variables can be read?
All addresses and variables are readable. Variables or addresses should be entered in the format used in the Watch and Receipt Manager
Examples: |
|
%IX1.4.1 |
(* Reads the input 1.4.1*) |
PLC_PRG.TEST |
(* Reads the variable TEST from the POU PLC_PRG*) |
.GlobVar1 |
(* Reads the global variable GlobVar1 *) |
CoDeSys V2.3 |
8-3 |

DDE communcation with the GatewayDDE Server...
Linking variables using WORD
Start the GatewayDDEServer before activating the inquiry in WORD.
In order to get the current value of the variable TEST from the POU PLC_PRG through the DDE interface in Microsoft WORD, a field (e.g., the date) must be inserted in WORD ('Insert' "Field"). Now when you click on the field with the right mouse button and select the command "Toggle Field Codes" you can change the field function for the chosen text. In our example, this would look as follows:
{ DDEAUTO GATEWAYDDESERVER "BSP.PRO" "PLC_PRG.TEST" }
Click on the field with the right mouse button again, then click on "Update Field" and the desired variable content appears in the text.
Linking variables using EXCEL
Start the GatewayDDEServer before activating the inquiry in EXCEL.
The following must be entered in Microsoft EXCEL before you can assign a variable to a cell.
=GATEWAYDDESERVER|<Dateiname>!<Variablenname>
Beispiel:
=GATEWAYDDESERVER|'bsp.pro'!'PLC_PRG.TEST'
When you click on 'Edit' then "Links", the result for this link will be:
Type: CODESYS
Source file: C:\CODESYS\PROJECT\IFMBSP.PRO
Element: PLC_PRG.TEST
{ DDEAUTO GATEWAYDDESERVER "BSP.PRO" "PLC_PRG.TEST" }
Command line options for the GatewayDDEServer
If the GatewayDDE Server is started by a command line, the following options can be attached:
/n |
The info dialog does not appear |
|
|
|
automatically at starting |
|
|
/s |
Display of the dialog window |
/s=h |
No |
|
|
/s=i |
minimized (icon) |
|
|
/s=m |
maximized |
|
|
/s=n |
normal |
/c |
Configuration file to be load automatically l |
/c=<config- |
|
|
|
file> |
|
/o |
Go online with the selected configuration |
|
|
|
(autoload or defined by "/c=") |
|
|
Example: Command line:
GATEWAYDDE /s=i /c="D:\DDE\conf_1.cfg"
The GatewayDDE Server will be started, the dialog window will appear as an icon, the configuration which is stored in the file conf_1.cfg will be loaded.
8-4 |
CoDeSys V2.3 |