Generating BIT value from HEX numbers

 

If you have the command and data code for your NEC protocol in HEX format, then you need to convert these codes into the bit values used by the remote. Here is how to do it.

 

Example :

Command code = 856A

Data code = 97

 

To convert this to NEC BIT values, first you enter the HEX 856A into your favourite calculator program and convert it to binary.

 

856A = 1000010101101010, we split this into 2 bytes

 

Byte 1 = 10000101

Byte 2 = 01101010

 

And then since IR ptotocol sends bit with least significant bit first(at least NEC does), then we reverse each of the bytes. So we then have

 

Byte 1 = 10100001

Byte 2 = 01010110

 

So the first command part of the BIT value for TPF file is 10100001 01010110

 

Then it comes to the data value:

 

97 = 10010111, and then again we turn it around(least significant first) and get 11101001, this is then appended to the BITS value, and we now have 10100001 01010110 11101001, but since the NEC protocol requires the data code to be sent inverted directly after, we also append the value as inversed, that is change 0 to 1 and 0 to zero.

 

So when we inverse 11101001 we get 00010110, and this inversed value is then appended to the BITS value

 

The complete BITS value is then 10100001 01010110 11101001 00010110

 

This BITS value is then inversed, that is again, change 0 to 1 and 0 to zero, so

 

10100001 01010110 11101001 00010110 = 01011110 10101001 00010110 11101001

 

The code for the BITS value is then 01011110101010010001011011101001 without the spaces. However for the Beo remote to send the stop bit, we need to add a 1 to the end of the sequence.

 

So the final BIT sequence consists of 33 bits = 010111101010100100010110111010011

 

If you have any questions, then please contact me, I know this can be a bit tricky :)