9 Quadrature Encoder Interface of PIC32MK MCU

The Quadrature Encoder Interface peripheral on the PIC32MK MCU is a 32-bit up and down counter, which is incremented and decremented by leading or lagging quadrature signals as shown in Encoder Phase Signals and Index Pulse for Certain Direction of Rotation and Encoder Phase Signals and Index Pulse for Opposite Direction of Rotation. The following are the key features of the QEI peripheral on PIC32MK.

  • Four inputs are as follows:
    • QEA, QEB: Phase A and Phase B quadrature signals of the encoder
    • INDX: Index pulse input, when asserted it resets the position counter
    • HOME: Home input, when asserted it loads the position count with “Home” position value
  • Programmable digital noise filters for inputs
  • 32-bit Position Counter
  • 32-bit Velocity Counter
  • Interval timer: Measures the duration of the quadrature pulses. This allows high resolution speed measurement at low speeds.
  • Modulo Count mode: The position counter is loaded with the contents of the QEIxLEC register when the position counter value equals the QEIxGEC register value and a count up pulse is detected. The counter is loaded with the contents of the QEIxGEC register when the position counter value equals the QEIxLEC register value and a count down pulse is detected.