FB_GetLocalAmsNetId

FB_GetLocalAmsNetId 1:

The function block FB_GetLocalAmsNetId reads the local AmsNetId (local TwinCAT-specific network address).

VAR_INPUT

VAR_INPUT
    bExecute        :BOOL;
    tTimeOut        :TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

bExecute: The command is executed with a rising edge at the input

tTimeOut: Maximum time allowed for the execution of this ADS command.

VAR_OUTPUT

VAR_OUTPUT
    bBusy       :BOOL;
    bError      :BOOL;
    nErrId      :UDINT;
    AddrString  :T_AmsNetId;
    AddrBytes   :T_AmsNetIdArr;     
END_VAR

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

bError:  If an ADS error occurs during execution, this output is set after bBusy output has been reset. 

nErrId:  This variable provides the ADS error code,  if bError is true.

AddrString:  AmsNetId as string.

AddrBytes: AmsNetId as array of byte.

Requirements

Development environment

Target System

PLC libraries to include

TwinCAT v2.8.0 Build > 744

TwinCAT v2.9.0 Build > 941

PC or CX (x86)

TcUtilities.Lib

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

TwinCAT v2.10.0 Build >= 1301

CX (ARM)