FB_DALIV2xChangeAddressList

FB_DALIV2xChangeAddressList 1:

This function block can be used to change the short addresses of several control units.

A list of the control units for which the short address is to be changed is transferred in the array arrChangeAddressList 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 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 function block is started (rising edge on bStart), the list end is first determined based on 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 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 function 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;
eCommandPriority  : E_DALIV2CommandPriority := eDALIV2CommandPriorityHigh;
nOptions          : DWORD := 0;
eDataFrameType    : E_DALIV2DataFrameType := eDALIV2DataFrameType24Bit;

bStart: The function block is activated by a positive 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.

eDataFrameType: Output format of the DALI command (eDALIV2DataFrameType24Bit or eDALIV2DataFrameTypeOsram).

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 function 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 a command at the inputs.

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

VAR_IN_OUT

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

stCommandBuffer: Reference to the internal structure for communication with the function block FB_KL6821Communication() (KL6821).

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

Requirements

Development environment

Target system

Required libraries

TwinCAT 2.11 R3/x64 from build 2260

PC/CX, BX or BC

TcDALIV2 library from V2.12.0