UM10360 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2013. All rights reserved.
User manual Rev. 3 — 19 December 2013 544 of 841
26.1 Basic configuration
The QEI is configured using the following registers:
1. Power: In the PCONP register (Table 46
), set bit PCQEI.
Remark: On reset, the QEI is disabled (PCQEI = 0).
2. Peripheral clock: In the PCLKSEL0 register (Table 40
), select PCLK_QEI.
3. Pins: Select QEI pins through the PINSEL registers. Select pin modes for port pins
with QEI functions through the PINMODE registers (Section 8.5
).
4. Interrupts: See Section 26.6.4
. The QEI interrupt is enabled in the NVIC using the
appropriate Interrupt Set Enable register.
26.2 Features
This Quadrature Encoder Interface (QEI) has the following features:
• tracks encoder position.
• increments/ decrements depending on direction.
• programmable for 2X or 4X position counting.
• velocity capture using built-in timer.
• velocity compare function with less than interrupt.
• uses 32-bit registers for position and velocity.
• three position compare registers with interrupts.
• index counter for revolution counting.
• index compare register with interrupts.
• can combine index and position interrupts to produce an interrupt for whole and partial
revolution displacement.
• digital filter with programmable delays for encoder input signals.
• can accept decoded signal inputs (clock and direction).
26.3 Introduction
A quadrature encoder, also known as a 2-channel incremental encoder, converts angular
displacement into two pulse signals. By monitoring both the number of pulses and the
relative phase of the two signals, you can track the position, direction of rotation, and
velocity. In addition, a third channel, or index signal, can be used to reset the position
counter. This quadrature encoder interface module decodes the digital pulses from a
quadrature encoder wheel to integrate position over time and determine direction of
rotation. In addition, it can capture the velocity of the encoder wheel.
UM10360
Chapter 26: LPC176x/5x Quadrature Encoder Interface (QEI)
Rev. 3 — 19 December 2013 User manual