How to calculate negative modbus value?

im stuck..

im reading modbus tcp values, when temperature goes -1 and below the graph seems to go bananas at night. Im trying to find out the right formula to calculate negative values passed from the modbus tcp.. i tried
where x is analog value, y is values stored as max/min value in holding register(16bit)

The sensor is a PT1000 and i base Xmax as Ymax.. in example.. PT1000tables at the internet shows me +50 at 1194ohm and -50 at 303ohm
(50--50)/(1194-303) => 100/891=0,11 (m)

and... here im stuck, not sure what to do... maybe my sensor is bad or my node-red settings are bad :frowning:

Does the x value represent ohms or what?
What x values are you getting and what values are X and Y max and min?
What formula are you using at the moment and are the values correct for positive values?

also check if you are using signed vs unsigned ints correctly - than can throw things around too...

1 Like

x = analogue signal but might not be ohm value, the FTX does not tell..
for positive values, i just read it straight off the modbus :slight_smile:

But i think i found my answer here... will try this solution soon.

If you are getting the right values without calculation for +ve but not for -ve then yes, you have a signed value which you need to convert to unsigned. It may be that you should be user the buffer-parser node for extracting the data, that will likely do everything you need in one go.

Sorry, I didn't mean convert to unsigned, I meant that you should pick it up from the buffer, converting it a signed value as you do it, rather than an unsigned value.

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