Hello
I am using code warrior with processor expert, I am using the MMA8451Q Accelerometer library in PE. I printed 100 values of the accelerometer's reading in same position without even touching it, and programatically after 100 readings the mode changed from 2 to 4 and later 8G, but in all 3 sets of values the readings are differing for more than 250 values. but ideally all the 100 values should remain the same. So I want to know how to overcome this problem? I tried changing modes from 2g, 4g, 8g but in all three case the values are differing a lot so I wanted to know how to use these diff. modes ? some required piece of code I am posting below
#define MMA8451_I2C_ADDR (0x1D) /* I2C slave device address as set in the properties */
#define XYZ_DATA_CFG 0X0E
#define EIGHT_G 0X02
#define FOUR_G 0X01
#define TWO_G 0X00
after init function i used
GI2C1_WriteByteAddress8(MMA8451_I2C_ADDR, XYZ_DATA_CFG, EIGHT_G);
for data acquiring , in for loop I used
f_printf(&fp, "%d %d %d \n",MMA1_GetX(),MMA1_GetY(), MMA1_GetZ());
after 100 readings I again changed the mode and did the same.
I am attaching extracted data in different modes.ACC2, ACC4, ACC8 shows accelerometer readings in 2G, 4G, 8G mode.
Kindly look into the matter
Regards,
Amit Kumar
Original Attachment has been moved to: acc_readings.zip