FB_ReadCouplerDiag

FB_ReadCouplerDiag 1:

The function block FB_ReadCouplerDiag allows reading of the first and second flashing sequences of the error LED on the coupler when a terminal bus or coupler error occurs. The data is transferred to the PLC via the 2-byte PLC interface. This only works if communication is maintained via the fieldbus. It must be possible to transfer data from the coupler to the PLC via the fieldbus without errors. To detect a coupler error that has occurred, the status byte of the coupler can be queried cyclically in the PLC and the function block is activated if an error occurs.

FB_ReadCouplerDiag 2: Inputs

VAR_INPUT
    stState    : PLCINTFSTRUCT;
    bExecute   : BOOL;
    tTimeout   : TIME;
END_VAR

Name

Type

Description

stState

PLCINTFSTRUCT

Status word of the 2-byte PLC interface.

bExecute

BOOL

The function block is enabled by a positive edge at this input.

tTimeout

TIME

Specifies the time-out period that must not be exceeded when the function is executed.

FB_ReadCouplerDiag 3: Outputs

VAR_OUTPUT
    stCtrl  : PLCINTFSTRUCT;
    bBusy   : BOOL;
    bError  : BOOL;
    nErrId  : UDINT;
    stDiag  : ST_CouplerDiag;
END_VAR

Name

Type

Description

stCtrl

PLCINTFSTRUCT

Control word of the 2-byte PLC interface.

bBusy

BOOL

When the function block is activated, this output is set and remains set until the function is completed.

bError

BOOL

If an error occurs during the execution of the function, this output is set after the bBusy output has been reset.

nErrId

UDINT

Supplies the error number when the bError output is set.

Error number

Error description

0

No error

0x100

Error at initialisation of the communication via the 2 byte PLC interface

0x200

Error during communication

0x300

Timeout-Error. The permitted execution time was exceeded

0x400

Wrong parameter value at register number

0x500

Wrong parameter value at table number

Name

Type

Description

stDiag

ST_CouplerDiag

Structure containing the coupler's diagnostic information (error type, and the first and second coupler flashing sequences).

Requirements

Development environment

Target system type

PLC libraries to include (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_Coupler (IO)