“Write variable value by handle” function
IndexGroup: IdxGrp = 0x122300 + Channel ID
Index offset: IdxOffs = 0x49
Write by | This function changes the value of a variable by its handle. |
Transfer parameters: (here with stream offset specified)::
0 | 4 | 8 | 12 | ... | 8 + 4 * n |
Handle on the variable | Number n Array indices | 1st index | 2nd index | ... | variable value |
where
Contents | Type | Size |
Handle on the variable | UNS32 | fixed, 4 bytes |
Number n of transferred array indices | UNS32 | fixed, 4 bytes |
1st – nth array index | UNS32 | variable, n * 4 bytes |
variable value | String, REAL64, SGN32, REAL64[ ], SGN32[ ][ ], ... | variable, max. 2040 bytes |
=> stream length max. 2048 bytes
This function has no return value.
With an array variable, a single value as well as the complete field in which no array indices are transferred can be written.
Example of variable V.G.array[0 .. 9]:
Handle on the variable | Number of array indices
| 1st index | variable value |
Handle on the array | 1 | 4 | Value of 5th element V.G.array[4] |
Handle on the array | 0 | Value or array elements 0 - 9 |
Application examples
1. Example of writing an array element of a unidimensional array:
Transfer parameters:
0x2001234 | 1 | 4 | 123 |
0x2001234 Handle of variable
1 number of array dimensions
4 for the index 4 therefore the 5th element of the V.E.test[] → V.E.test4[]
123 new value of 5th element of the variable
Return value: -
2nd Example of writing a complete array with 5 elements:
0x2001234 | 0 | 123 | 234 | 345 | 456 | 567 |
0x2001234 Handle of variable
0 number of array dimensions
123 new value of 1st element of the variable
234 new value of 2nd element of the variable
345 new value of 3rd element of the variable
456 new value of 4th element of the variable
567 new value of 5th element of the variable
Return value: -