FB_DALIV2SetSettings
The function block FB_DALIV2SetSettings initializes the variables (MIN LEVEL, MAX LEVEL, FADE TIME, ...) of all control gears of a DALI line with the values that are stored in a structure of type ST_DALIV2DeviceSettings.
Applying a positive edge to the input bStart starts the function block, and the output bBusy goes TRUE. The system first checks whether the bit bPresent is set in the respective structure (see ST_DALIV2DeviceSettings). If this is the case, all control gear variables that are not read-only are initialized with the respective values of the structure. The structure index here reflects the address of the control gear. In other words, data for the device with short address 0 is located at arrDALIDeviceSettings[0], and so on through to the control gear with short address 63 having its data at arrDALIDeviceSettings[63]. If a write error occurs for a device, the element nErrors 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 variable nErrors when an error occurs during the writing of a variable to a control gear.
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 |
![]() | After processing the function block, the output bBusy changes from TRUE to FALSE. Processing this function block can take several seconds, depending on how many control gears are connected. |
Inputs
VAR_INPUT
bStart : BOOL;
bCancel : BOOL;
eCommandPriority : E_DALIV2CommandPriority := eDALIV2CommandPriorityMiddle;
nOptions : DWORD;
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 will disable the function block and hence abort the initialization of the variable. |
eCommandPriority | 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_POWER_ON_LEVEL | The variable POWER ON LEVEL is initialized. |
DALIV2_OPTION_SYSTEM_FAILURE_LEVEL | The variable SYSTEM FAILURE LEVEL is initialized. |
DALIV2_OPTION_MIN_LEVEL | The variable MIN LEVEL is initialized. |
DALIV2_OPTION_MAX_LEVEL | The variable MAX LEVEL is initialized. |
DALIV2_OPTION_FADE_RATE | The variable FADE RATE is initialized. |
DALIV2_OPTION_FADE_TIME | The variable FADE TIME is initialized. |
DALIV2_OPTION_GROUPS | The variables GROUP 0-7 and GROUP 8-15 are initialized. |
DALIV2_OPTION_SCENE_LEVELS | |
DALIV2_OPTION_ALL | All variables are initialized. |
DALIV2_OPTION_PUSH_DALI_COMMANDS | The buffer containing the feedback messages from the control gears is not read. Hence, writing becomes faster, but errors are not recognized. |
Inputs/outputs
VAR_IN_OUT
stCommandBuffer : ST_DALIV2CommandBuffer;
arrDALIDeviceSettings : ARRAY [0..63] OF ST_DALIV2DeviceSettings;
END_VAR
Name | Type | Description |
---|---|---|
stCommandBuffer | ST_DALIV2CommandBuffer | Reference to the internal structure for communication with FB_KL6811Communication (KL6811) or FB_KL6821Communication (KL6821). |
arrDALIDeviceSettings | ARRAY OF ST_DALIV2DeviceSettings | Reference to an array with 64 elements. The settings of each individual DALI control gear are stored in this variable. |
Outputs
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
nErrorId : UDINT;
nCurrentShortAddr : BYTE;
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). |
nCurrentShortAddr | BYTE | Short address of the current control gear from which an attempt is being made to read the variables. |
Requirements
Development Environment | PLC library to include |
---|---|
TwinCAT from v3.1.4020.14 | Tc2_DALI from v3.4.3.0 |