View Single Post
  #8   Spotlight this post!  
Unread 02-02-2004, 23:07
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: Problems counting encoder pulses

Quote:
Originally Posted by kc8nod
Even if your code is running in user_routines_fast.c you can still miss pulses. Remember that everything comes to a screeching halt when it is time to run the Process_Data_From_Master_uP(). The most reliable way to count pulses is with an interrupt-driven routine. Perhaps you could look at Kevin Watson's example code at http://www.kevin.org/frc/
But if you really are turning the shaft very slowly (much greater than 26ms between pulses) it sound like you've got some other bug.
Why not post the code here?
Yes, there is an example written for the EDU-RC that should be easilly ported to the FRC-RC. Just drop encoder.c/.h into your project and modify user_routines_fast.c to call the interrupt handlers. The interrupt handlers are very efficient and should have no problem with many hundreds of counts per second (I've successfully done five thousand/sec).

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