How to read 32 signed numbers over modbus ?
I was using
var msg1 = {payload:(msg.payload[1]<<16)+msg.payload[0]};
code to create 32 bit numbers and toFloat function to convert it to float. However it's not showing the correct value (the output of msg1).
I tried msg.payload=(msg.payload[0])+(-msg.payload[1] << 32)
as well with no luck.
Any suggestions
The simplest way is with node-red-contrib-buffer-parser
Search this forum for node-red-contrib-buffer-parser modbus
there are quite a few examples.
If you don't want to or can't then look at the nodejs Buffer functions.
I tried that, but not getting the negative numbers. Any scripts available to convert two registers to float( including negative) numbers ?
Did you chose int32xx ?
uint32 == unsigned int (0 ~ 4bn)
int == signed int (-2bn ~ 2bn)
Show me the output of the modbus node (use debug node)
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.