Shop OBEX P1 Docs P2 Docs Learn Events
Memsic 2125 and BS2p — Parallax Forums

Memsic 2125 and BS2p

ArchiverArchiver Posts: 46,084
edited 2003-09-14 22:39 in General Discussion
I am trying to use the 2125 with a BS2p instead of the BS2 which all
the example code is for. Can anyone out there give me example code
for measuring tilt using the 0.75 us resolution of the BS2p instead
of the 2 us res of the BS2?

Trent

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-09-14 22:25
    Hi,
    Thanks for the clarification on rotation.

    You can download the memsic example programs for bs2 here
    <http://www.parallax.com/detail.asp?product_id=28017>
    and make the necessary adjustments for bs2p.

    To get acceleration this algorithm is used:
    A(g) = ((T1 / T2) * 0.5) / 12.5%
    Where T2=10ms.

    On the BS2 it looks like this:

    Read_X_Force:
    PULSIN Xin, HiPulse, xRaw
    xGForce = ((xRaw / 5) - 500) * 8
    RETURN
    Where xRaw=T1 5=T2*2µs(for bs2) and 500=500µs=.5ms and 8=1/12.5

    So the only number that needs to be adjusted is the one that represents T2.
    It should be 13.3333 for the bs2p's .75µs periods (13.33333 * .75 = 10). You
    can multiply both sides of the fraction by 3 to get rid of the decimal.

    For a BS2p Try this:

    Read_G_Force:
    Pulsin Xin,HiPulse,pulse
    xmG = (((pulse * 3) / 40) - 500) * 8
    Pulsin Yin,HiPulse,pulse
    YmG = (((pulse * 3) / 40) - 500) * 8
    Return

    I'm not a hundred percent on this, but a similar adjustment is working for
    me on the .8µs BS2sx.

    Cheers,
    Nick



    on 09/14/03 4:29 PM, ScoobyTW at scoobytw@y... wrote:

    > I am trying to use the 2125 with a BS2p instead of the BS2 which all
    > the example code is for. Can anyone out there give me example code
    > for measuring tilt using the 0.75 us resolution of the BS2p instead
    > of the 2 us res of the BS2?
    >
    > Trent
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    > of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-09-14 22:39
    That did it! Thanks for the help.

    Trent

    --- In basicstamps@yahoogroups.com, nick stedman <nickstedman@s...>
    wrote:
    >
    > For a BS2p Try this:
    >
    > Read_G_Force:
    > Pulsin Xin,HiPulse,pulse
    > xmG = (((pulse * 3) / 40) - 500) * 8
    > Pulsin Yin,HiPulse,pulse
    > YmG = (((pulse * 3) / 40) - 500) * 8
    > Return
    >
    > I'm not a hundred percent on this, but a similar adjustment is
    working for
    > me on the .8µs BS2sx.
    >
    > Cheers,
    > Nick
    >
Sign In or Register to comment.