“Read variable value by name” function
IndexGroup: IdxGrp = 0x122300 + Channel ID
Index offset: IdxOffs = 0x48
Read by name | This function reads the value of a variable by its name. |
Transfer parameters: (here with stream offset specified)::
0 |
Variable name with zero termination |
where
Contents | Type | Size |
Variable name (with instance identifier for axis-specific variables) | STRING | variable, max. 256 bytes |
=> stream length max. 256 bytes
Return value: (here with stream offset specified)::
0 |
variable value |
where
Contents | Type | Size |
variable value | String, REAL64, SGN32, REAL64[ ], SGN32[ ][ ], ... | variable, max. 2048 bytes |
=> stream length max. 2048 bytes
With an array variable, a single value as well as the complete field in which no indices are specified in the variable name can be read.
Example of variable V.G.array[0 .. 9]:
Variable name | Return value |
V.G.array[4] | Value of 5th element V.G.array[4] |
V.G.array | Value or array elements 0 - 9 |
Application examples
Example of reading an array element of a 1-dimensional array:
Transfer parameters:
V.E.Testvar[3] | 0 |
V.E.Testvar[3] Variable name
0 zero termination
Return value:
333 |
333 variable value of the element
Example of reading a complete array with 5 elements:
Transfer parameters:
V.E.Testvar | 0 |
V.E.Testvar Name of the variable
0 zero termination
Return values:
123 | 234 | 345 | 456 | 567 |
123 value of 1st element
234 value of 2nd element
345 value of 3rd element
456 value of 4th element
567 value of 5th element