Quote:
|
Originally Posted by virusmirusne
Mr. Barello:
Have you successfully read quatrature encoders with the IFI?
The super high resolution with the wheel encoders is nice... but our team is having difficulties reading the second output pin on the wheel encoders. Do we not have access to these input pins? What would be the purpose of Process_Data_From_Local_IO() if it weren't to make it so as we could read digital io real-time. Why no real-time input reads if interrupts? We only seem to be able to read the direction of the wheel encoder if we spin the encoder shaft really, really slowly.
Any suggestions?
|
The local io loop is very fast. I think I clocked it at a mere 29 cycles (doing nothing else, of course) which is many hundred thousand times per second.
HOWEVER, that isn't guarenteed! Once every 26.2 ms the main loop fires off and who knows how long that will take.
So I ran my encoder stuff off the PORTB 4-7 interrupt lines (IFI digital inputs 2-5), enabled the port B change interrupt so it interrupts whever any line changes.
When choosing encoders & such, keep in mind that the IFI CPU can only handle around 5-8 thousand counts/sec each for two encoders. So figure out how many RPM, how many slots (multiply by four for quadrature) and do the math. If you are substantially higher than 10k/sec total, then re-think.
I posted my quadrature code (including interrupt setup) in the thread about Yaw sensors.