I have finally got to the point where I can read the SIRC sequence from a Sony remote using a a IR receiver. The remote I have outputs 12 bits, first, the 7 bits giving the command (power, play, volume up, ect...), and the last 5 bits are the device ID (VCR, DVD, TV, etc..).
So as I receive these values I save a '1' or a '0' in a string, but they are backwards.
For instance, pressing the play button sends (0,1,0,1,1,0,0,1,1,1,0,0).
So it sent the command ID as 0101100, and the device id as 11100.
But the command id's value is actually reversed, 0011010 = 26
the device id is actually 00111 = 7.
So I need to either not build these up in a string and instead calculate these values in reverse as they are coming in, or build up the value in a reverse loop, once for the command and once for the device.
Does anyone have any helpful information? I am not very good with binary arithmetic.