Closed MonoLogueChi closed 3 months ago
Hi, you could use ModbusEndianess.BigEndian
and read ushort
data:
axis0.Connect(new IPEndPoint(IPAddress.Parse("192.168.0.233"), 502), ModbusEndianness.BigEndian);
var a = await axis0.ReadInputRegistersAsync<ushort>(1, 0, 2);
In that case you should get two ushort
values with the correct byte order. Here is a bit more information:
https://github.com/Apollo3zehn/FluentModbus/issues/86#issuecomment-2111742545
Hi, you could use
ModbusEndianess.BigEndian
and readushort
data:axis0.Connect(new IPEndPoint(IPAddress.Parse("192.168.0.233"), 502), ModbusEndianness.BigEndian); var a = await axis0.ReadInputRegistersAsync<ushort>(1, 0, 2);
In that case you should get two
ushort
values with the correct byte order. Here is a bit more information: #86 (comment)
Thank you very much
Sorry to bother you, I have encountered doubts when using modbus. I don't know how to get the correct value.
I need to read a float value, I use the following code
And I got the data
But I need the correct data to be
I can only do a manual conversion now. Does FluentModbus have an API that can do automatic conversion?