
DR
AFT
DR
AFT
DRAFT
DR
D
RAFT
DRAFT
DRA
FT DRAF
D
RAFT DRAFT DRAFT DRAFT DRAFT D
DRAFT
D
RAFT DRA
FT DRAFT DRAFT DRAFT DRA
UM10360_0
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 00.06 — 5 June 2009
519 of 808
NXP Semiconductors
UM10360
Chapter 26: LPC17xx Quadrature Encoder Interface (QEI)
shows how quadrature encoder signals equate to direction and count.
4.1.2 Digital input filtering
All three encoder inputs (PhA, PhB, and index) require digital filtering. The number of
sample clocks is user programmable from 1 to 4,294,967,295. In order for a transition to
be accepted, the input signal must remain in new state for the programmed number of
sample clocks.
4.2 Position capture
The capture mode for the position integrator can be set to update the position counter on
every edge of the PhA signal or to update on every edge of both PhA and PhB. Updating
the position counter on every PhA and PhB provides more positional resolution at the cost
of less range in the positional counter.
The position integrator and velocity capture can be independently enabled. Alternatively,
the phase signals can be interpreted as a clock and direction signal as output by some
encoders.
The position counter is automatically reset on one of two conditions. Incrementing past
the maximum position value (QEIMAXPOS) will reset the position counter to zero. If the
reset on index bit (
RESPI
) is set, sensing the index pulse will reset the position counter to
zero.
4.3 Velocity capture
The velocity capture has a programmable timer and a capture register. It counts the
number of phase edges (using the same configuration as for the position integrator) in a
given time period. When the velocity timer (QEITIME) overflows the contents of the
velocity counter (QEIVEL) are transferred to the capture (QEICAP) register. The velocity
counter is then cleared. The velocity timer is loaded with the contents of the velocity
reload register (QEILOAD). Finally, the velocity interrupt (TIM_Int) is asserted. The
Table 463. Encoder direction
DIR bit
DIRINV bit
direction
0
0
forward
1
0
reverse
0
1
reverse
1
1
forward
Fig 127.Quadrature Encoder Basic Operation
PhA
PhB
direction
position
-1 -1 -1 -1
-1
-1
-1 -1 -1
-1
-1
-1 -1 -1
-1
-1 -1 -1 -1
-1
-1
-1 -1 -1
+1 +1 +1 +1 +1 +1 +1 +1