D_A_V_E
Member level 5
Dear all,
I have a small problem here. I have a accelerometer, which read through I2C. the sensor data is 16bit two complement format and is store in 2 seperate registers(L and H). I am reading the data correctly and I would like to store the sensor data in an integer. So I am using the following routing.
acc_x_raw = (data.accelsH[1]) <<8) | data.accelsL[0];
But the result is not what I had expected. I think I am skipping a vital part here.....
Could anyone please tell me what I am doing wrong!!!
Thanks in advance
D
I have a small problem here. I have a accelerometer, which read through I2C. the sensor data is 16bit two complement format and is store in 2 seperate registers(L and H). I am reading the data correctly and I would like to store the sensor data in an integer. So I am using the following routing.
acc_x_raw = (data.accelsH[1]) <<8) | data.accelsL[0];
But the result is not what I had expected. I think I am skipping a vital part here.....
Could anyone please tell me what I am doing wrong!!!
Thanks in advance
D