Logic Machine Forum
Modbus Json datatypes - Printable Version

+- Logic Machine 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: Modbus Json datatypes (/showthread.php?tid=5769)



Modbus Json datatypes - Intershade - 29.11.2024

Hi, 

I am, for the first time, creating a modbus json profile. And I have a question regarding how to correctly map a value of 20 bytes (10 registers) as a float.
When reading the product pdf manual I map all 4-byte values. See following example:
From pdf:
Address: 30001,
Descrption: "Line to neutral volts"
Lenght (bytes): 4
Data format: Float
Units: V
Hi byte: 00
Lo byte: 00

This would be mapped as such:
        {
            "address": 30001,
            "name": "Line to neutral volts",
            "read_count": 2,
            "bus_datatype": "float32",
            "type": "inputregister",
            "units": "V"
        }


But there are some values that have "Lenght" of 20 bytes. See example:
Address: 38193,
Descrption: "Total Last 1 month active Energy (Total, Rate1, Rate2, Rate3, Rate4)"
Lenght (bytes): 20
Data format: Float
Units: kWh
Hi byte: 20
Lo byte: 00

How would I mapp that? Should I create 5 separate mappings for  Total, Rate1, Rate2, Rate3 and Rate4. Assuming the addresses would be 38193 for Total and 38193+2 for Rate1 etc?
Or is there a way to map a large 10-register value?


RE: Modbus Json datatypes - Daniel - 29.11.2024

Start by using Read test to find correct settings. In your example do not use read_count only add "datatype": "float32", This defines how many registers will be read. One register is 2Bytes.
The 20Byte registers - check in read test if you can divide them in a smaller chunks.