“Read variable value by handle” function
Index group: IdxGrp = 0x122300 + Channel ID
Index offset: IdxOffs = 0x47
Read by handle | This function reads the value of a variable by its handle. |
Transfer parameter (here with stream offset specified):
0 | 4 | 8 | 12 | 8 + 4 Byte * n |
Handle on the variable | Number n Array dimensions | 1. index | 2nd index | ...
|
where
Contents | Type | Size |
Handle on the variable | UNS32 | fixed, 4 bytes |
Number n of array dimensions | UNS32 | fixed, 4 bytes |
1. – n. array index | UNS32 | variable, n * 4 bytes |
=> stream length 8 bytes + number of array dimensions n * 4 bytes, max. 2048 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 array indices are transferred can be read.
Application examples
1. Example of reading an array element of a unidimensional array:
Transfer parameters:
Handle on the variable | Number of array dimensions
| 1. index | Return value |
Handle on the array | 1 | 4 | Value of 5th element V.G.array[4] |
0x20012341 Handle on the variable
1 number of array dimensions
4 for Index 4 therefore the value of the 5th Element of the variable V.E.test[] → V.E.test[4]
Return value:
333 |
333 variable value
2nd Example of reading a complete array with 5 elements:
Handle on the variable | Number of array dimensions
| 1. index | Return value |
Handle on the array | 0 | Value of all array elements 0 to (n-1) |
0x2001234 Handle on the variable
0 number of array dimensions
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