Step 7: Compose Modules
After successful scanning the declarations, all modules are available for further use, so that an example application can be composed. Therefore the modules are added to the module tree of the project. For this the view Modules must be opened.
In the first step the toplevel module Room
has to be added to the tree.

The Module dialog opens and offers all available toplevel modules. In this dialog, the corresponding icons are displayed which were defined in the image pool, as well as the texts from the text lists. Now the module "Room" can be selected and added to the module tree.

Now the editor of the toplevel module can be opened by double-clicking Room
in the module tree. A target application for code generation must be selected on the Toplevel
tab. The tasks which have been declared in the module declaration are displayed in the field Standard Tasks.

Analogous to the steps above the submodule Light
can be added to the module tree. Due to the multi slot definition in the declaration of the room, up to three lights can be added. The values for maxLightValue
and Speed
can be parameterized on the Parameters
tab of the editor of the Light
module. In the I/O editor the output Brightness
is mapped to a local variable uiBrightness
for our example.

Below the newly added Light
, a module Switch
must be added. In the instance editor of the Switch
module, all parameters and I/Os, which are defined in the module declaration, are available. For our example the local variable xPushSwitch
is mapped to the input variable xIn. The output of the simple light is mapped to the local variable xSimpleOn
.

In a last step of our example a LightSimple
with a SwitchSimple
are added to the module tree. The output of the simple light is mapped to the local variable xSimpleOn
. The input of the simple switch xPushSimpleSwitch
is mapped to the variable xPushSimpleSwitch.

At the end, the project has to be generate by use of the command Generate. After the download to a device the example can be tested by changing the value of xPushSwitch
. For dimming the value of uiBrightness should increase slowly and by tapping, its value is directly set to 0 or to the maximum. Changing xPushSimpleSwitch
directly switches the output of the corresponding light.
Finally it has to be mentioned, that the last steps, of composing the modules can be done in any combination, without loosing the functionality of the generated code.