I'm reading MODBUS holding registers.
On register 0 the value is -35 (signed).
If I show this value in gage the value is 65501 (unsigned).
How can I show SIGNED INTEGER?
What do you get coming out of whatever node you are using for modbus? Feed it directly into a debug node and screenshot please.
is that directly from the MODBUS node?
Some of the modbus nodes output a buffer object.
And if it is a buffer then its pretty simple : in a function node (untested)...
let buf = msg.payload; msg.converted = ; msg.converted = buf.readInt16BE(); msg.converted = buf.readInt16BE(); msg.converted = buf.readInt16BE(); //... etc ... return msg;
see buffer documentation for a whole raft of
read functions (for when you ask how to read floats next )
To use the data as in the debug then you can do, for each item in the array
msg.payload[i] = (msg.payload[i] << 16) >> 16
Collin you are the best.
Simple and effective sollution.
Off topic question.
Do you have similar (simple) idea of how to show BCD formated numbers?
I have posted: OMRON BCD format
Ask for further help on that thread. One poster described how to do it, if that is not in sufficient detail then ask for further clarification.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.