Reading Real Number with Modbus TCP/IP

Hello all,
I want to read real data type which is 2 WORD using Modbus TCP/IP.
How Can I merge these 2 WORD to obtain Real Number.
I read before UINT from buffer using these code;

// Create new Buffer based on array bytes
const buf = Buffer.from(msg.payload.buffer);
// Represent these bytes as 32-bit unsigned int
const value = buf.readUInt32BE();
// save the value

msg.payload = value;
return msg;

But I dont know how to apply this for REAL number.


Thanks.

Maybe try https://nodejs.org/docs/latest-v8.x/api/buffer.html#buffer_buf_readfloatbe_offset_noassert ?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.