FB_GetHostName

FB_GetHostName 1:

This function block can be used to read the host name of a TwinCAT PC.

FB_GetHostName 2: Inputs

VAR_INPUT
    sNetID   : T_AmsNetId;
    bExecute : BOOL;
    tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

Name

Type

Description

sNetID

T_AmsNetID

A string with the network address of the TwinCAT computer whose host name is to be read can be specified here. For the local computer an empty string may be specified.

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_GetHostName 3: Outputs

VAR_OUTPUT
    bBusy     : BOOL;
    bError    : BOOL;
    nErrID    : UDINT;
    sHostName : T_MaxString;
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.

nErrID

UDINT

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

sHostName

T_MaxString

Host name as string

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (WES7/Win7/Win10: TC RT x86/x64, WEC6/7: TC RT x86, WEC7: TC CE7 ARMV7, TC/BSD: TC RT x64, TC OS ARMT2)

Tc2_Utilities (System)