I need some help please to get Modbus numbers reading correctly when they go negative.
When the output from my modbus device goes negative it adds 65535 to the number.
I have tried various settings in a few different Modbus input nodes, but they all give the same output.
I have also tried a few of the function nodes but none seem to solve the problem.
I thought it may be quite simple to write a "function" node, but I have no idea with java script.
What I want is:
if msg.payload > 2000;
then msg.payload = msg.payload - 65535;
else return msg.payload;
Those of you who understand thees things will know I am getting all sorts of error messages on each line. I suspect it just needs some minor grammar and layout adjustments but I have not found any java script grammar tutorials that show what I need to do?