Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Should I use a Pot or an encoder, and how? (http://www.chiefdelphi.com/forums/showthread.php?t=40499)

mallot1243 16-11-2005 21:48

Should I use a Pot or an encoder, and how?
 
I'm having a problem, I'm trying to figure how I would count the revolutions of the driveshaft in autonomous so I can create a simple distance = (2 * revolutions * 3.14159) equation. However, with the refresh rate I don't think I could correctly count revolutions without errors.

sanddrag 16-11-2005 21:52

Re: Should I use a Pot or an encoder, and how?
 
What you really should use is called a quadrature encoder and you can find some sample code for it on www.kevin.org/frc

Also, I think you need wheel radius in that equation. :)

bear24rw 17-11-2005 22:31

Re: Should I use a Pot or an encoder, and how?
 
Quote:

Originally Posted by mallot1243
However, with the refresh rate I don't think I could correctly count revolutions without errors.

I think that you need to use interups... that way the refresh rate of your user_routines wont matter...

Rickertsen2 18-11-2005 00:39

Re: Should I use a Pot or an encoder, and how?
 
You need to use encoders. Pots can only rotate a certian number of degrees before hitting their physical limits. If you search encoders on these forums you should find alot of good info.

sciguy125 18-11-2005 02:25

Re: Should I use a Pot or an encoder, and how?
 
Quote:

Originally Posted by bear24rw
I think that you need to use interups... that way the refresh rate of your user_routines wont matter...

An alternate method would be to use a hardware counter. Have the counter count the encoder ticks, then read them whenever you're ready. That way, timing doesn't matter at all. Well, I guess if you're trying to figure out speed you'd need to know the amount of time between reads...


All times are GMT -5. The time now is 04:31.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi