FB_DALI_Loytec_LDALI_BM2

FB_DALI_Loytec_LDALI_BM2 1:

The function block represents the LDALI-BM2 DALI push button interface from Loytec.

Up to four push buttons (instances 0, 3, 6 and 7) can be connected directly via the device.

The first two inputs are configurable and it is therefore also possible to use NTC/PTC temperature sensors (instances 1 and 4) or potentiometers/slide resistors (instances 2 and 5) instead of push buttons.

These functions can be configured via the properties eInput1Configuration and eInput2Configuration (see E_DALILoytecInputConfiguration).

The resistance value is read directly on setting one of the two inputs as Generic Input (resistance thermometer). This reading takes place when a positive edge is detected at the respective input bQueryInputValue1 or bQueryInputValue2.

The resistance value is read in % when setting one of the two inputs as Absolute Input (potentiometer). The corresponding channel is configured via the property eResistanceValueAbsoluteInput1 or eResistanceValueAbsoluteInput2 on the connected resistor (1 kΩ or 10 kΩ) (see Use of properties). The output value lies between 0 (0 %) and 31 (100 %).

The reading of the corresponding instance can be triggered immediately via the input variable bQueryInputValueN, even if the corresponding instance is not enabled.

In addition, the time-dependent querying of these values is possible. The properties nReportTimerAbsoluteInput1 and nReportTimerAbsoluteInput2 are used for this. The value is read again on expiry of the set time [s]. To prevent events following one another too quickly, a dead time [ms] can be set via the properties nDeadtimeTimerAbsoluteInput1 and nDeadtimeTimerAbsoluteInput2.

The push button inputs 3 and 4 can be disabled via the properties bEnableInput3 and bEnableInput4.

The existing parameters can be overwritten by changing the properties listed below. All parameters are written to the DALI control device by a positive edge at bInitialize and stored there.

The outputs with the output values of the DALI device only contain valid values if the function block was executed without errors (bError = FALSE). If the output bError = TRUE, the outputs with the output values must not be evaluated.

FB_DALI_Loytec_LDALI_BM2 2:

Set the times so that as few events as possible are sent. If too many events are sent, this can have a negative effect on the behavior of the application.

FB_DALI_Loytec_LDALI_BM2 3:

Set the event priorities on the properties eEventPriorityInput1 and eEventPriorityInput2 to the value MiddleLow if the inputs are not used as push buttons.

FB_DALI_Loytec_LDALI_BM2 4:

The function block cannot be used when using the KL6811.

FB_DALI_Loytec_LDALI_BM2 5: Inputs

VAR_INPUT
  bInitialize          : BOOL  := FALSE;
  nShortAddress        : BYTE  := 0;
  nOptions             : DWORD := 0;
  bQueryInputValue1    : BOOL := FALSE;
  bQueryInputValue2    : BOOL := FALSE;
  bQueryInputValue3    : BOOL := FALSE;
  bQueryInputValue4    : BOOL := FALSE;
END_VAR

Name

Type

Description

bInitialize

BOOL

The configuration of the DALI control device is started by a positive edge at this input. During this time no DALI commands are processed.

nShortAddress

BYTE

Short address (0…63) of the DALI control device.

nOptions

DWORD

Reserved for future extensions.

bQueryInputValueN

BOOL

The state of the corresponding push button is queried immediately by a positive edge at this input. Values of resistance sensors (setting of the input as Generic Input) can only be queried manually and not event-driven.

FB_DALI_Loytec_LDALI_BM2 6: Outputs

VAR_OUTPUT
  bError                 : BOOL;
  ipResultMessage        : I_TcMessage;
  bInitializing          : BOOL;
  bReadingInputValue1    : BOOL;
  bReadingInputValue2    : BOOL;
  bReadingInputValue3    : BOOL;
  bReadingInputValue4    : BOOL;
  nPushButton1Event      : WORD;
  nGenericInput1         : UINT;
  nAbsoluteInput1        : BYTE;
  nPushButton2Event      : WORD;
  nGenericInput2         : UINT;
  nAbsoluteInput2        : BYTE;
  nPushButton3Event      : WORD;
  nPushButton4Event      : WORD;
