AnsweredAssumed Answered

FRDM - KL02Z - MMA8451Q 3-axis accelerometer

Question asked by Mark Adamson on Jul 7, 2014
Latest reply on Jul 9, 2014 by Mark Butcher

Hi,

 

I have managed to get the 3 - axis accelerometer working, using an 8 bit measurement. I actually followed a guide online: http://mcuoneclipse.com/2012/09/21/tutorial-accelerating-the-kl25z-freedom-board/

 

Its been very helpful. I wish to now use a 14 bit measurement using the same setup. I'm however having difficulties. I have setup a terminal using Putty, to display my xyz values so far for the 8 bit measurement.

 

 

I have been trying to edit the code myself, with the help of the data sheet for the accelerometer however the values I'm getting are incorrect.

 

My understanding from the online guide for the 8 bit measurement is that #define MMA8451_OUT_X_MSB 0x01, #define MMA8451_OUT_Y_MSB 0x03,#define MMA8451_OUT_Z_MSB 0x05 are being used to get the correct 8 bit measurement.

However, to get the 14 bit measurement, I must use the LSB values as well. I will end up having a 16 bit number, so I have to concatenate or mask (not sure if my terminology is correct) the values to get a 14 bit measurement.

 

Am I on the right track so far?

Any ideas how to get the 14 bit measurement to work??

 

Mark

Outcomes