Quadrature Encoder Interface for motion control with resistance to jitter and chatter on AB signals and motor vibrations
Quadrature Encoder Interface for Motion Control.
A class to decode pulses on a rotary encoder with AB signals (quadrature encoder). It uses all 4 edges of the AB signals to increase the counter resolution 4 times of cycles per rotation/revolution (CPR) (e.g. an encoder with 500 CPR get 2000 counts per rotation)
In opposite to most common QEI implementation this is resistant to jitter and chatter on AB signals and motor vibrations. When using interrupts (IRQ_NO_JAMMING-mode) only the needed edge and pin is activated to prevent jamming CPU time with unnecessary interrupts. Whes reaching the next position the edge that triggerd this position (state) is ignored to aboid oscillating up/down counts.
It can also be used in polling mode i.g. in idle routines if interrupts are not desired. At this mode be sure that the sampling frequency is heigher than the maximum rotation speed (expeced counts per second)
The internal state machine is based on a look up table (LUT) to minimize interrupt retention time and get all necessary flags at once.
Additional the rotation speed of the encoder can be measured. The algorithm is based on the measuring time between the edges to get a very precise speed at very slow rotation.
The library is designed to support closed loop speed- and motion-controller for also slow and smooth motions like movie camera motion control.
Quadrature Encoder Signals:
(+) Count UP; (-) Count DOWN
Revisions of QEIx4.h
|2:c0b87b11b9cd||2014-10-01||replaced virtual functions by attached functions; added documentation||File Diff Annotate|
|1:ac6b7b1bf6c5||2014-09-30||Added speed measurement; improved state machine and irq handling||File Diff Annotate|
|0:46b8d5680f66||2014-09-02||Added documentation||File Diff Annotate|