FB_DALI_ToPushButtonState

Determines the static state from the events of a button.
For correct evaluation, the events Button Released (Bit 0) and Button Pressed (Bit 1) must be activated via the event filter.
![]() | Release only those events that you need for the application. If too many events are sent, this can have a negative effect on the behavior of the application. |
Inputs
VAR_INPUT
nPushButtonEvent : UINT;
END_VAR
Name | Type | Description |
---|---|---|
nPushButtonEvent | UINT | This variable contains the individual events of the push button, which are represented by the respective bits. |
Bit | Description |
---|---|
0 | Push button released. |
1 | Push button pressed. |
2 | Short keystroke. |
3 | Double keystroke. |
4 | Start long keystroke. |
5 | Repeat long keystroke. |
6 | Stop long keystroke. |
7 | Push button free again; was previously blocked. |
8 | Push button blocked. |
The function block FB_DALI_ToPushButtonState can be used to convert the state of a push button into a BOOL variable.
Outputs
VAR_OUTPUT
bPushButton : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
nPushButton | BOOL | This variable reflects the static state of the push button. The state was determined on the basis of the individual events. |
Example
The example shows how the events of a 4-fold DALI push button are converted into four individual variables.
PROGRAM Demo_ST
VAR
fbSwitchPanel : FB_DALI_Lunatone_Cross_Switch(Communication.fbKL6821Communication);
bInitialize : BOOL;
bError : BOOL;
bInitializing : BOOL;
aToPushButtonState : ARRAY [1..4] OF FB_DALI_ToPushButtonState();
aPushButton : ARRAY [1..4] OF BOOL;
END_VAR
Program part in structured text:
fbSwitchPanel( bInitialize := bInitialize,
nShortAddress := 0,
bInitializing => bInitializing,
bError => bError);
aToPushButtonState[1](nPushButtonEvent := fbSwitchPanel.nPushButton1Event,
bPushButton => aPushButton[1]);
aToPushButtonState[2](nPushButtonEvent := fbSwitchPanel.nPushButton2Event,
bPushButton => aPushButton[2]);
aToPushButtonState[3](nPushButtonEvent := fbSwitchPanel.nPushButton3Event,
bPushButton => aPushButton[3]);
aToPushButtonState[4](nPushButtonEvent := fbSwitchPanel.nPushButton4Event,
bPushButton => aPushButton[4]);
Program part in the Continuous Function Chart (CFC):

Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.25 | Tc3_DALI from v3.10.5.0 |