Question On MMA7660 Offset Calibration

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Question On MMA7660 Offset Calibration

ソリューションへジャンプ
1,729件の閲覧回数
wxb
Contributor I

Hi,

according to AN3841 "Performing Offset Calibration using theMMA7660FC"

//Hold MMA7660FC on horizontal plane, put it in active mode and get the shift value

X_Shift = (64 times reading sum)/64*(-2)

Y_Shift = (64 times reading sum)/64*(-2)

Z_Shift = ((64 times reading sum)/64-21) *(-2)


My question is how to get the X_shift,Y_shift and Z_shift?

Is obtained from the register of REG00-REG02?

ラベル(1)
1 解決策
1,393件の閲覧回数
reyes
NXP TechSupport
NXP TechSupport

Hi,

Correct, “(64 times reading sum)/64” is equal to get the average value in 64 reads of REG00 (for the example of X_Shift), so, for example, X_Shift would be the result of the average value of reading REG00 64 times *-2

Also could be seen as:

X_Shift = (sum of 64 times reading REG00)/64*-2

Y_Shift = (sum of 64 times reading REG01)/64*-2

Z_Shift = ((sum of 64 times reading REG02)/64-21)*-2

Does this make sense to you? Please let me know if still not clear.


Have a great day,
Jose Reyes

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

3 返答(返信)
1,394件の閲覧回数
reyes
NXP TechSupport
NXP TechSupport

Hi,

Correct, “(64 times reading sum)/64” is equal to get the average value in 64 reads of REG00 (for the example of X_Shift), so, for example, X_Shift would be the result of the average value of reading REG00 64 times *-2

Also could be seen as:

X_Shift = (sum of 64 times reading REG00)/64*-2

Y_Shift = (sum of 64 times reading REG01)/64*-2

Z_Shift = ((sum of 64 times reading REG02)/64-21)*-2

Does this make sense to you? Please let me know if still not clear.


Have a great day,
Jose Reyes

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,393件の閲覧回数
wxb
Contributor I

thinks for your reply,

    I want to reads the x-axis、y-axis and z-axis tilt angle as following codes ,if get reg00  is 22 ,can i think this time the x-aixs angle is 0 °?

    How to understand the MMA7660 Datasheet  "APPENDIX C - MMA7660FC ACQUISITION CODE TABLE" ,Angle X or Y blank meaning when 6-bit result is 22 - 42.

float TILT_XY[64] = {0, 2.69, 5.38, 8.08, 10.81, 13.55, 16.33, 19.16, 22.02, 24.95, 27.95, 31.04, 34.23, 37.54, 41.01, 44.68, 48.59, 52.83, 57.54, 62.95, 69.64, 79.86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -79.86, -69.64, -62.95, -57.54, -52.83, -48.59, -44.68, -41.01, -37.54, -34.23, -31.04, -27.95, -24.95, -22.02, -19.16, -16.33, -13.55, -10.81, -8.08, -5.38, -2.69};

int main()

{

    unsigned char x;

    float AngleX;

  

    //Device initialization

    // Reads the reg00

    x = MMA7660_GetResult(reg00);

    //Get the X-axis angle

   AngleX =  TILT_XY[x];

  

}

0 件の賞賛
返信
1,393件の閲覧回数
reyes
NXP TechSupport
NXP TechSupport

Hi,

Every g-force value bigger than +1g or lower than -1g cannot be converted in angle measurement since you would not be measuring “Static Acceleration” (used to measure tilt angulations), the reason is that the reference is the 1g from gravity force. If the value is bigger than +1g or lower than -1g, then an additional force called “Dynamic Acceleration” (movement for example) would be added to the formula, and no tilt angle measurement is possible for this case.

Now, the formula to calculate the angle according to the g-force measured is:

Angle = ASIN(g-value)*180/Pi

And it is not possible to calculate ASIN values for numbers bigger than 1 (or lower than -1).

*Remember that ASIN(1) = 90°

So, for values between 22 and 42 (in the 6-bit result column), there is no valid data angle (it is not 0 either). If you get a number between 22 and 42 it means that an external force (additional to the gravity force) is applied (linear movement for example), and if you get a number between 28 and 36 means that you should be shaking the device.


Have a great day,
Jose Reyes

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信