FB_DALIV2GetSettings
This function block FB_DALIV2GetSettings reads the variables (MIN LEVEL, MAX LEVEL, FADE TIME, ...) of all control gears within a DALI line and saves them in a structure of type ST_DALIV2DeviceSettings.
Applying a positive edge to the bStart input starts the function block, and the output bBusy goes TRUE. A check is first made as to whether a control gear is present at all. If this is the case, then the bPresent bit is set in the corresponding structure (see ST_DALIV2DeviceSettings), after which the settings of the control gear are read out one by one and written in the associated variables in the structure. If it is found that a device is not available, the reading is skipped and work continues with the next device. The structure index here reflects the address of the device. 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 read error occurs when reading from a device, the corresponding bit in 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 reading of a variable from a control gear.
Bit | Error |
---|---|
0 | An error occurred whilst attempting to seek the control gear. |
1 | Error whilst reading the variable ACTUAL DIM LEVEL. |
2 | Error whilst reading the variable POWER ON LEVEL. |
3 | Error whilst reading the variable SYSTEM FAILURE LEVEL. |
4 | Error whilst reading the variable MIN LEVEL. |
5 | Error whilst reading the variable MAX LEVEL. |
6 | Error whilst reading the variable FADE RATE. |
7 | Error whilst reading the variable FADE TIME. |
8 | Error whilst reading the variable RANDOM ADDRESS. |
9 | Error whilst reading the variables GROUP 0-7 and GROUP 8-15. |
10 | |
11 | Error whilst reading the variable STATUS INFORMATION. |
12 | Error whilst reading the variable VERSION NUMBER. |
13 | Error whilst reading the variable DEVICE TYPE. |
14 | Error whilst reading the variable PHYSICAL MIN LEVEL. |
![]() | 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 reading of the variables. |
eCommandPriority | Priority (high, medium or low) with which the command is processed by the library. | |
nOptions | DWORD | Options for reading the variables (see table). The individual constants must be linked with OR operators. |
Constant | Description |
---|---|
DALIV2_OPTION_ACTUAL_DIM_LEVEL | The variable ACTUAL DIM LEVEL is read. |
DALIV2_OPTION_POWER_ON_LEVEL | The variable POWER ON LEVEL is read. |
DALIV2_OPTION_SYSTEM_FAILURE_LEVEL | The variable SYSTEM FAILURE LEVEL is read. |
DALIV2_OPTION_MIN_LEVEL | The variable MIN LEVEL is read. |
DALIV2_OPTION_MAX_LEVEL | Die Variable MAX LEVEL is read. |
DALIV2_OPTION_FADE_RATE_FADE_TIME | |
DALIV2_OPTION_RANDOM_ADDRESS | The variable RANDOM ADDRESS is read. |
DALIV2_OPTION_GROUPS | The variables GROUP 0-7 and GROUP 8-15 are read. |
DALIV2_OPTION_SCENE_LEVELS | |
DALIV2_OPTION_STATUS_INFORMATION | The variable STATUS INFORMATION is read. |
DALIV2_OPTION_VERSION_NUMBER | The variable VERSION NUMBER is read. |
DALIV2_OPTION_DEVICE_TYPE | The variable DEVICE TYPE is read. |
DALIV2_OPTION_PHYSICAL_MIN_LEVEL | The variable PHYSICAL MIN LEVEL is read. |
DALIV2_OPTION_DONT_CLEAR_DEVICE_SETTINGS | The variable arrDALIDeviceSettings is not deleted before reading. |
DALIV2_OPTION_ALL | All variables are read. |
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 |