FB_DALIV2SetSettings
This block initialises the variables (MIN LEVEL, MAX LEVEL, FADE TIME ...) of all ballasts within a DALI line with the values stored in a structure of type ST_DALIV2DeviceSettings.
Applying a positive edge to the bStart input starts the block, and the bBusy output goes TRUE. The system first checks whether the bPresent bit is set in the respective structure (see ST_DALIV2DeviceSettings). If this is the case, all ballast variables that are not write-protected are initialised with the respective values of the structure. The structure index here reflects the address of the ballast. In other words, data for the device with short address 0 is located at arrDALIDeviceSettings[0], and so on through to the device with short address 63 having its data at arrDALIDeviceSettings[63]. If a write error occurs for a device, the nErrors element is set for the respective structure without the function block itself switching to error mode. The following table shows which bit is set in the nErrors variable when an error occurs during the writing of a variable to a ballast.
Bit | Error |
---|---|
2 | Error whilst writing the variable POWER ON LEVEL |
3 | Error whilst writing the variable SYSTEM FAILURE LEVEL |
4 | Error whilst writing the variable MIN LEVEL |
5 | Error whilst writing the variable MAX LEVEL |
6 | Error whilst writing the variable FADE RATE |
7 | Error whilst writing the variable FADE TIME |
9 | Error whilst writing the variables GROUP 0-7 and GROUP 8-15 |
10 | Error whilst writing the variables SCENE 0 to SCENE 15 |
When the function block has been processed, the bBusy output changes from TRUE to FALSE. Processing this function block can take several seconds, depending on how many ballasts are attached.
VAR_INPUT
bStart : BOOL;
bCancel : BOOL;
eCommandPriority : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nOptions : DWORD;
bStart: The block is activated by a rising edge at this input.
bCancel: A rising edge at this input will deactivate the block and hence abort the initialisation of the variable.
eCommandPriority: The priority (high, middle, low) this command has when executed by the library.
nOptions: Options for writing the variables (see table). The individual constants must be linked with OR operators.
Constants | Description |
---|---|
DALIV2_OPTION_POWER_ON_LEVEL | The variable POWER ON LEVEL |
DALIV2_OPTION_SYSTEM_FAILURE_LEVEL | The variable SYSTEM FAILURE LEVEL |
DALIV2_OPTION_MIN_LEVEL | The variable MIN LEVEL |
DALIV2_OPTION_MAX_LEVEL | The variable MAX LEVEL |
DALIV2_OPTION_FADE_RATE | The variable FADE RATE |
DALIV2_OPTION_FADE_TIME | The variable FADE TIME |
DALIV2_OPTION_GROUPS | The variables GROUP 0-7 and GROUP 8-15 |
DALIV2_OPTION_SCENE_LEVELS | The variables SCENE 0 to SCENE 15 |
DALIV2_OPTION_ALL | All variables are initialized. |
DALIV2_OPTION_PUSH_DALI_COMMANDS | The buffer, which contains the feedback telegrams from the ballasts, among other things, is not read. Hence, writing becomes faster, but errors are not recognised. |
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
nErrorId : UDINT;
nCurrentShortAddr : BYTE;
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 if 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.
nCurrentShortAddr: Short address of the ballast for which variables are being initialised.
VAR_IN_OUT
stCommandBuffer : ST_DALIV2CommandBuffer;
arrDALIDeviceSettings : ARRAY[0..63] OF ST_DALIV2DeviceSettings;
stCommandBuffer: A reference to the structure for communication with the FB_DALIV2Communication() (KL6811) or FB_KL6821Communication() (KL6821) block.
arrDALIDeviceSettings: Reference to an array of 64 elements of type ST_DALIV2DeviceSettings. The settings of each individual DALI ballast are stored in these variables.