FB_BA_Switch4DALI
The template is used to read a 4-fold switch.
Data exchange HMI
The data exchange with the HMI is realized here in the base class FB_BA_BaseSwitch (internal function block). The use of the following variable is visible in this template:
- bInitializeRm: Start DALI initialization routine from the HMI.
Function
The device itself is specified by the instance numbers of the push buttons, nInstButton1 ... nInstButton4.
The device's internal notification system is always used, which automatically sends a telegram as soon as a button press or release is detected.
The states of the buttons are also queried cyclically in the internal function block FB_BA_Swi4DALI. This ensures that the state of the buttons is always corrected if a telegram is "lost".
The DALI push button function block can be initialized with its set parameters via the input bInitialize or via the HMI (bInitializeRm), see FB_BA_Swi4DALI.
The initialization of the template takes place within the method FB_Init. |
Block diagram
Syntax
FUNCTION_BLOCK FB_BA_Switch4DALI EXTENDS FB_BA_Ext_SwitchBase
VAR_INPUT
bEn : BOOL;
bInitialize : BOOL;
END_VAR
VAR_OUTPUT
bButton1 : BOOL;
bButton2 : BOOL;
bButton3 : BOOL;
bButton4 : BOOL;
bInitializing : BOOL;
bErr : BOOL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
nAdr : BYTE;
nInstButton1 : BYTE := 0;
nInstButton2 : BYTE := 1;
nInstButton3 : BYTE := 2;
nInstButton4 : BYTE := 3;
ipDALICommunication : Tc3_DALI.I_DALICommunication;
END_VAR
VAR_INPUT CONSTANT
SwitchSns : FB_BA_Swi4DALI;
END_VAR
VAR_INPUT
Name | Type | Description |
---|---|---|
bEn | BOOL | Enabling the function block: a TRUE signal at this input enables the function. |
bInitialize | BOOL | A positive edge at this input starts the DALI initialization routine, which transfers the set parameters to the DALI device, see FB_BA_Swi4DALI. |
VAR_OUTPUT
Name | Type | Description |
---|---|---|
bButton1...bButton4 | BOOL | State of the individual push buttons (TRUE = pressed). |
bInitializing | BOOL | The push button sensor is in the DALI initialization phase, i.e. the entered parameters are transferred to the DALI device. |
bErr | BOOL | Error output. A plain text is output in TwinCAT in the error list in the output window. |
VAR_INPUT CONSTANT PERSISTENT
Name | Type | Description |
---|---|---|
nAdr | BYTE | DALI individual address of the push button sensor. |
nInstButton1...nInstButton4 | BYTE | Numbers of the push button instances to be queried. |
ipDALICommunication | Interface pointer to the DALI communication block. |
VAR_INPUT CONSTANT
Name | Type | Description |
---|---|---|
SwitchSns | Function block for reading the push button sensor. |
Requirements
Development environment | Necessary function |
---|---|
TwinCAT from v3.1.4024.35 | TF8040 | TwinCAT Building Automation from V5.0.0.0 |