FB_KL6811Config

FB_KL6811Config 1:

This block is used to configure the KL6811. The configuration is executed when the PLC program starts, or it can be triggered by a positive edge at the input bConfigurate. The parameters are stored in the respective registers of the KL6811 in a fail-safe manner. In addition, some general information, such as the firmware version, is read from the KL6811.

Example

The block is called in the same task as the block FB_DALIV2Communication().

FB_KL6811Config 2:

The block FB_KL6811Config() is linked to the process image of the KL6811. After the configuration, the block FB_DALIV2Communication() is assigned to the process values of the KL6811. During the configuration, it is not possible to send DALI commands.

Unpacking the example files FB_KL6811Config 3:

VAR_INPUT

bConfigurate                        : BOOL := FALSE;
eOperationMode                      : E_DALIV2OperationMode := eDALIV2OperationModeDALI;
bDisableInternalPowerSupply         : BOOL := FALSE;
bEnableCountingDevicesAfterStartup  : BOOL := FALSE;
nOptions                            : DWORD := 0;

bConfigurate: Configuration of the Bus Terminal is started by a positive edge at this input.

eOperationMode: Defines the operating mode of the terminal (DALI or DSI). Corresponds to register 32, bits 12 to 15 of the Bus Terminal.

bDisableInternalPowerSupply: If this input is TRUE, the internal DALI power supply unit of the terminal is disabled during the configuration. Corresponds to register 32, bit 3 of the Bus Terminal.

bEnableCountingDevicesAfterStartup: If this input is TRUE, the number of DALI devices is counted when the terminal starts. Corresponds to register 32, bit 4 of the Bus Terminal.

nOptions: Reserved for future expansions.

VAR_OUTPUT

bBusy                     : BOOL;
bError                    : BOOL;
nErrorId                  : UDINT;
nTerminalDescription      : WORD;
nFirmwareVersion          : WORD;
sDescription              : STRING;

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 as soon as an error occurs during the execution of a command. The command-specific error code is contained in nErrorId. The output is again set to FALSE by the reactivation of the function block via the bConfigurate input.

nErrorId: Contains the command-specific error code of the most recently executed command. It is set back to 0 by the reactivation of the function block via the bConfigurate input. See Error codes.

nTerminalDescription: Contains the terminal designation (e.g. 6811). Corresponds to register 8 of the Bus Terminal.

nFirmwareVersion: Contains the firmware version. Corresponds to register 9 of the Bus Terminal.

sDescription: Terminal designation and firmware version as string (e.g. 'Terminal KL6811 / Firmware 2H').

VAR_IN_OUT

stInDataTerminal          : ST_DALIV2InData;
stOutDataTerminal         : ST_DALIV2OutData;
stInData                  : ST_DALIV2InData;
stOutData                 : ST_DALIV2OutData;

stInDataTerminal: Reference to the structure for communication with the KL6811.

stOutDataTerminal: Reference to the structure for communication with the KL6811.

stInData: Reference to the structure for communication with the function block FB_DALIV2Communication().

stOutData: Reference to the structure for communication with the function block FB_DALIV2Communication().

Requirements

Development environment

Target system

Required libraries

TwinCAT 2.11 R3/x64 from build 2253

PC/CX, BX or BC

TcDALIV2 library from V2.11.1