Shop OBEX P1 Docs P2 Docs Learn Events
Free H48C Accelerometer for first person to solve this problem — Parallax Forums

Free H48C Accelerometer for first person to solve this problem

somethingburningsomethingburning Posts: 2
edited 2009-12-10 02:59 in BASIC Stamp
I posted the message below ("I'm a newbie")·a couple of weeks ago and no one replied.· I then bought a new H48C Accelerometer from·Parralax and it did the same thing, so it must be in my code.· I·then sent the message to Parallax customer service and they didn't reply either.· So I now have 2 of them, but no good code for determining G's.

I offer the extra Accelerometer to the first person who can find my problem or has good code for determining positive and neg Gs with this Accelerometer and a Stamp2.·

I am the sole judge as far as who, if any, deserve·the prize.

My faulty program is attached.· Reply privately.

Regards, and may the best Geek win,

Somethingburning jumpin.gif


I'm a newbie.· I bought a H48C Accelerometer module used (ebay) and programmed my Stamp2 with the code from the manual, parallax.com/Portals/0/Downloads/docs/prod/acc/HitachiH48C3AxisAccelerometer.pdf.·

The debugger displays perfectly and the counts for the all 3 axis seem to be correct, but my Vref counts are all over the place.· Shouldn't this be relatively constant?· When the board is at rest, rightside up, the vref·toggles·between·128 and then 7296 counts everytime the "Get_H48C" subroutine is called. When tilting the project board,·Vref goes all over the place, although all the axis counts respond as I think they should.

I figured the problem·was in the shiftout/shiftin code of the subroutine, but I have checked it against the manual until·I am crosseyed.· Do I have a bad Accelerometer?

Comments

  • Brad_HBrad_H Posts: 35
    edited 2009-12-09 03:30
    I don't know if any of these are the cause of your problem but I did spot a few·differences·between your code and the sample code.

    line 25··· dpad VAR Word· '====== should be Nib NOT Word

    line 90··· RETURN '========= need "HIGH cs" before the RETURN

    line 93··· LOOKDOWN dvalue, >=[noparse][[/noparse]10000, 1000, 10, 0], dpad· '======== missing 100
  • SRLMSRLM Posts: 5,045
    edited 2009-12-09 04:05
    I would start by simplifying your code to get rid of the complicated debugging code. Write some lines that simply outputs vref \n axis \n vref \n axi ... etc. without worrying about cursor position and all that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2009-12-09 04:48
    somethingburning,

    I'm with Brad, but I think the one thing that's causing most of the problem, is the lack of a 'HIGH cs' command just before the RETURN in you 'Get_H48C' subroutine.


    After a data transfer, the Get_H48C needs a little down time. Making the cs pin HIGH does this. What happens without it is that the next time around when the 'Get_H48C' subroutine is called and trying to read Vref, it's still trying to get closure from the previous accelerometer axis value because it didn't get the 'HIGH cs'.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-09 23:31
    As a note you shouldn't post a new duplicate thread when you don't get an answer. Instead you should follow up on your original post and see if there's something you can add or eleborate on which might incite a reply. You other message has been deleted but you should definitely read up on the forum rules just for clarification. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • somethingburningsomethingburning Posts: 2
    edited 2009-12-10 02:08
    Dear Brad_H

    You the man! The missing "High CS" was the problem. Send me your address by Private Message and I'll send you the Accelerometer with my gratitude. I hope you don't live in Tierra del Fuego or in Micronesia.

    BTW, how do you know the line numbers?

    Dear P. by E.

    I agree completely about the complex debugging format. By the time I got that to work I was too burned out to find other problems. The whole thing was a little complicated for a rookie like me, but I didn't feel comfortable modifying it until I got it to work. An alternate sample code in the manual would be nice.

    Chris,

    Sorry for the new thread. I needed a zingier subject line to entice the big brains. As far as additions and elaborations and incitations, of course, I did that.

    Thanks and Regards to all,

    Somethingburning
  • Brad_HBrad_H Posts: 35
    edited 2009-12-10 02:59
    Happy to help.

    Line numbers - In the editor under edit, click preferences, click Editor Appearance tab, check the box that says show line numbers.

    Brad
Sign In or Register to comment.