© 2004 Microchip Technology Inc. DS70063C-page 16-21
Section 16. Quadrature Encoder Interface (QEI)
Quadrature Encoder
Interface (QEI)
16
16.11 Design Tips
Question 1: I have initialized the QEI, but the POSCNT Register does not seem to
change when quadrature signals are applied to the QEA/QEB pins.
Answer: On many devices, the QEI pins are multiplexed with analog input pins. You will need to
ensure that the QEI pins are configured as digital pins using the ADPCFG control register.
Question 2: How fast may my quadrature signals be?
Answer: The answer depends on the setting of the filter parameters for the quadrature signals.
QEI requires that quadrature signals frequency must be less than F
CY/3 when no filter is used
and Filter Frequency/6 when a filter is used.
Question: 3 My encoder has a 90° Index Pulse and the count does not reset properly.
Answer: Depending on how the count clock is generated and which quadrature state transition
is used for the index pulse, a 1/4 cycle index pulse may not be recognized before the required
transition. To fix this, use a filter on the quadrature clocks which has a higher filter prescaler
than that of the index pulse. This has the effect of delaying the quadrature clocks somewhat,
allowing for proper detection of the index pulse.
Figure 16-11: Reset by Index Mode (90° Index Pulse) – Up/Down Position Counter
POSCNT
QEA Filter
QEB Filter
UPDN
count_clock
00E4
00E2
Recognize Index
POSCNT set to MAXCNT
Generate QEI Interrupt
Wheel
Reverses
INDX
2
3 4 1 2 3 4 1 2 2 1 4 3 2 1 4 3 2 1 4 3 2
Quadrature
State
0000 0001 0002 0003 0002 0001 0000 00E4 00E3
Recognize Index
POSCNT set to 0000
Generate QEI Interrupt