FB_DALIV2GetSettingsSingleDevice

FB_DALIV2GetSettingsSingleDevice 1:

In contrast to the function block FB_DALIV2GetSettings, the function block FB_DALIV2GetSettingsSingleDevice reads the variables (MIN LEVEL, MAX LEVEL, FADE TIME, ...) from only one specific device and saves them 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 settings of all control gears are then read sequentially and written into the respective variables of the structure. If a read error occurs when reading from 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 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

Error whilst reading the variables SCENE 0 to SCENE 15.

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.

FB_DALIV2GetSettingsSingleDevice 2: Inputs

VAR_INPUT
  bStart           : BOOL;
  bCancel          : BOOL;
  nAddr            : BYTE;
  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.

nAddr

BYTE

The address of the device whose values are to be read.

eCommandPriority

E_DALIV2CommandPriority

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

The variables FADE RATE und FADE TIME are read.

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

The variables SCENE 0 to SCENE 15 are read.

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 stDALIDeviceSettings is not deleted before reading.

DALIV2_OPTION_ALL

All variables are read.

FB_DALIV2GetSettingsSingleDevice 3: Inputs/outputs

VAR_IN_OUT
  stCommandBuffer      : ST_DALIV2CommandBuffer;
  stDALIDeviceSettings : 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).

stDALIDeviceSettings

ST_DALIV2DeviceSettings

Reference to a structure: The settings of the DALI control gear are stored in this variable.

FB_DALIV2GetSettingsSingleDevice 4: Outputs

VAR_OUTPUT
  bBusy    : BOOL;
  bError   : BOOL;
  nErrorId : UDINT;
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).

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4020.14

Tc2_DALI from v3.4.3.0