Example: StaticDeviceGenerator
Product: CODESYS Application Composer
This example shows how devices can be automatically generated with the CODESYS Application Composer using static device mapping. This function is employed when the used devices can be defined roughly at the time when the module is created.
Description
The example describes a building which contains rooms. These rooms have switches and lights, each of which is available in two variants. The lights (blinking or steady) can be linked to switches or -buttons. A switch or-button can be linked to several lights. For example, if a light is equipped with both a switch and buttons, then the switch behaves as a main switch which must be pressed before the lights can be operated with the push-buttons. If only switches are installed, then these switch the referencing light. A blinking light automatically switches between on and off when it is switched on.
Module declarations
Function block declarations
Device tree
Module tree
![]() |
For more information, see: Device Generator section.
When the device generator is activated, the application code can be generated, including all necessary devices. The desired devices are selected and specified in the std.Devices
section. You can also map the I/Os in their subsections.
By using static device mapping, the configuration of the fieldbus system is recorded uniquely in the modules and module tree. In addition, the I/Os of the modules can be mapped to the inputs and outputs of the respective device (hardware), and therefore linked automatically by the CODESYS Application Composer.
This results in the following function blocks and interfaces:
![]() |
System requirements and restrictions
Programming system | CODESYS Development System (version 3.5.17.0 or higher) |
Runtime system | CODESYS Control Win (version 3.5.17.0) |
Add-on components | CODESYS Application Composer |
Note
DOWNLOAD Projects