Shop OBEX P1 Docs P2 Docs Learn Events
Accelerometer help — Parallax Forums

Accelerometer help

damiondamion Posts: 39
edited 2005-11-09 14:16 in BASIC Stamp
getting values of 6500 for xy axis data with memsic accelerometer. The pdf that i have says that I should be getting value in the area of 2500, any help?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-08 03:41
    Which BASIC Stamp version are you using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • damiondamion Posts: 39
    edited 2005-11-08 08:08
    I'm using the bs2p
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-08 13:30
    That explains it; the BS2p is much faster than the BS2 (for which the demo was written) so you have to scale the input pulse width differently.· In the original progam, you should have a line that looks like this:

    · xRaw = xRaw * 2

    You need to change that to:

    · xRaw = xRaw */ $0CC

    The */ operator lets us multiply by fractional values, and $0CC represents 0.8 for the BS2p

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • damiondamion Posts: 39
    edited 2005-11-08 17:53
    thanks
  • damiondamion Posts: 39
    edited 2005-11-09 06:29
    ok so I realized that the code I'm using doesn't have that line of code. I did find the code for g force that has that line in it but, the pdf that I have has a simple x/y axis program.I'm still trying to understand the language for the g-force program. I understand about bringing the xraw var to scale, but the only var in this program are x and y. any help would be great
  • NewzedNewzed Posts: 2,503
    edited 2005-11-09 13:49
    I have a program for the Memsic which I will share with you if you think that will help.· The program displays the following data when running:

    X Axis:· 5024·· 0.016 g···
    Y Axis:· 5006·· 0.000 g···

    The first number in each line is the true raw pulse width in us, the second the g-force and the third the degrees of tilt from a horizontal plane.· The program contains a conditional compilation that lets the program run on any Stamp without having to·change·the program.· A perfect 50% duty cycle would display 5000 and 5000, so you can see the duty cycle is very, very close to 50%.

    The program has been modified so that if the current reading is the same as the previous reading, then it skips the display and goes back for another reading.· It has been further modified to display the reading every 50 program cycles, regardless of whether the readings are the same or not.

    If you would like the program just let me know and I will post it.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-09 14:16
    I've attached a version of that program that will work with any BS2 module -- it adds conditional statements that scale the input based on the module type.· Since this program scales the input to 1 microsecond units, it's a little easier to see the g-force formula implemented.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.