FB_ReadCouplerDiag 1:

The FB_ReadCouplerDiag function block 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, however, only functions if communication over the fieldbus is maintained. It must be possible for the data to be transferred without error from the coupler to the PLC via the fieldbus. In order to detect that a coupler error has occurred, the status byte for the coupler in the PLC can be interrogated cyclically, and the function block activated when an error occurs.


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

stState : Status word of the 2-byte PLC interface. (PLCINTFSTRUCT)

bExecute: The function block is activated by a positive edge at this input.

tTimeout: States the length of the timeout that may not be exceeded during execution of the function.


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

stCtrl : Control word of the 2-byte PLC interface. (PLCINTFSTRUCT)

bBusy: This output is set when the block is activated, and remains set until execution of the function has been completed.

bError: If an error should occur during the execution of the function, then this output is set, after the bBusy output has been reset.

nErrId : Supplies the error number when the bError output is set.

Error number

Error description


No error


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


Error during communication


Timeout-Error. The permitted execution time was exceeded


Wrong parameter value at register number


Wrong parameter value at table number


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


Development environment

Target system type

PLC libraries to include (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_Coupler (IO)