# Newbie: convert modbus float [array] register to float value

Nope, I'm missing something...
when its over 65353 I loose the base 65353 value.
Dang it will try something else before I fill up this forum with my mistakes.

I have very little time for now but will reply to you asap.
feel free to ask questions, we are on the very same boat
just play with node-red and google what you're looking for in the meantime.

Signed meaning that negative values are accepted
Unsigned meaning that negative values are not accepted, just positive
if you accept signed 16bit registers, your range is shifted (-32767 / 32767) vs unsigned (0-65535)

Ok, so believe I've got it again on paper but not in node-red
A= the 0 or 1 from first bit of register
B = the value
C = 65535
so the math would be (A * C) + B
If it is below 65535 then the first bit would be 0 and the second bit would be the actual value
so if the value on my device is 55 degrees
then I would poll (0, 55000)
so the math would be (0 * 65535) + 55000 and would = 55000
If my sensor was ready 66 degree then I would poll (1, 464)
and the math would be (1 * 65535) + 464 and would be 65999
Heck maybe I make the fixed value 65536 for right on the money to 66000

that sound great, so I've been trying to repeat said math in a function block but with no success.
So I've tried one Modus block with both resisters and two Modbus block with one register a piece and I don't know how to reference these in a function block.
The value just get pushed through to the debug.
I'm trying to reference (A, B) in my function block but that does not appear to under stand that A should be the first number and B should be the second number. I do see it comes out as an array and 0 is first

Here is the right way to convert:

const buf = Buffer.allocUnsafe(4); // (4) is ok
buf.writeUInt16BE(pay[0]); // high byte
buf.writeUInt16BE(pay[1], 2); // low byte