20.2 Architectural Overview

The Quadrature Encoder Interface (QEI) module provides the interface to incremental encoders for obtaining mechanical position data. Quadrature encoders, also known as incremental encoders or optical encoders, detect position and speed of rotating motion systems. Quadrature encoders enable closed-loop control of motor control applications, such as Switched Reluctance (SR) and AC Induction Motors (ACIM).

A typical quadrature encoder includes a slotted wheel attached to the shaft of the motor and an emitter/detector module that senses the slots in the wheel. Typically, three output channels, Phase A (QEAx), Phase B (QEBx) and Index (INDXx) provide information on the movement of the motor shaft, including distance and direction.

The two channels, Phase A (QEA) and Phase B (QEB), are typically 90º out of phase with respect to each other. The Phase A and Phase B channels have a unique relationship. If Phase A leads Phase B, the direction of the motor is deemed positive or forward. If Phase A lags Phase B, the direction of the motor is deemed negative or reverse. The index pulse occurs once per mechanical revolution and is used as a reference to indicate an absolute position. Figure 20-1 illustrates the Quadrature Encoder Interface signals.

The quadrature signals from the encoder can have four unique states (‘01, ‘00, ‘10 and ‘11) that reflect the relationship between QEA and QEB. Figure 20-1 illustrates these states for one count cycle. The order of the states get reversed when the direction of travel changes.

The quadrature decoder increments or decrements the 32-bit up/down Position Counter (POSxCNT) for each Change-of-State (COS). The counter increments when QEA leads QEB and decrements when QEB leads QEA.

Figure 20-1. Quadrature Encoder Interface Signals

Table 2-1 shows the truth table that describes how the quadrature signals are decoded.

Table 20-2. Truth Table for Quadrature Encoder
Current Quadrature StatePrevious Quadrature StateAction
QEAQEBQEAQEB
1111No count or direction change
1110Count up
1101Count down
1100Invalid state change, ignore
1011Count down
1010No count or direction change
1001Invalid state change, ignore
1000Count up
0111Count up
0110Invalid state change, ignore
0101No count or direction change
0100Count down
0011Invalid state change, ignore
0010Count down
0001Count up
0000No count or direction change

Figure 20-2 illustrates the simplified block diagram of the QEI module. The QEI module consists of decoder logic to interpret the Phase A (QEA) and Phase B (QEB) signals, and an up/down counter to accumulate the count. The counter pulses are generated when the quadrature state changes. The count direction information must be maintained in a register until a direction change is detected. The module also includes digital noise filters that condition the input signal.

Figure 20-2. Quadrature Encoder Interface (QEI) Module Block Diagram