Logic Machine Forum
modbus - negative values - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: modbus - negative values (/showthread.php?tid=5479)



modbus - negative values - Fahd - 21.06.2024

Hi!, 

I'm having trouble reading negative values (analog-value , Holding register) from a Modbus device using profiles. Specifically, I'm trying to read a value that should be -10, but I’m getting 65436 from the LM5.

Thanks in advance

{ "name": " Temperature Control Outdoor Air Curve Outdoor Air 1 Setpoint ", "bus_datatype": "float16", "type": "register", "address": 1100,"units": "°C" , "value_multiplier": 0.1, "writable": 1},


RE: modbus - negative values - Daniel - 21.06.2024

Did you try different datatype?


RE: modbus - negative values - admin - 21.06.2024

Default "datatype" is "uint16", you need to add "datatype": "int16" to your profile.


RE: modbus - negative values - Fahd - 21.06.2024

(21.06.2024, 09:57)admin Wrote: Default "datatype" is "uint16", you need to add "datatype": "int16" to your profile.
I change it to this (bellow) and still have the same issue 

{ "name": " Temperature Control Outdoor Air Curve Outdoor Air 1 Setpoint  ", "bus_datatype": "float16", "dataype": "int16" , "type": "register", "address": 1100,"units": "°C" , "value_multiplier": 0.1, "writable": 1},

{ "name": " Temperature Control Outdoor Air Curve Outdoor Air 2 Setpoint  ", "bus_datatype": "float16", "dataype": "int16" ,"type": "register", "address": 1101,"units": "°C" , "value_multiplier": 0.1, "writable": 1},


RE: modbus - negative values - Daniel - 21.06.2024

What is documentation saying about this register?


RE: modbus - negative values - admin - 21.06.2024

You have a typo in your profile field: dataype instead of datatype


RE: modbus - negative values - Fahd - 21.06.2024

(21.06.2024, 10:13)Daniel Wrote: What is documentation saying about this register?

Variable_Type : HoldingRegisters 
Variable_Index : 1100
Scale : - 1
Data_Type : 16bit signed
Access :  R/W
Unit :  °C
Range  : -300 to 450

(21.06.2024, 10:15)admin Wrote: You have a typo in your profile field: dataype instead of datatype

Thaaanks a lot