FB_DALI102SetSettings

FB_DALI102SetSettings 1:

This function block writes the values stored in the structure ST_DALIControlGearSettings to several variables (see table below) of selected DALI control gears in a DALI line.

The DALI control gears that are to be written to 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 are written one by one to the control gear. If a device is detected as being missing, the writing 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 device error occurs during writing, 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.

2

Error while writing the variable powerOnLevel.

3

Error while writing the variable systemFailureLevel.

4

Error while writing the variable minLevel.

5

Error while writing the variable maxLevel.

6

Error while writing the variable fadeRate.

7

Error while writing the variable fadeTime.

8

Error while writing the variables extendedFadeTimeBase and extendedFadeTimeMultiplier.

10

Error while writing the variable gearGroups.

11

Error while writing the variable scene0-scene15.

FB_DALI102SetSettings 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 that are to be initialized. Each bit of the variable represents a DALI control gear (0...63). All short addresses are written to with a setting of 16#FFFF_FFFF_FFFF_FFFF.

nOptions

DWORD

Options for writing 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 initialization of the variable.

eCommandPriority

E_DALICommandPriority

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

Options for writing to the variables:

Constant

Description

Tc3_DALI.GVL.cOptionPowerOnLevel

Initializes the current switch-on value.

Tc3_DALI.GVL.cOptionSystemFailureLevel

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

Tc3_DALI.GVL.cOptionMinLevel

Initializes the maximum output value.

Tc3_DALI.GVL.cOptionMaxLevel

Initializes the minimum output value.

Tc3_DALI.GVL.cOptionFadeRate

Initializes the FadeRate.

Tc3_DALI.GVL.cOptionFadeTime

Initializes the FadeTime

Tc3_DALI.GVL.cOptionExtendedFadeTime

Initializes the extended FadeTimeBase and the FadeTimeMultiplier.

Tc3_DALI.GVL.cOptionGroups

Initializes the group allocations.

Tc3_DALI.GVL.cOptionSceneLevels

Initializes the scene settings.

Tc3_DALI.GVL.cOptionAll

Initializes all variables.

FB_DALI102SetSettings 3:

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

FB_DALI102SetSettings 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_DALI102SetSettings 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 written to.

FB_DALI102SetSettings 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