FB_DALIV2ChangeAddressList

FB_DALIV2ChangeAddressList 1:

The function block FB_DALIV2ChangeAddressList can be used to change the short addresses of several control gears. In contrast to the FB_DALIV2SwapShortAddressList function block, it is not necessary for a free, unused short address to be available in the DALI line.

A list of the control gears whose short addresses are to be changed is transferred in the arrChangeAddressList array of type ST_DALIV2ChangeAddressList. The list has 64 entries from 0 to 63. Each entry contains a variable nOldAddress and nNewAddress with which the address assignment is parameterized. The end of the list is programmed with a 255 entry at nOldAddress, so that the whole list does not necessarily have to be filled in. If this entry is missing, however, then all entries are accepted. When the function block is started (positive edge on bStart), the list end is first determined on the basis of the above-described entry and afterwards the valid list range is examined for the following false entries:

The function block then determines the internal long addresses of the DALI devices on the basis of the short addresses and enters them respectively in the parameters nRandomAddressHigh, nRandomAddressMiddle and nRandomAddressLow of the list. If an error occurs during these queries, this leads to a false entry for the respective device in the list element nErrors (see ST_DALIV2ChangeAddressList). The further sequence in the function block now depends on the option DALIV2_OPTION_SAFE_ADDRESSING (input nOptions). If it is set, secure re-addressing takes place: first, all short addresses of the selected DALI devices are deleted. Afterwards, status queries are sent to all desired new addresses in the DALI line. 2 cases are now possible:

The reprogramming is checked afterwards in both cases. If errors occur during deletion, status query or reprogramming, this leads to an error entry for the respective device in the list element nErrors (see ST_DALIV2ChangeAddressList).
If the DALIV2_OPTION_SAFE_ADDRESSING option (input nOptions) is not set, the short addresses are not deleted and the status query for the existence of desired new addresses is omitted and the new addresses are programmed directly. This is possible because programming takes place via the long address determined beforehand. Reprogramming is not verified in this case.

The individual bits in the list element nErrors have the following meaning:

Bit

Error

0

Error whilst reading the high byte of the long address (nRandomAddressHigh).

1

Error whilst reading the middle byte of the long address (nRandomAddressMiddle).

2

Error whilst reading the low byte of the long address (nRandomAddressLow).

3

Error whilst deleting a short address.

4

Error whilst verifying a short address.

5

Error whilst programming a short address.

FB_DALIV2ChangeAddressList 2: Inputs

VAR_INPUT
  bStart                 : BOOL;
  bCancel                : BOOL;
  eCommandPriority : E_DALIV2CommandPriority := eDALIV2CommandPriorityHigh;
  nOptions               : DWORD := DALIV2_OPTION_OPTICAL_FEEDBACK;
END_VAR

Name

Type

Description

bStart

BOOL

A positive edge at this input activates the function block, thereby starting the addressing sequence.

bCancel

BOOL

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

eCommandPriority

E_DALIV2CommandPriority

Priority (high, medium or low) with which the command is processed by the library.

nOptions

DWORD

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

Constant

Description

DALIV2_OPTION_SAFE_ADDRESSING

Safe addressing: Old short addresses are deleted, the new ones are checked to see if they already exist and reprogramming is verified.

FB_DALIV2ChangeAddressList 3: Inputs/outputs

VAR_IN_OUT
  arrChangeAddressList : ARRAY [0.. 63] OF ST_DALIV2ChangeAddressList;
  stCommandBuffer      : ST_DALIV2CommandBuffer;
END_VAR

Name

Type

Description

arrChangeAddressList

ST_DALIV2ChangeAddressList

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

stCommandBuffer

ST_DALIV2CommandBuffer

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

FB_DALIV2ChangeAddressList 4: Outputs

VAR_OUTPUT
  bBusy    : BOOL;
  bError   : BOOL;
  nErrorId : UDINT;
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).

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4020.14

Tc2_DALI from v3.4.3.0