FB_DALIV2SwapShortAddressList

FB_DALIV2SwapShortAddressList 1:

The short addresses of several control gears can be swapped using the function block FB_DALIV2SwapShortAddressList. However, this requires a free, unused short address to be available in the DALI line.

In the parameter arrSwapShortAddressList, a list of the control gears whose short addresses are to be changed is transferred. The index of the structure thereby corresponds to the short address of the control gear. The element nNewShortAddress contains the new short address. bShortAddressValid must be set to TRUE, to ensure that the short address is changed in the corresponding control gear. Applying a positive edge to the bStart input starts the function block, and the output bBusy goes TRUE. Depending on the chosen options (parameter nOptions), all lamps will be set to the value MIN LEVEL. The elements of the output arrSwapedShortAddresses are reset. If the new short address is set for a control gear, the corresponding element in the output arrSwapedShortAddresses is set to TRUE. If the option DALIV2_OPTION_OPTICAL_FEEDBACK is active, the lamp will in addition be set to the value MAX LEVEL.

FB_DALIV2SwapShortAddressList 2: Inputs

VAR_INPUT
  bStart            : BOOL;
  bCancel           : BOOL;
  nFreeShortAddress : BYTE;
  nOptions          : DWORD := DALIV2_OPTION_OPTICAL_FEEDBACK;
END_VAR

Name

Type

Description

bStart

BOOL

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

bCancel

BOOL

A positive edge at this input deactivates the function block, thereby interrupting the addressing sequence.

nFreeShortAddress

BYTE

Free short address (0 ... 63)

nOptions

DWORD

Options for swapping short addresses (see table). The individual constants must be linked with OR operators.

Constant

Description

DALIV2_OPTION_OPTICAL_FEEDBACK

Before swapping the short addresses, all control gears are set to MIN LEVEL. After assigning the new short address, the brightness of the respective control gear will be changed to MAX LEVEL.

FB_DALIV2SwapShortAddressList 3: Inputs/outputs

VAR_IN_OUT
  arrSwapShortAddressList : ARRAY [0..63] OF ST_DALIV2SwapShortAddressList;
  stCommandBuffer         : ST_DALIV2CommandBuffer;
END_VAR

Name

Type

Description

arrSwapShortAddressList

ARRAY OF ST_DALIV2SwapShortAddressList

A reference to the list containing the short addresses to be swapped

stCommandBuffer

ST_DALIV2CommandBuffer

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

FB_DALIV2SwapShortAddressList 4: Outputs

VAR_OUTPUT
  bBusy    : BOOL;
  bError   : BOOL;
  nErrorId : UDINT;
  arrSwapedShortAddresses : ARRAY [0..63] OF BOOL;
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).

arrSwapedShortAddresses

ARRAY OF BOOL

If the new short address has been set for a control gear, the corresponding element will be set in the structure. The structure index reflects the short address of the control gear.

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4020.14

Tc2_DALI from v3.4.3.0