Quote:
|
Originally Posted by Abwehr
www.kevin.org/frc. Check the encoder code...a gear-tooth sensor really isn't much different, aside from how it keeps track of direction.
Keep us posted on how those gear-tooth sensors work. We've been able to use them in the past to get a good reading of raw speed, but direction is another beast altogether. Measuring the pulse width seems difficult given the overhead of interrupt calls and other factors.
|
Is your interrupt overhead still bad? We had excellent results timing the sensors using external interrupts. If you continue to have trouble, you can always use an external processor that has capture capabilities.
This year you also have the ability to time an event (using dig input 02 and the ECCP module in capture mode). In addition, you can use dig input 14 to count events on timer 1 or 3.
Just a few possibilities. They are quite limited because almost all of the pins related to useful modules on the processor are not exposed.
I think the most reliable way to approach this is with an external processor that has all of it's modules available. If you are using a quadrature encoder (like the ones that Kevin suggests on his site), then Microchip has processors that can decode that signal for you (I think those processors can decode 3 of those signals simultaneously in hardware). Since it decodes it for you, it counts in the registers. There's no worry about latency. It just happens in hardware. When you want to know how many you have, just go read it.
There are many possibilities, but the external interrupts on the RC should be good enough to measure for the direction.
Cheers!
-Joe