PLC_ReadSymInfoByNameEx

PLC_ReadSymInfoByNameEx 1:

The function block PLC_ReadSymInfoByNameEx has similar functionality as the function block PLC_ReadSymInfoByName. Both function blocks can read symbol information through the symbol name. The difference between the two function blocks is that the function block described here does not return an error if the available buffer size is exceeded and may output incomplete information. In this case the comment and/or the data type identification may have been truncated. Two additional output variables indicate this, i.e. OVTYPE and OVCOMMENT, so that the application can respond accordingly.

PLC_ReadSymInfoByNameEx 2: Inputs

VAR_INPUT
    NETID    : T_AmsNetId;
    PORT     : T_AmsPort;
    SYMNAME  : T_MaxString;
    START    : BOOL;
    TMOUT    : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

Name

Type

Description

NETID

T_AmsNetID

The network address of the TwinCAT computer on which the function is to be executed can be specified here. For the local computer an empty string may be specified.

PORT

T_AmsPort

The port number of the PLC runtime system to which the symbolic variable belongs.

SYMNAME

T_MaxString

The symbol name of the PLC variable whose information is to be read (max. 255 characters, including the complete path, e.g. 'MAIN.INIT_TASK.VARINT').

START

BOOL

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

TMOUT

TIME

Time-out period that may not be exceeded when executing the ADS command.

PLC_ReadSymInfoByNameEx 3: Outputs

VAR_OUTPUT
    BUSY      : BOOL;
    ERR       : BOOL;
    ERRID     : UDINT;
    SymInfo   : SYMINFOSTRUCT;
    OVTYPE    : BOOL;
    OVCOMMENT : BOOL;
END_VAR

Name

Type

Description

BUSY

BOOL

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

ERR

BOOL

If an error should occur during the transfer of the command, then this output is set once the BUSY output was reset.

ERRID

ADS error number

Returns the error code, if the ERR output is set.

SymInfo

SYMINFOSTRUCT

Structure with additional information on the symbolic variable.

OVTYPE

BOOL

Indicates whether the string with the data type identification has caused an overflow (TRUE). The string with the data type identification may have been truncated.

OVCOMMENT

BOOL

Indicates whether the string with the symbol comment has caused an overflow (TRUE). The string with the comment may have been truncated.

Example:

See function block documentation: PLC_ReadSymInfoByName

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)