I am a rookie of using MMA8452, I want to read data of mma8452 to know the x,y,z;But I read data is always F and 4095,
please help me , thanks!!!
void Multiple_Read_MMA8452(void)
{
uchar i;
MMA8452_Start();
MMA8452_SendByte(0x38 )
MMA8452_SendByte(0x01);
MMA8452_Start();
MMA8452_SendByte(0x38 +1);
for (i=0; i<6; i++)
{
BUF[i] = MMA8452_RecvByte();
if (i == 5)
{
MMA8452_SendACK((BitAction)1);
}
else
{
MMA8452_SendACK((BitAction)0);
}
}
MMA8452_Stop();
Delay5ms();
}
void Init_MMA8452(void)
{
Single_Write_MMA8452(0x2A,0x01); //
Single_Write_MMA8452(0x2B,0x02); //
}
Hello,
Thank you very much for writing.
In this case, I’d like to recommend the application note AN4076 below:
Data Manipulation and Basic Settings of the MMA8451, 2, 3Q
This application note accompanies the MMA8451, 2, 3Q Driver Code and will explain the following:
Besides, you may use the sample project below as a reference for your application.
MMA8451Q - Bare metal example project
Please let me know if you have any further question.
Regards,
David