LogicMachine Forum
Strange modbus scaling - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Strange modbus scaling (/showthread.php?tid=6354)



Strange modbus scaling - Ceros2112 - 17.03.2026

Hello,

I have a modbus device that scales values in a strange way and I don't know how to make it work, if possible, with LM5.
Basically the formula is: (value+5)*2+30, in other words it reads values from -20 to 100 and represents values from 0 to 240

so, for example, if the value read by the instrument is -20, via modbus I will read 0.

Any ideas on how to integrate it in a json modbus profile?


RE: Strange modbus scaling - admin - 17.03.2026

value_base = -20
value_multiplier = 0.5

Formula:
value = value_base + value * value_multiplier
value = -20 + value * 0.5

If read value is 0 the resulting value is -20. If read value is 240 the resulting value is 100.


RE: Strange modbus scaling - Ceros2112 - 17.03.2026

thanks! I've tried it before but I must have done something wrong