MMA6827

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

MMA6827

598 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
1 Reply

578 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Zhang,

SPI transfers are completed through a sequence of two phases. During the first phase, the type of transfer and associated control information is transmitted from the SPI master to MMA68xx. Data from MMA68xx is transmitted during the second phase.

SPI Communications MMA68xx.png


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply