Free H48C Accelerometer for first person to solve this problem
somethingburning
Posts: 2
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
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?
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
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Powered by enthusiasm
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 Savage
Parallax Engineering
50 72 6F 6A 65 63 74 20 53 69 74 65
·
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
Line numbers - In the editor under edit, click preferences, click Editor Appearance tab, check the box that says show line numbers.
Brad