__VARINFO
The operator is an extension of the IEC 61131-3 standard. The operator returns information about a variable. You can save the information as a data structure in a variable of data type __SYSTEM.VAR_INFO.
Syntax in the declaration:
<name of the info variable> : __SYSTEM.VAR_INFO; // Data structure for info variableSyntax for the call:
<name of the info variable> := __VARINFO( <variable name> ); // Call of the operatorSample:
At runtime the variable MyVarInfo contains the information about the variable nVar.
VAR
    MyVarInfo : __SYSTEM.VAR_INFO;
    nVar      : INT;
END_VARMyVarInfo := __VARINFO(nVar);Data type SYSTEM.VAR_INFO
A variable of data type __SYSTEM.VAR_INFO contains:
Name  | Data type  | Initialization  | Description  | 
ByteAddress  | DWORD  | 0  | Address of the variables Sample: 16#072E35EC Note: During bit access of a variable   | 
ByteOffset  | DWORD  | 0  | Offset of the variable address in bytes. Sample: 13936 bytes. Note: If the variable is global, the offset is relative to the start of the area. If the variable is a local variable in a function or method, the offset is relative to the current stack frame. If the variable is a local variable in a function block, the offset is relative to the function block instance.  | 
Area  | DINT  | 0  | Memory area number in the runtime system. Sample: -1. This means that the variable is not stored globally in memory, but relative to an instance or on the stack. Note: The memory areas are device-dependent.  | 
BitNo  | INT  | 0  | Number of bits in bytes Sample: 16#00FF bytes Note: If the variable is not an integer data type:   | 
BitSize  | INT  | 0  | Memory size of the variables in bits Sample: 16 bits  | 
BitAddress  | UDINT  | 0  | Bit address of the variables Requirement: The variable is in input memory area I, output memory area Q or flag memory area M. Otherwise the value is undefined.  | 
TypeClass  | TYPE_CLASS  | TYPE_BOOL  | Data type class of the variables Sample: TYPE_INT, TYPE_ARRAY Note: For user-defined data types or function block instances, the system outputs the data type class TYPE_USERDEF.  | 
TypeName  | STRING(79)  | ‘’  | Data type name of the variable as STRING(79) Note: For user-defined data types, the function block name or DUT name is specified. Sample: 'INT', 'ARRAY'  | 
NumElements  | UDINT  | 0  | Number of array elements Requirement: The variable has the data type ARRAY. Sample: 8  | 
BaseTypeClass  | TYPE_CLASS  | TYPE_BOOL  | Elementary basic data type of the array elements. Requirement: The variable has the data type ARRAY. Sample: TYPE_INT with arrA : ARRAY [1..2,1..2,1..2] OF INT;  | 
ElemBitSize  | UDINT  | 0  | Memory size of the array element in bits Requirement: The variable has the data type ARRAY. Sample: 16 bits at arrA : ARRAY [1..2,1..2,1..2] OF INT;  | 
MemoryArea  | MEMORY_AREA  | MEM_MEMORY  | Information on the memory area: 
 Sample: MEM_GLOBAL  | 
Symbol  | STRING(39)  | ‘’  | Variable name as STRING(39) Sample: 'iCounter', 'arrA'  | 
Comment  | STRING(79)  | ‘’  | Comment of the variable declaration Sample: 'Counts the calls' or 'Stores the A data'  |