FB_DALI102GetSettings

FB_DALI102GetSettings 1:

This function block reads several variables (see table below) from selected DALI control gears and saves them in the structure ST_DALIControlGearSettings.

The DALI control gears that are to be read can be specified by the input variable nDevices. Each bit of this variable corresponds to a short address.

Applying a positive edge to the bStart input starts the function block, and the bBusy output goes TRUE. A check is first made as to whether a DALI control gear is present at all. If this is the case, then the bPresent bit is set in the respective structure (see ST_DALIControlGearSettings), after which the settings of the control gear are read one by one and written in the associated variables in the structure. If it is found that a device is not available, the reading is skipped and work continues with the next device. The structure index here reflects the address of the device. In other words, data for the device with short address 0 is located at arrDALIDeviceSettings[0], and so on through to the device with short address 63 having its data at arrDALIDeviceSettings[63]. If a read error occurs when reading from a device, the corresponding bit in nErrors is set for the respective structure without the function block itself switching to error mode. The following table shows which bit is set in the nErrors variable when an error occurs during the reading of a variable from a control gear.

Bit

Error

0

An error occurred while attempting to seek the DALI control gear.

1

Error while reading the variable actualLevel.

2

Error while reading the variable powerOnLevel.

3

Error while reading the variable systemFailureLevel.

4

Error while reading the variable minLevel.

5

Error while reading the variable maxLevel.

6

Error while reading the variable fadeRate.

7

Error while reading the variable fadeTime.

8

Error while reading the variables extendedFadeTimeBase and extendedFadeTimeMultiplier.

9

Error while reading the variable randomAddress.

10

Error while reading the variable gearGroups.

11

Error while reading the variable scene0-scene15.

12

Error while reading the variable statusInformation.

13

Error while reading the version number from the MemoryBank.

14

Error while reading the supported device types.

15

Error while reading the variable physicalMinLevel.

FB_DALI102GetSettings 2: Inputs

VAR_INPUT
  bStart            : BOOL;
  nDevices          : LWORD;
  nOptions          : DWORD;
  bCancel           : BOOL;
  eCommandPriority  : E_DALICommandPriority := E_DALICommandPriority.MiddleLow;
END_VAR

Name

Type

Description

bStart

BOOL

Execution of the DALI commands is triggered via a positive edge at this input.

nDevices

LWORD

Variable for selecting the DALI control gears to be read. Each bit of the variable represents a DALI control gear (0...63). All short addresses are queried with a setting of 16#FFFF_FFFF_FFFF_FFFF.

nOptions

DWORD

Options for reading the variables (see table below). The individual constants must be linked with OR operators.

bCancel

BOOL

A positive edge at this input will disable the function block and hence abort the reading of the variables.

eCommandPriority

E_DALICommandPriority

Priority (low, middle low, middle, middle high, high) with which the DALI commands are sent.

Options for reading the variables:

Constant

Description

Tc3_DALI.GVL.cOptionActualDimLevel

Reads the current output value.

Tc3_DALI.GVL.cOptionPowerOnLevel

Reads the current switch-on value.

Tc3_DALI.GVL.cOptionSystemFailureLevel

Reads the current setting value in case of a DALI bus error.

Tc3_DALI.GVL.cOptionMinLevel

Reads the minimum output value.

Tc3_DALI.GVL.cOptionMaxLevel

Reads the maximum output value.

Tc3_DALI.GVL.cOptionFadeRateFadeTime

Reads the FadeRate and the FadeTime.

Tc3_DALI.GVL.cOptionExtendedFadeTime

Reads the extended FadeTimeBase and the FadeTimeMultiplier.

Tc3_DALI.GVL.cOptionRandomAddress

Reads the random address.

Tc3_DALI.GVL.cOptionGroups

Reads the group allocations.

Tc3_DALI.GVL.cOptionSceneLevels

Reads the scene settings.

Tc3_DALI.GVL.cOptionStatusInformation

Reads the status information.

Tc3_DALI.GVL.cOptionVersionNumber

Reads the version number of the DALI control gear.

Tc3_DALI.GVL.cOptionDeviceType

Reads the device type.

Tc3_DALI.GVL.cOptionPhysicalMinLevel

Reads the PhysicalMinLevel.

Tc3_DALI.GVL.cOptionAll

Reads all variables.

FB_DALI102GetSettings 3:

eCommandPriority has no function with the KL6811. The DALI command priorities are supported by the KL6821 from the firmware version BD.

FB_DALI102GetSettings 4: Inputs/outputs

VAR_IN_OUT
  arrDALIDeviceSettings  : ARRAY [0..63] of ST_DALIControlGearSettings;
END_VAR

Name

Type

Description

arrDALIDeviceSettings

ARRAY OF ST_DALIControlGearSettings

Array containing the read parameters of the individual DALI control gears.

FB_DALI102GetSettings 5: Outputs

VAR_OUTPUT
  bError                  : BOOL;
  ipResultMessage         : I_TcMessage;
  bBusy                   : BOOL;
  nCurrentShortAddress    : BYTE;
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.

bBusy

BOOL

The output is set as soon as execution of the DALI commands has commenced. It remains active until all DALI commands have been processed.

nCurrentShortAddress

BYTE

Indicates which short address is currently being queried.

FB_DALI102GetSettings 6: Properties

Name

Type

Access

Initial value

Description

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

Tc3_DALI from v3.2.0.0