Retrieving and converting information from Int64 Registers


Thread Starter

Gavin Hill

I'm new to modbus and am trying to query a power meter. I've managed to handle the retrieval of Int32 and Float data, but my meter also has some Int64 registers that I'm struggling with.

I can retrieve 4 registers:
-- Polling slave... (Ctrl-C to stop)
[3204]: 0
[3205]: 0
[3206]: 336
[3207]: 7261

These numbers should somehow convert to 22025400Wh or 22025.4kWh (or close to that, the registers have obviously changed slightly since I physically read the meter)

I can't for the life of me work out how to shift these numbers to convert them to an Int64 that looks like the figure I'm looking for.

Could anyone offer some advice please?

Jerry Miille

I am betting that you would convert as follows:

Reverse the words and order 336 7261 0000 0000 = 150 1C5D 0000 0000 hex = 22027357 decimal which is just 1957 difference.

Jerry Miille
>I can retrieve 4 registers:
>[3204]: 0
>[3205]: 0
>[3206]: 336
>[3207]: 7261
>These numbers should somehow convert to
>22,025,400 Wh

The math is... (336 x 65536)+7261 = 22,027,375