Logic Machine Forum
Modbus combine 2 registers - 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 combine 2 registers (/showthread.php?tid=4073)



Modbus combine 2 registers - thomasoppida - 01.06.2022

Hi,
I am doing a modbus integration of a deltaohm weatherstation. 

For rainfall we have 2 modbus adresses (24,25) unsigned 16 bits registers. To get this right the manual says "The
amount of rainfall measurements are 32-bit integer values. Two consecutive 16-bit registers
must be accessed to read a measurement."

How do I do this? Is it possible to set it up in the modbus profile? 

KR
Thomas


RE: Modbus combine 2 registers - admin - 01.06.2022

Set datatype field to "uint32". You can use read test feature before creating the profile to check if different byte/word swap is needed.


RE: Modbus combine 2 registers - Christian_EWW - 28.06.2022

If you read the whole data as array, you can use logic and shift to combine the two registers.
temp = bit.bor(bit.lshift(data[24], 16), data[25])