END_VAR

Name

Type

Description

bError

BOOL

This output is switched to TRUE if an error occurs during the execution. Further information about the error can be queried via the variable ipResultMessage. The output is set to FALSE again as soon as bBusy switches to TRUE.

ipResultMessage

I_TcMessage

Interface pointer (see error evaluation) that can be used to obtain detailed information about the processing of the function block (see runtime messages). The interface pointer is valid after bBusy has changed from TRUE to FALSE.

bInitializing

BOOL

The output is set as soon as the initialization of the DALI control device has been started, and remains active until all DALI commands have been executed.

bReadingInputValueN

BOOL

The outputs are set as soon as the manual reading of the corresponding input has been triggered.

nPushButtonNEvent

BOOL

The outputs output the events for the corresponding push button via one bit for one cycle.

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.

Name

Type

Description

nGenericInputN

UINT

Outputs containing the measured values of the connected resistance sensors (NTC/PTC).

nAbsoluteInputN

BYTE

Outputs containing the measured values of the connected potentiometers or slide resistors. The individual ranges are scaled from 0 to 100%, with the following output values: 0 = 0% and 31 = 100%.

FB_DALI_Loytec_LDALI_BM2 7: Properties

All parameters that are written to the DALI control device via bInitialize are available as properties.

The properties of instances of the same type are listed only once in the table and marked with N at the end.

Name

Type

Access

Initial value

Description

eInputNConfiguration

E_DALILoytecInputConfiguration

Get, Set

PushButton

Configuration of input 1 or 2 as a push button or analog input for the connection of potentiometers or resistance sensors, e.g. NTC/PTC.

eResistanceValueAbsoluteInputN

E_DALILoytecResistanceConfiguration

Get, Set

Resistance10kOhm

Configuration of the resistance value of the potentiometer or slide resistor at input 1 or 2.

bEnablePushButtonN

BOOL

Get, Set

TRUE

Push button input 3 or 4, which can be enabled or disabled on the DALI control device. FALSE on this property causes sending of events from this instance to be disabled. However, the actual value of the instance can still be queried via the input bQueryPushButtonN.

nEventFilterPushButtonN

BYTE

Get, Set

2#1000_0011

Setting of the event filter.

eEventPriorityInputN

E_DALIEventPriority

Get, Set

Middle

Setting of the event priority.

nDeadtimeTimerAbsoluteInputN

UINT

Get, Set

100 ms

Dead time (0...12750 ms) to ensure that not too many events are sent in succession. An event is only sent after expiry of the dead time timer. The dead time timer is restarted each time after an event has been sent.

nReportTimerAbsoluteInputN

BYTE

Get, Set

0 s

Time [0…255 s] after which the pending event of the absolute encoder is repeated if no other event has occurred in the meantime.

nDoubleTimerPushButtonN

UINT

Get, Set

0 ms

Time (0, tDoubleMin…2000 ms) to distinguish between a single and a double button press.

nRepeatTimerPushButtonN

UINT

Get, Set

160 ms

Interval (100…2000 ms) of repetitive events in the case of a long button press.

nShortTimerPushButtonN

UINT

Get, Set

500 ms

Time (tShortMin...5100 ms) to distinguish between a long and a short button press. tShortMin is a manufacturer-specific value.

nStuckTimerPushButtonN

BYTE

Get, Set

20 s

Time (5…255 s) after whose expiry the push button no longer represents a long button press. The push button is stuck.

ipDALICommunication

I_DALICommunication

Get, Set

0

Interface pointer to the communication block (see Transfer of the reference to the communication block).

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.11

Tc3_DALI from v3.5.0.0