FB_RemoveRouteEntry

 

FB_RemoveRouteEntry 1:

This function block deletes an existing connection to a TwinCAT System from the AMS Router Connection (remote routes) list.

VAR_INPUT

VAR_INPUT
    sNetID      : T_AmsNetID;
    sName       : STRING(MAX_ROUTE_NAME_LEN);
    bExecute    : BOOL;
    tTimeout    : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

sNetID: Here a string containing the network address of the TwinCAT Computer can be given, whose AMS Router connection should be deleted. The string can also be empty for the local computer.

sName: Connection name of the connection to be deleted. The maximum string length is limited by a constant (default: 31 characters).

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 by execution of the ADS command.

VAR_OUTPUT

VAR_OUTPUT
    bBusy   : BOOL;
    bError  : BOOL;
    nErrId  : UDINT;
END_VAR

bBusy: When the function block is activated this output is set. It remains set until and acknowledgement is received.

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

nErrId: When the bError output is set, this variable supplies the ADS error or the command-specific error code.

 

Example in FBD:

The connection with the connection name: "TEST" should be deleted from the list of the AMS Router connections on the local TwinCAT System. The connection is deleted by a positive edge a the bExecute variable.

PROGRAM P_TEST2
VAR
    fbRemoveRoute   : FB_RemoveRouteEntry;
    bExecute    : BOOL;
    bBusy       : BOOL;
    bError      : BOOL;
    nErrID      : UDINT;
END_VAR

FB_RemoveRouteEntry 2:

Requirements

Development environment

Target system type

PLC libraries to include

TwinCAT v2.9.0 Build > 1033

TwinCAT v2.10.0 Build > 1257

PC or CX (x86)

TcUtilities.Lib

( Standard.Lib; TcBase.Lib; TcSystem.Lib are included automatically )

TwinCAT v2.10.0 Build >= 1301

CX (ARM)