ganutenator
Lifetime Supporting Member
I am reading data via modbus from a third party device. All the bits are reversed, and I am wondering if there is a quick and dirty mathematical or logical way to reverse them.
For example. The bit pattern in my PLC for a 16 bit word is 1 through 16 from left to right with 1 being the most significant bit. The device that I am communicating with is 1 through 16 right to left with 16 being the most significant bit.
my PLC:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
3rd party device:
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
For example. The bit pattern in my PLC for a 16 bit word is 1 through 16 from left to right with 1 being the most significant bit. The device that I am communicating with is 1 through 16 right to left with 16 being the most significant bit.
my PLC:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
3rd party device:
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1