FB_DALIV2xAddressingIntRandomAddressing

FB_DALIV2xAddressingIntRandomAddressing 1:

The function block FB_DALIV2xAddressingIntRandomAddressing addresses the control devices (sensors) at random. The user has no influence on which control device is assigned which short address. Short addresses are allocated in ascending order.

Applying a positive edge to the bStart input starts the function block, and the output bBusy goes TRUE. The terminal now addresses all control devices independently. If all control devices are addressed, the output bBusy goes back to FALSE. The output variable nAddressedDevices provides information on how many control devices were assigned a short address. Depending on the number of connected control devices, processing of this function block can take several minutes.

FB_DALIV2xAddressingIntRandomAddressing 2: Inputs

VAR_INPUT
  bStart                 : BOOL;
  nStartWithShortAddress : BYTE := 0;
  nOptions               : DWORD := DALIV2_OPTION_OPTICAL_FEEDBACK;
  eDataFrameType         : E_DALIV2DataFrameType := eDALIV2DataFrameType24Bit;
END_VAR

Name

Type

Description

bStart

BOOL

The function block is activated by a positive edge at this input.

nStartWithShortAddress

BYTE

Short address assigned to the first control device (0 ... 63).

nOptions

DWORD

Options for addressing control devices (see table). The individual constants must be linked with OR operators.

eDataFrameType

E_DALIV2DataFrameType

Output format of the DALI command (eDALIV2DataFrameType24Bit or eDALIV2DataFrameTypeOsram)

Constant

Description

DALIV2_OPTION_COMPLETE_NEW_INSTALLATION

All control devices receive a new address, even those that already have a short address.

DALIV2_OPTION_OPTICAL_FEEDBACK

Newly addressed control devices receive the DALI command IDENTIFY DEVICE once the short address has been assigned.

FB_DALIV2xAddressingIntRandomAddressing 3: Inputs/outputs

VAR_IN_OUT
  stCommandBuffer   : ST_DALIV2CommandBuffer;
END_VAR

Name

Type

Description

stCommandBuffer

ST_DALIV2CommandBuffer

Reference to the internal structure for communication with FB_KL6821Communication (KL6821).

FB_DALIV2xAddressingIntRandomAddressing 4: Outputs

VAR_OUTPUT
  bBusy                   : BOOL;
  bError                  : BOOL;
  nErrorId                : UDINT;
  nAddressedDevices       : BYTE;
END_VAR

Name

Type

Description

bBusy

BOOL

When the function block is activated the output is set, and it remains active until execution of the command has been completed.

bError

BOOL

This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in nErrorId. Is reset to FALSE by the execution of a command at the inputs.

nErrorId

UDINT

Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs (see error codes).

nAddressedDevices

BYTE

If addressing has been completed (bBusy is FALSE), then the number of addressed DALI control devices is shown at this output.

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4022.4

Tc2_DALI from v3.6.2.0