CouplerReset

CouplerReset 1:

The "CouplerReset" function block can be used to execute a reset of the coupler via the 2-byte PLC interface. In a coupler reset the current terminal configuration, for example, is read in again by the coupler via the K-bus (the terminal bus), and communication on the K-bus is reinitialized. Existing K-bus error messages for the coupler are reset. The STATE and CONTROL variables are used to perform a handshake with the coupler while the function block is being executed. These variables must therefore be linked with the status/control I/O variables of the 2-byte PLC interface in the TwinCAT System Manager.

VAR_INPUT

VAR_INPUT
    STATE     : PLCINTFSTRUCT;
    START     : BOOL;
    TMOUT     : TIME;
END_VAR

STATE: Status word of the 2-byte PLC interface.

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

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

VAR_OUTPUT

VAR_OUTPUT
    CONTROL   : PLCINTFSTRUCT;
    BUSY      : BOOL;
    ERR       : BOOL;
    ERRID     : UDINT;
END_VAR

CONTROL: Control word of the 2-byte PLC interface.

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

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

ERRID: Supplies the error number when the ERR output is set.

Error descriptions:

Error number

Error descriptions

0

no error

0x100

Error in initialization of the communication

0x200

Error during communication

0x300

Timeout error. The time permitted for execution has been exceeded.

 

Example of a call in FBD:

VAR
    IntfState      AT%IW10   : PLCINTFSTRUCT;
    IntfControl    AT%QW10   : PLCINTFSTRUCT;
    CouplerReset1            : CouplerReset;
    Start_CouplerReset       : BOOL;
    CouplerReset_Busy        : BOOL;
    CouplerReset_Err         : BOOL;
    CouplerReset_ErrId       : UDINT;
END_VAR

CouplerReset 2:

 

The variables IntfState and IntfControl are linked with corresponding I/O variables in the TwinCAT System Manager.

Requirements

Development environment

Target system type

IO hardware

PLC libraries to include

TwinCAT version >= 2.7.0

PC (i386)

All coupler with 2 byte PLC interface

Standard.Lib; TcPlcCoupler.Lib