I have a requirement to encode 32bit signed integer in two consecutive modbus 16bit register. The requirement say that the byte order should be little endian and the lower address register should be the low word.
Which would be the resulting byte order in a tcp stream?
Suppose I want to send the number 287.454.020.
Written as "natural" hexadecimal number that would be:
0x11223344
If I understand that correctly I would think that applying low and high word results in:
Regsiter 0: 0x3344 // low word
Register 1: 0x1122 // high word
When I now apply the little endian byte ordering I end up with:
Regsiter 0: 0x4433 // low word
Register 1: 0x2211 // high word
So in the TCP stream that would be:
44 33 22 11
However the receiver seems to be expecting the following order:
33 44 11 22
But wouldn't that rather be big endian?
I think the ordering the receiver expects is supposed to be called Mid-Little Endian.
Can someone clarify?
However the receiver seems to be expecting the following order:
33 44 11 22
What you're describing is a device that expects the words to be swapped, but the byte order of the words to remain unchanged.
Unfortunately goofy stuff like this is not uncommon in the Modbus world. Just swap the words. Multi-word types don't exist as far as the Modbus spec is concerned so it's really the wild west out there.