FB_KL27x1Config

FB_KL27x1Config 1:

The FB_KL27x1Config function block is used to parameterize a KL2751 / KL2761: 1-channel dimmer terminal.

FB_KL27x1Config 2: Inputs

VAR_INPUT
    bConfigurate            : BOOL;
    bReadConfig             : BOOL;
    bSetDimRampAbsolute     : BOOL;
    iSetRampTime            : INT;
    bSetWatchdogDisable     : BOOL;
    iSetWatchdogTimeout     : UINT;
    iSetTimeoutOnValue      : UINT;
    iSetTimeoutOffValue     : UINT;
    iSetDimmerMode          : INT;
    bSetOnAfterShortCircuit : BOOL;
    bSetLineFrequency60Hz   : BOOL;
    tTimeout                : TIME;
END_VAR

Name

Type

Description

bConfigurate

BOOL

A rising edge starts the configuration sequence. First, the general terminal data, i.e. "terminal name", "special version" and "firmware version", are read. Then, the specified settings are written to the corresponding registers and finally read again for verification and information. The read information is displayed at the function block outputs. During this sequence the output bBusy is TRUE, and no further command, e.g. bReadConfig, is accepted.

bReadConfig

BOOL

A rising edge starts a read sequence. The general terminal data “terminal name”, “special version” and “firmware version” are read, followed by the set configuration parameters. The read information is displayed at the function block outputs. During the read sequence the output bBusy is TRUE, and no further command, e.g. bConfigurate, is accepted.

bSetDimRampAbsolute

BOOL

FALSE: The set ramp time iSetRampTime refers to the complete data area (0 - 32767). The smaller the discontinuity, the shorter the ramp time. TRUE: Each switching step, whatever the size, requires the same time, as entered under iSetRampTime.

iSetRampTime

INT

Ramp time input. The setting is based on the table below.

bSetWatchdogDisable

BOOL

The internal watchdog is disabled.

iSetWatchdogTimeout

ÚINT

Setting the watchdog time as a multiple of 10 ms.

iSetTimeoutOnValue

UINT

This input specifies the light value that is output when a fieldbus error occurs with current process data > 0.

iSetTimeoutOffValue

UINT

This input specifies the light value that is output when a fieldbus error occurs with current process data = 0.

iSetDimmerMode

INT

This input is used to set the dimmer mode. The setting is based on the table below.

bSetOnAfterShortCircuit

BOOL

FALSE: After a short circuit the light remains switched off. TRUE: The light is switched on again after a short circuit.

bSetLineFrequency60Hz

BOOL

FALSE: Mains frequency = 50 Hz. TRUE: Mains frequency = 60 Hz.

tTimeout

TIME

The terminal configuration or reading of the configuration must be completed within the time entered here. Otherwise an error with a corresponding error number is issued at the outputs bError and iErrorId.

iSetRampTime

Element

0

50 ms

1

100 ms

2

200 ms

3

500 ms

4

1 s

5

2 s

6

5 s

7

10 s

iSetDimmerMode

Element

0

Automatic detection

1

Trailing edge phase control

2

Leading edge phase control

3

Rectifier mode, positive (positive half-wave with leading edge phase control)

4

Rectifier mode, negative (negative half-wave with leading edge phase control)

FB_KL27x1Config 3: Inputs/outputs

VAR_IN_OUT
    stInData  : ST_KL1501InData;
    stOutData : ST_KL1501OutData;
END_VAR

Name

Type

Description

stInData

ST_KL1501InData

Reference to the structure of the input process image.

stOutData

ST_KL1501OutData

Reference to the structure of the output process image.

FB_KL27x1Config 4: Outputs

VAR_OUTPUT
    bBusy             : BOOL;
    bError            : BOOL;
    iErrorId          : UDINT;
    iState            : USINT;
    iTerminalType     : WORD;
    iSpecialType      : WORD;
    iFirmwareVersion  : WORD;
    sDescription      : STRING;
    bDimRampAbsolute  : BOOL;
    sRampTime         : STRING;
    bWatchdogDisable  : BOOL;
    tWatchdogTimeout  : TIME;
    iTimeoutOnValue   : UINT;
    iTimeoputOffValue : UINT;
    sDimmerMode       : STRING;
    aAfterShortCirciut: STRING;
    sLineFrequency    : STRING;
END_VAR

Name

Type

Description

bBusy

BOOL

As long as the read or configuration sequence is in progress, this output is TRUE.

bError

BOOL

This output is switched to TRUE, if an error occurred while a command (Configure or Read) is executed. The command-specific error code is contained in iErrorId.

iErrorId

UDINT

Contains the command-specific error code of the most recently executed command. It is reset to 0 by activating the function block again via the inputs bConfigurate or bReadConfig. See error codes.

iState

USINT

Corresponds to the status variable of the process data stInData.iState, see VAR_IN_OUT. During command execution (bBusy = TRUE) this output is set to 0. This output is therefore suitable for assessing the status of the terminal in normal operation. Interfering states during configuration and reading through the register communication are hidden.

iTerminalType

WORD

Contents of register 8 (terminal name). When used with the correct terminal, the content should be 0x05DD (1501dec).

iSpecialType

WORD

Contents of register 29 (special version)

iFirmwareVersion

WORD

Contents of register 9 (firmware version)

sDescription

STRING

Terminal name, special version and firmware version as string (e.g. 'terminal KL1501-0000 / firmware 1C').

bDimRampAbsolute

BOOL

TRUE: The dimming ramp is set absolute, i.e. each switching step requires the same ramp time, as specified under iSetRampTime.

sRampTime

STRING

Set ramp time in plain text.

bWatchdogDisable

BOOL

TRUE: Watchdog is disabled.

tWatchdogTimeout

TIME

Set watchdog time.

iTimeoutOnValue

UINT

Set light value, which is output when a fieldbus error occurs with current process data > 0.

iTimeoutOffValue

UINT

Set light value, which is output when a fieldbus error occurs with current process data = 0.

sDimmerMode

STRING

Set dimmer mode in plain text.

sAfterShortCircuit

STRING

Set behaviour after short circuit in plain text.

sLineFrequency

STRING

Set mains frequency in plain text.

Requirements

Development environment

Target platform

IO Hardware

PLC libraries to include

TwinCAT v3.1.4018.26

PC/CX

KL2751, KL2761

Tc2_IoFunctions from v3.3.5.0