offset it a byte value
FIRSTLY and most importantly, MODBUS registers are 16 bit values (2x 8bits) - bear that in mind for then following info...
In this particular part, we read 52 WORDS (16 bit values) (AKA 104 bytes) starting at address item 31447
therefore...
if START ADRRESS = 31447 and we get a 16 bit value then
- byte 0 is lower 8 bits (lo byte) of 31447
- byte 1 is the high byte (another 8 bits) of 31447
so the next value in 31448 MUST BE...
- byte 2 is lower 8 bits (lo byte) of 31448
- byte 3 is the high byte (another 8 bits) or 31448
NOW - you need 32 bit values (i.e. addresses 31447 and 31448 make up the UINT32)
In other words, you need bytes 0
~ 3
to have the correct 32 bit value.
If you make the MODBUS read an ARRAY of 52 WORDS (AKA 104 bytes) then the very last byte is in position 103
Now, you need 4 bytes to make a 32 bit value so byte 100, 101, 102 and 103 are needed - hence the offset into the byte data is 100.
START ADRRESS = 31447
address | Index | byte offset | Reason |
---|---|---|---|
31447 | 0 | 0 | Start address + (index * 2 bytes) |
31448 | 1 | 2 | Start address + (index * 2 bytes) |
31449 | 2 | 4 | Start address + (index * 2 bytes) |
- | - | - | - |
31497 | 50 | 100 | Start address + (index * 2 bytes) |
Does this look familiar...
... ^ look at the buf parser byte offset i wrote for var
^
I wrote that out to help you but I guess you didnt take the time to absorb it
PS, read the built in help...