The overhead required to bit-bang in a quadrature encoder is going to grind your EMX to a halt even using interrupts. You need to offload the pulse detection to a chip like:
Sorry that I wasn’t clear.
To answer the topic start, in my experience the standard encoder is the quadrature encoder.
5k pulses per second result in 14400 cycles @ 72 MHz, so a well tuned native interrupt handler would work nicely, though I am unexperienced in this platform
Native encoder support would help in a lot of smaller robotics projects, as is my project (I’m investigating for a prototype for what hopefully will result in a quantity of 70).
Adding another ic would complicate things quite a lot for me, though its probably a good solution for others.
BTW, I can’t find the RLP docs for writing an ISR in the wiki or Downloads & Tutorials, where should I look?
There is a routine for the LS7366 in the code part of this site.
Different to the LS7166, mentioned before, the LS7366 communicates through SPI not by physical IO.
Also the LS7366 has programmable DFLAG an LFLAG outputs, that can interrupt a processor.
@ jesse. thank you for your encoder code distribution, how responsive is the code? Is it possible for me to read 4-5 360ppr encoders simultaneously (2 channel) at 1rps each? I am so confused why is there an issue with program many high speed encoders using 72 Mhz board.
It wouldn’t be a problem if you were dealing with native code in real-time. But with .NET Micro you have delays that are not deterministic so even a 72MHz processor will not reliably catch digital inputs coming in that quickly. In my experience (senior design engineer of 6 years) these kinds of time sensitive tasks are best left to either dedicated hardware or 8-bit micros with no other task to handle.
Assuming that only one encoder is active at any given time…absolutely. If all five are asynchronous and operating at max RPM, probably not with an AVR 8-bit core. If you upgrade to the AVR32 you can definitely catch that many interrupts without them being synchronized.
If I were to use a dedicated uC for reading multiple quadrature decoders I would not even bother with using interrupts. Four encoders would only be eight data lines to poll, or more precisely one port, which can be done very quickly. If the uC has a built in timer you might even be able to use it to poll on a more periodic basis.