01-25-2022 03:46 AM
Hi guys,
I need to log data from 25 devices using Schneider Acti9 PowerTag Link. I made application in LabVIEW which works well while I reading 32 bit Holding Registers (upload picture) with big endian transfer, but when I need to read Total Active Energy I have problem because it consist of 64 bit Holding Registers because I am not sure how to make correctly big endian format (as I made with 32 bit Holding Register) .
So please help!
01-25-2022 04:27 AM - edited 01-25-2022 05:05 AM
A single is 4 bytes (32 bits), so you definitely want to cast to a (8 byte, 64 bit) double.
IIRC, 64 bit floats (floats in general) are underspecified [EDIT: for modbus].
There's not just the byte ordering (big\little endian) but also the ordering of the words. So you can have 4 flavors, combining the byte ordering and word ordering:
1st word \ 2nd word (LE)
2nd word \ 1st word (LE)
1st word \ 2nd word (BE)
2nd word \ 1st word (BE)
If you post some data (and expected value) we can help.
01-25-2022 04:32 AM - edited 01-25-2022 04:35 AM
Simply read 4 registers and then combine them together with Join Numbers.
In your code, on the other hand, the decimate function is useless; furthermore, it only works for 32 bit values.
See the example below for both 32 and 64 bits:
EDIT: the device manual specifies it's an INT64 value, so you don't need to cast to a double.
01-25-2022 05:00 AM - edited 01-25-2022 05:06 AM
@pincpanter wrote:
Simply read 4 registers and then combine them together with Join Numbers.
In your code, on the other hand, the decimate function is useless; furthermore, it only works for 32 bit values.
The decimate is only useless if you have 1 64 bit value. Once you want 2 (or more) 64 bit values, it's quite convenient.
01-25-2022 05:07 AM - edited 01-25-2022 05:08 AM
EDIT: nevermind
01-25-2022 07:04 AM
I'd try this:
The 3 options can exist (should be tried) in all combinations. This information should be in the spec, but those can be cryptic.
If you need I64's, you can change the cast to I64.