MMA6827

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

MMA6827

972 Views
Zhang_123
Contributor II

I am writing the driver for the MMA6827 and am currently in the driver code for the MMA6800 in the reference TWR_SENSOR_PAK_AUTO_PROJECT

void MMA6800_Read_Acceleration(word cfgX,word cfgY)
{
word tmpx,tmpy;

(void)MMA6800_RegRead(MMA6800_DEVSTAT); //READING DEVSTAT
MMA6800_Delay(10);
(void)MMA6800_AccRead(cfgX); // AccXCfg7 X-Axis Raw, Unsigned Data, Disabled/PCM 0b0011000000000100
MMA6800_Delay(10);
xy_digits.x_dgt = MMA6800_AccRead(cfgY); //SENDING ACCELERATION READ COMMAND 2
MMA6800_Delay(10);
xy_digits.y_dgt = MMA6800_RegRead(MMA6800_DEVSTAT); //READING ACCELERATION 2
MMA6800_Delay(10);

in the previous code,xy_digits.x_dgt = MMA6800_AccRead(cfgY); Is the configured Y-axis data assigned to the X-axis? How to understand this code? Thank you so much!

0 Kudos
Reply
3 Replies

949 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Hi Eric,

please see below an answer from an application engineer I have contacted.

DESCRIPTION

The response to the first command happen during the second command is being sent and that is the reason for this.

Row 424, a read sensor channel X command is sent the response to this command is captured in row 426.

On row 426 a read sensor channel Y command is sent and the response to the command is captured in row 428.

 

In that function, while DEVSTAT register read command are sent the response to this command is never captured and used as dummy command.

JozefKozon_0-1680066974030.png

 

With Best Regards,

Jozef

0 Kudos
Reply

935 Views
Zhang_123
Contributor II

Thanks a lot!

0 Kudos
Reply

932 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Hi Eric,

you are very welcome.

With Best Regards,

Jozef

0 Kudos
Reply