# Need help on vhdl- accelerometer implementation. desperate!!

Discussion in 'Homework Help' started by jjzz, Apr 12, 2007.

1. ### jjzz Thread Starter New Member

Mar 12, 2007
3
0
i am trying to use an analog accelerometer to connect to an adc and then into a xilinx spartan 3e starter kit. but i have no idea how to convert the out put of the accelerometer which is in the form of voltages to distance using vhdl. if anyone can help it is greatly appreciated.

2. ### beenthere Retired Moderator

Apr 20, 2004
15,815
282
Your question is a bit hard to understand. You say you're using an A to D converter at first, and then you say you have no idea how to convert the analog voltage. That's the A to D's job.

After that, acceleration times time is distance. Sample frequently, and use the difference betwen sample times and the acceleration during that period to calculate distance travelled. Keep the interval short, and treat each acceleration reading as if it were uniform during the period between samples.

3. ### Papabravo Expert

Feb 24, 2006
10,021
1,757
Ahh...acceleration times time is velocity.
Code ( (Unknown Language)):
1.
2. S = So + Vot + (1/2)at^2
3.
4. WHERE
5. So is the initial position
6. Vo is the initial velocity
7.
at least it was the last time I did a unit analysis.

4. ### Dave Retired Moderator

Nov 17, 2003
6,960
144
To show acceleration times time equal velocity, you can represent it without the positional term:

v = u + at

v = Current velocity
u = Initial velocity
a = Acceleration
t = time

This clearly shows acceleration times time equal velocity.

Dave

5. ### Dave Retired Moderator

Nov 17, 2003
6,960
144
Velocity times time gives distance, therefore by integrating the acceleration and then times by the time you would ascertain the distance.

Dave

6. ### jjzz Thread Starter New Member

Mar 12, 2007
3
0
does anyone know how to write the code for that , my adc comes out with 14bits each time the accelerometer is analysed. how does the vhdl part go to have the output as distance? thank you guys... as i do not know how to write the code for this algo.

7. ### Papabravo Expert

Feb 24, 2006
10,021
1,757
You need to understand that vhdl is not a proceedural language for implementing algorithms. It is a hardware description language that can be used to synthesize hardware which can be used to implement algorithms. Where exactly is your head at that you ask questions like you do?

8. ### jjzz Thread Starter New Member

Mar 12, 2007
3
0
frankly i am just lost on how i can do this. please aid me. i have told you what i am trying to do. can you guide me? you have already told me how it can be done. but i do not know how to implement it. my deadline is coming up soon and i am panicking like hell.. please be patient withme.

9. ### Papabravo Expert

Feb 24, 2006
10,021
1,757
Why? You've made no effort to understand the purpose and utilization of vhdl. At this point in time there is really nothing that any of us can do for you.