View Single Post
  #24   Spotlight this post!  
Unread 10-12-2004, 16:01
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: encoder vs. motor

Shawn,


Quote:
Originally Posted by SlimBoJones
*hint: don't use two interrupts per encoder... to me external interrupts are more expensive than getting a higher resolution encoder. Last year, we had an interrupt or two to spare after we removed our IR after Pittsburgh. Next year, I know we WON'T have any spare external interrupts.
Actually, the code only generates one interrupt per "tick". This is the desired behavior. If you want to count two edges per "tick" (which is a cool idea), you can modify the interrupt service routine to toggle the edge the interrupt is sensitive to. You could also just use interrupts 3-6, which are sensitive to both edges.


Quote:
Originally Posted by SlimBoJones
I know it sounds crazy, maybe this advice comes a bit late, but buy an encoder with twice the resolution you expect to require.
I'm not sure I would do this. You should do the math beforehand and get an encoder that isn't overkill. You should optimize in the direction of lower counts per revolution.


Quote:
Originally Posted by SlimBoJones
It gave me a great opportunity to teach students about interrupts vs. polling, and the concepts of rising edges, falling edges and such. Even the whole concept of quadrature was quite interesting to them. Most didn't think it was that easy to figure out which way an encoder was spinning. In addition, we purchased an inexpensive mechanical encoder where we opened up the back, and you could physically see how the quadrature signal was generated with just a sweeping arm, and a few contacts.
I definitely learned a lot, and so did the students on 188.
Thanks. It really made my day reading this.


Quote:
Originally Posted by SlimBoJones
Thanks Kevin for your code! We used your IR code too =), and were very successful in our empty gymnasium, but weren't so successful on the actual playing field.
Yeah, I've heard this more than a few times over the last eleven months <grin!>.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org