Previous in Forum: intrinsically safedetector   Next in Forum: Heli-Coil and anti-seize compound
Close
Close
Close
6 comments
Rate Comments: Nested
Anonymous Poster

Position Measurment on Incremental Encoder, using FPGA

04/19/2009 10:45 AM

I'm using an incremental encoder and FPGA on my thesis, and i need to get the position and also the speed.

Can anybody give me some good reference on where can i get some sample of the VHDL program??

Thanks a lot!! :)

Cheers,

Brian

Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".
Anonymous Poster
#1

Re: Position Measurment on Incremental Encoder, using FPGA

04/19/2009 4:09 PM

Isn't the whole point that you learn how to do this? Anybody can copy. If you really want to take the easy route then I would check with the Altera and Xilinx sites for example VHDL programs. The FPGA designers want to make it easy for the engineers to use their products. You should be able to get the basic VHDL encoder code that provides incremental positions there. The velocity part will be a little more difficult and I doubt anybody will give you that.

So what are you going to do when the encoder is turning very slowly?

Peter Nachtwey

Reply
Commentator

Join Date: Feb 2009
Location: Timisoara, Romania
Posts: 60
Good Answers: 4
#2

Re: Position Measurment on Incremental Encoder, using FPGA

04/20/2009 4:26 AM

When we studied FPGA in school we used a Xilinx Spartan chip. In the Xilinx ISE environment (you can download it for free from their web site) under Help they had tones of examples. Plus, be aware the program is pretty large, somewhere around several GBs.

I would imagine that since encoders are pretty common you could find some example that shows how to find the current position. The speed can be calculated from there, if you store the previous position and count the ticks from your clock between positions. I know its not actually that simple (for example, how do you define current position - when the encoder stops turning or you take a sample each 100ms?) and that may not be a bad thing, because you get to do some work and learn from it.

Hope it helps and success with your thesis!

__________________
Patricia_a
Reply
Anonymous Poster
#3

Re: Position Measurment on Incremental Encoder, using FPGA

04/20/2009 3:03 PM

thank you for the replies!! :)

But i have a few problems about the position. let's say i use the encoder maybe only 60 degree from the whole 360 degree of it to measure position change of a one dimensional throttle.

I need to devide the encoder into 2 parts (each 30 degree), the positive and the negative. then, i need to set the 0 value or may i say the reset..

the problem (which i just realized) is, i have no idea how to implement the reset because the encoder is incremental..

What can i do to deal with this problem??

Thx again and sorry about my bad english!! :D

anyway, i'm using an 1024 encoder with A, B, and Z as the clock, and also use the FPGA as a PID controller for a DC motor..

Reply
Member

Join Date: Oct 2007
Posts: 6
#4
In reply to #3

Re: Position Measurment on Incremental Encoder, using FPGA

04/20/2009 3:09 PM

sorry, this is me.. i forgot to login when i wrote this question..

Brian Angg

Reply
2
Commentator

Join Date: Feb 2009
Location: Timisoara, Romania
Posts: 60
Good Answers: 4
#5
In reply to #3

Re: Position Measurment on Incremental Encoder, using FPGA

04/21/2009 7:02 AM

If I understand well enough, "incremental" means you don't know the absolute position of the knob that you turn, you only know how much it was turned, right?

Then that means it sorta like the iPod shuffle - I can put my finger on any point and start "turning the wheel" and the volume or cursor goes up or down depending on the direction its turned, and on how long is the distance covered by my finger on the control.

So just create your own absolute value of the encoder's position. It shouldn't be a problem to use a variable in VHDL, is it? Also, if you can't physically limit your encoder (meaning not allow it to have a position that's out of your range), you'll have to that through software.

People call that engineering...

__________________
Patricia_a
Reply Good Answer (Score 2)
Member

Join Date: Oct 2007
Posts: 6
#6
In reply to #5

Re: Position Measurment on Incremental Encoder, using FPGA

04/21/2009 11:17 PM

iPod shuffle.. lol!!! yesss, of course!! :D

Thanks a lot, Patricia!!! you make my day a lot easier!!

i think my mind is just too tense with all the pressure of my thesis..

i'll post again when i come out with something or have more problems

Reply
Reply to Forum Thread 6 comments

Good Answers:

These comments received enough positive votes to make them "good answers".
Copy to Clipboard

Users who posted comments:

Anonymous Poster (2); brianangg (2); Patricia_a (2)

Previous in Forum: intrinsically safedetector   Next in Forum: Heli-Coil and anti-seize compound

Advertisement