Appropriate Method of Counting counts from a Quadrature Encoder

encoderinterruptsmbedsampling

I'm using an Mbed to drive a DC motor which will follow a trapezoidal trajectory.
What is the most appropriate way to determine position from the quadrature encoder?

Should I use interrupts, or is there a risk of the trajectory routine (which calculates theoretical position) falling behind?

Alternatively, I could poll/sample the encoder in fixed time steps, but I'd imagine this would miss out many encoder counts.

How is this problem usually dealt with?

Best Answer

It's best if you have quadrature encoder hardware to handle the encoder pulses, unless the speed is very low. Many microcontrollers have at least one such peripheral on the chip.

Related Topic