READ DATA OF MMA8452

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

READ DATA OF MMA8452

621 Views
594160903
Contributor I

    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); //

}

0 Kudos
Reply
1 Reply

393 Views
david_diaz
NXP Employee
NXP Employee

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:

  • Changing the operational modes (Standby, Active 2g, Active 4g and Active 8g)
  • Changing Oversampling Modes
  • Changing the Data Rate
  • Changing the High-Pass Filter Cutoff Frequency
  • 8-bit data vs. 14/12/10-bit data
  • Changing Data Formats (hex to counts to decimal numbers)
  • Streaming XYZ data polling vs. Streaming XYZ data with interrupts
  • Using the FIFO in the MMA8451

 

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

0 Kudos
Reply