FB_DALIV2ChangeAddressList

FB_DALIV2ChangeAddressList 1:

The short addresses of several ballasts can be changed using this function block. As opposed to the FB_DALIV2SwapShortAddressList block, it is not necessary for a free, unused short address to be present in the DALI line.

A list of the ballasts 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 parameterised. The list end 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 block is started (rising 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 block then determines the internal long addresses of the DALI devices on the basis of the short addresses and enters them respectively to the parameters nRandomAddressHigh, nRandomAddressMiddle and nRandomAddressLow in the list. If an error occurs during this query, this leads to a false entry for the respective device in the list element nErrors (see ST_DALIV2ChangeAddressList). The further sequence in the block now depends on the option DALIV2_OPTION_SAFE_ADDRESSING (nOptions input). If it is set, then safe new addressing takes place: first of all, 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 an error occurs during deletion, during the status query or during the reprogramming, this leads to a false entry for the respective device in the list element nErrors (see ST_DALIV2ChangeAddressList).
If the option DALIV2_OPTION_SAFE_ADDRESSING (nOptions input) is not set, then the deletion of the short addresses and the status query for the presence of desired new addresses are 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.

VAR_INPUT

bStart            : BOOL;
bCancel           : BOOL;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityHigh;
nOptions          : DWORD := 0;

bStart: The block is activated by a rising edge at this input.

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

nOptions: 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.

VAR_OUTPUT

bBusy          : BOOL;
bError         : BOOL;
nErrorId       : UDINT;

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

bError: 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 an instruction at the inputs.

nErrorId: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of an instruction at the inputs. See Error codes.

VAR_IN_OUT

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

arrChangeAddressList: A reference to the list containing the short addresses to be changed.

stCommandBuffer: A reference to the structure for communication with the FB_DALIV2Communication() (KL6811) or FB_KL6821Communication() (KL6821) block.