08.08.2022, 08:59
Modbus does not define word/byte order so there are 4 different ways of encoding an int64 value.
Try this:
And this:
Try this:
Code:
value = grp.getvalue('32/1/1')
raw = knxdatatype.encode(value, dt.int64).dataraw
r1 = raw:byte(1) * 0x100 + raw:byte(2)
r2 = raw:byte(3) * 0x100 + raw:byte(4)
r3 = raw:byte(5) * 0x100 + raw:byte(6)
r4 = raw:byte(7) * 0x100 + raw:byte(8)
register = 3204
mb:setregisters(register, r1)
mb:setregisters(register+1, r2)
mb:setregisters(register+2, r3)
mb:setregisters(register+3, r4)
And this:
Code:
value = grp.getvalue('32/1/1')
raw = knxdatatype.encode(value, dt.int64).dataraw
r1 = raw:byte(2) * 0x100 + raw:byte(1)
r2 = raw:byte(4) * 0x100 + raw:byte(3)
r3 = raw:byte(6) * 0x100 + raw:byte(5)
r4 = raw:byte(8) * 0x100 + raw:byte(7)
register = 3204
mb:setregisters(register, r4)
mb:setregisters(register+1, r3)
mb:setregisters(register+2, r2)
mb:setregisters(register+3, r1)