I use the Modbus TCP Server 4 (library Modbus TCP 7) and use the array arrModbusData also for another block.
In this block I read from the array and write to it. But I cannot access elements of the array as usual in C#. The data type of the array is MB_TCP_ARR_W_0_7167.
To my knowledge this corresponds to 16 bit → WORD in PLCNext and a ushort in C# The array ModBusData is defined for the other block in C# as follows
[InOut, DataType(“ANY”)]
public ushort ModBusData; The access with
ushort temp = ModBusData[0]
and writing with
ModBusData[1] = 0x0000
does not work and gives an error when writing the project.
The error messages are:
- Array boundaries out of valid range
- Runtime exception occurred on device How can this be done reading and writing to the ModBusData?
![]()