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