I am new to C programming and I am messing with a PIC breadboard project and trying to understand the code associated with the USB pc interface.
I think the output when read from the chip is binary format and is placed in the data_in array below. The following converts that input to a decimal value that represents the binary equivalent. Can anyone explain what this line of code is doing ?
Specifically the ">>" , "<<" and the "& 0x03" as well as the pipe (|) etc. I think the 0x03 etc are hexadecimal but I would like to understand what this is doing and how the relative values are chosen to have the desired effect of creating a decimal representation of a binary string.
return_data = (
((data_in >> 4) & 0x03) |
((data_in << 2) & 0x04) |
((data_in >> 3) & 0x18));