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!
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.
With Best Regards,
Jozef
Hi Eric,
you are very welcome.
With Best Regards,
Jozef