0
votes

I' trying to decode data sent via RF by a weather station. Unfortunately, the data representation isn't in standard binary way (0000, 0001, 0010, 0011, ...). What I've found is the following scheme:

value    representation
0     => 0xff = 0b11111111
1     => 0x00 = 0b00000000
2     => 0x01 = 0b00000001
3     => 0xfe = 0b11111110
4     => 0x03 = 0b00000011
5     => 0xfc = 0b11111100 
6     => 0xfd = 0b11111101
7     => 0x02 = 0b00000010
...

Or broken down to the bits:

value: 0       8       16      24
       |       |       |       |
Bit 0: 1010101010101010101010101010 ...
Bit 1: 1001100110011001100110011001
Bit 2: 1001011010010110100101101001
Bit 3: 1001011001101001100101100110
Bit 4: 1001011001101001011010011001
Bit 5: 1001011001101001011010011001
Bit 6: 1001011001101001011010011001
Bit 7: 1001011001101001011010011001

Each bit seems to follow a certain pattern of mirroring and inversion of the preceding, e.g. bit 3 = 10 01 0110 01101001

What is that kind of encoding called like, and how to easily convert it to a standard binary form?

1
I think in electronic sister site you may get better answers: there are many way to encode data, they will find out.Giacomo Catenazzi

1 Answers

0
votes

It looks like the LSB pattern is periodic with period 2 (10 repeated), the next bit is periodic with period 4 (1001 repeated), and presumably the bit before that has period 8 (10010110 repeated).

This is somewhat similar to the normal representation, of course, except that usually the repeating patterns are 01, 0011, 00001111 etcetera.

It seems the pattern 1001 is created by copying 10 and inverting the second copy. Similarly, the pattern 100100110 is created by copying and inverting 1001. Hence, the next pattern of period 16 would be 10010011001101001.

Now, how are these patterns related?

For the lowest bit, 10 repeated is 01 repeated XOR (11). Simple.

For the next bit, 1001 repeated is 0011 XOR (1010) repeated - and note that the LSB pattern was 10 repeated.

After that, we get 10010110 repeated which is 00001111 XOR (10011001) repeated. See the pattern?

So: You need to XOR each bit with the bit to its right, starting from the MSB.