PLC_ReadSymInfoByNameEx
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 blocks is that the block described here does not report an error if the available buffer size is exceeded and may output incomplete information. In this case the comment and/or the data type ID may have been truncated. Two additional output variables indicate this, i.e.OVTYPE and OVCOMMENT, so that the application can respond accordingly.
VAR_INPUT
VAR_INPUT
NETID :T_AmsNetId;
PORT :T_AmsPort;
SYMNAME :T_MaxString;
START :BOOL;
TMOUT :TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
NETID: It is possible here to provide the AmsNetId of the TwinCAT computer on which the function to be executed. If it is to be run on the local computer, an empty string can be entered.
PORT: The port number of the PLC run-time system to which the symbolic variable belongs. The first PLC run-time system has the port number 801.
SYMNAME: 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: The block is activated by a rising edge at this input.
TMOUT: States the length of the timeout that may not be exceeded by execution of the ADS command.
VAR_OUTPUT
VAR_OUTPUT
BUSY : BOOL;
ERR : BOOL;
ERRID : UDINT;
SymInfo : SYMINFOSTRUCT;
OVTYPE : BOOL;(* TRUE => Type name string length overflow, FALSE => no overflow *)
OVCOMMENT : BOOL;(* TRUE => Comment string length overflow, FALSE => no overflow *)
END_VAR
BUSY: When the function block is activated this output is set. It remains set until feedback is received.
ERR: If an ADS error should occur during the transfer of the command, then this output is set once the BUSY output is reset.
ERRID: Supplies the ADS error number when the ERR output is set.
SymInfo: A structure with additional information on the symbolic variable.
OVTYPE: 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: Indicates whether the string with the symbol comment has caused an overflow (TRUE). The string with the comment may have been truncated.
Requirements
Development environment | Target system type | PLC Libraries to include |
---|---|---|
TwinCAT v2.11.0 Build > 1550 | PC or CX (x86, ARM) | TcUtilities.Lib |