Transfer Between PLC and KNX
This example shows how to transfer a button from a PLC (also control panels, AwapSwitch, EnOcean, MQTT, etc.) to the KNX bus.
First, a new peripheral with the type
Control Panel (found under Sensors) is inserted into the
Structure and then clicked on
Apply in the Explorer.
After opening the element, click on
Edit to begin with the following steps.
Switching On and Off With the Button
A control is created with an on button and an off button. To toggle a value, see the example "Switching a Light".
Tip: The program can be downloaded and imported here:
example_transfer_onoff.antobj
- Delete the Function Block VISU.
- Add a new Function Block with the name N.
- Give the database the name Tr_on.
- At the input, enter the variable named in.Tr_on.
- At the output, enter the variable with the name out.on.
- Now duplicate the network just created by right-clicking in the white area next to the Function Block and selecting
Duplicate.
- Now rename all variables of the new network from on to off.
- Now you can link the inputs Tr_on and Tr_off under
Communication on the right side with the PLC. The data type can be left as bool. If you have a control panel, you can connect the input to a VISUVAR.
- Now enter the group address of the KNX bus under the KNX interface twice. Once under on and once under off.
- To send an on and off command now, you need to adjust the data types. For on, select trig_p and for off, select trig_n.
- Now a pulse is sent for on or off when the button is released.
Dimming With the Button
This example explains how to switch a KNX light on and off with two buttons and simultaneously dim it relatively. The procedure is almost identical to that of a KNX blind.
Tip: The program can be downloaded and imported here:
example_transfer_dim.antobj
- Perform the steps mentioned above.
- Add a new
Network below the existing networks. You may need to move the network down with the
arrow symbols. This is important because the order will play a role later.
- Now add a new Function Block with the name TON.
- Define the database with the name dim_up.
- At the input IN, write the name of the existing variable in.TR_on.
- Set the delay time at the input PT to T#300ms.
- At the output Q, define the variable with the name out.dim_up.
- Now duplicate the network just created by right-clicking in the white area next to the Function Block and selecting
Duplicate.
- Now rename all variables of the new network from on to off and from up to down.
- Now you can link the outputs dim_up and dim_down under
Communication on the right side under KNX with the corresponding group address for relative dimming.
- Select the correct data type for dimming. This is bool_dimup for dim_up and bool_dimdw for dim_down.
- To prevent dimming and switching at the same time, the output of the switching must be blocked. Therefore, add a new Function Block AND to the output of the existing Function Block N.
- At the second input of the Function Block AND, enter the name dim_up.Q.
- Negate the second input. You can double-click the input, after which the negation is indicated by a circle.
- Repeat adding and negating with the network below. Pay attention to the name for the second input. This should be dim_down.Q in the second network.