Memsic 2125 code?


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Memsic 2125 code?

    It sounds like its in the right range, if I am understanding it right.

    414 - 494 = -80

    -80 * 8 = 640, or .640 g's

    ~60 * (640/10) = ~ -3840 or negative 38.4 degrees

    The ABS (absolutes) are used to keep the math working, while the check on xGForce.bit15 is used to detect if it is a negative number. I don't think you are overflowing with your * 20, but a quick check of the xRaw might be in order.
    http://www.scalerobotics.com

  2. #2
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: Memsic 2125 code?

    Hey Walter!
    Got it working! There was a line of code at the bottom XTilt = -XTilt that needed to be removed. The output from the sensor is in the 1800-2000 range so to multiply by 20 still keeps things under the 65536 limit so then a divide by 99 brings things back to "normal" range. Just as a "check" I bought a small digital level to use as a reference and there are errors over range of up to 3 degrees! Wish I had an ARCSIN function!

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts