//must read all six registers plus one to move the pointer back to 0x03
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x3D); //read from HMC
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xh = i2cGetReceivedByte(); //x high byte
i2cWaitForComplete();
//printf(" %d", xh);
i need to know what is happening in the last line (xo = xl|(xh << 8)
i mean, the operation of the last line
if it shifts 8bits left, then xh will be '0' and 'xo' will be xl
That line converts a 16 bit number in the form of two bytes, a "high" byte and a "low" byte, back into a 16 bit number. It's pretty much the same as the following line;
That line converts a 16 bit number in the form of two bytes, a "high" byte and a "low" byte, back into a 16 bit number. It's pretty much the same as the following line;