Operator ‘__VARINFO’

This operator is an extension of the IEC 61131-3 standard.

The operator yields information about a variable of the project at runtime. The information is stored as a data structure in a variable of data type __SYSTEM.VAR_INFO.

Example

At runtime, the variable MyVarInfo contains the information about the variable MyVar.

//Declaration
VAR
   MyVarInfo : __SYSTEM.VAR_INFO;
   MyVAR : INT;
END_VAR

//Program code
MyVarInfo := __VARINFO (MyVar);

Data type SYSTEM.VAR_INFO

  • ByteAddress: Address of the variable
  • ByteOffset: Offset (in bytes)
  • Area: Number of the memory area
  • BitNr: Number of the bit in the byte. If it is not a bit type: -1
  • BitSize: Size of the variable (in bits)
  • BitAddress: Bit address of the variable
  • TypeClass: Data type class of the variable
  • TypeName: Data type of the variable
  • NumElements: For arrays: Number of array elements
  • BaseTypeClass: For arrays: Data type class of the base data type
  • ElemBitSize: For arrays: Bit size of an array element
  • MemoryArea: Information for the memory area: memory, input, output, retain, global, local
  • Symbol: Variable name
  • Comment: Comment