FB_GetLocalAmsNetId

FB_GetLocalAmsNetId 1:

This function block can be used to read the network address (AmsNetID) of a local TwinCAT PC.

FB_GetLocalAmsNetId 2: Inputs

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

Name

Type

Description

bExecute

BOOL

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

tTimeout

TIME 

States the length of the timeout that may not be exceeded by execution of the ADS command.

FB_GetLocalAmsNetId 3: Outputs

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

Name

Type

Description

bBusy

BOOL

When the function block is enabled, this output is set and remains set until a feedback is received.

bError

BOOL

If an error occurs during the transmission of the command, this output is set after the bBusy output is reset.

nErrorId

UDINT

Returns the ADS error number when the bError output is set.

AddrString

T_AmsNetID

AmsNetID of the local PC as string

AddrBytes

T_AmsNetIDArr

AmsNetID of the local PC as byte array

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_Utilities (System)