FB_BA_Swi4DALI

FB_BA_Swi4DALI 1:

This function block is used to read a DALI 4-fold push button.

For information on the function of the DALI device used, please refer to the manufacturer's device documentation.

Function

The device itself is specified by the instance numbers of the 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. 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 fixed parameters via the input bInitialize, see VAR CONSTANT.

Syntax

FUNCTION_BLOCK FB_BA_Swi4DALI
VAR_INPUT
  bEn                    : BOOL;
  bInitialize            : BOOL;
  nAdr                   : BYTE;
  nInstButton1           : BYTE;
  nInstButton2           : BYTE;
  nInstButton3           : BYTE;
  nInstButton4           : BYTE;
  ipDALICommunication    : Tc3_DALI.I_DALICommunication;
END_VAR
VAR_OUTPUT
  bButton1               : BOOL;
  bButton2               : BOOL;
  bButton3               : BOOL;
  bButton4               : BOOL;
  bInitializing          : BOOL;
  bErr                   : BOOL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
  nPrdQuery              : UDINT := 60;
END_VAR
VAR CONSTANT
  nEventFilter           : DWORD := 131;
  eEventPriority         : Tc3_DALI.E_DALIEventPriority := Tc3_DALI.E_DALIEventPriority.Middle;
  eEventScheme           : Tc3_DALI.E_DALIEventScheme := Tc3_DALI.E_DALIEventScheme.DeviceInstance;
  nRepeatTimer           : UINT := 160;
  nShortTimer            : UINT := 500;
  nDoubleTimer           : UINT := 0;
  nStuckTimer            : BYTE := 20;
END_VAR

FB_BA_Swi4DALI 2: 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.

nAdr

BYTE

DALI short address of the push button sensor.

nInstButton1... nInstButton4

BYTE

Numbers of the push button instances to be queried.

ipDALICommunication

Tc3_DALI.I_DALICommunication

Interface pointer to the DALI communication block.

FB_BA_Swi4DALI 3: VAR_OUTPUT

Name

Type

Description

bButton1...bButton4

BOOL

State of the individual push buttons (TRUE = pressed).

bInitializing

BOOL

The 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.

FB_BA_Swi4DALI 4: VAR_INPUT CONSTANT PERSISTENT

Name

Type

Description

nPrdQuery

UDINT

Query interval of the switch states. This query is only used for correction if an incorrect state is detected due to a telegram error.

VAR CONSTANT

FB_BA_Swi4DALI 5:

The following parameters cannot be changed and are transferred to the DALI device by the initialization routine.

Name

Type

Description

nEventFilter

DWORD

DALI event filter mask for occupancy sensors. This value is set to 7 and thus queries the Occupied, Vacant and Repeat Event states.

eEventPriority

Tc3_DALI.E_DALIEventPriority

DALI event priority with which input notification events are sent by the instance of the DALI control device, set to Middle.

eEventScheme

Tc3_DALI.E_DALIEventScheme

DALI event scheme. This is set to DeviceInstance (device/instance addressing with short address and instance number).

nRepeatTimer

UINT

Repeat Timer as a multiple of 20 ms. Set to 8 (=160 ms).

nShortTimer

UINT

Short Timer as a multiple of 20 ms. Set to 25 (=500 ms).

nDoubleTimer

UINT

Double Timer as a multiple of 20 ms. Set to 0 (=0 ms). This means that this value is set to the vendor-specific minimum value.

nStuckTimer

BYTE

Stuck Timer in seconds. Set to 20 s.

Requirements

Development environment

Necessary function

TwinCAT from v3.1.4024.35

TF8040 | TwinCAT Building Automation from V5.0.0.0