Specifications

Quadrature Encoder Pulse (QEP) Circuit
6-78
6.9 Quadrature Encoder Pulse (QEP) Circuit
Each Event Manager module has a quadrature encoder pulse (QEP) circuit.
The QEP circuit, when enabled, decodes and counts the quadrature encoded
input pulses on pins CAP1/QEP1 and CAP2/QEP2 (in case of EVA) or
CAP4/QEP3 and CAP5/QEP4 (in case of EVB). The QEP circuit can be used
to interface with an optical encoder to get position and speed information from
a rotating machine. When the QEP circuit is enabled, the capture function on
CAP1/CAP2 and CAP4/CAP5 pins is disabled.
6.9.1 QEP Pins
The two QEP input pins are shared between capture units 1 and 2 (or 3 and 4,
for EVB), and the QEP circuit. Proper configuration of CAPCONx bits is re-
quired to enable the QEP circuit and disable capture units, thus assigning the
associated input pins for use by the QEP circuit.
6.9.2 QEP Circuit Time Base
The time base for the QEP circuit is provided by GP timer 2 (GP timer 4, in case
of EVB). The GP timer must be put in directional-up/down count mode with the
QEP circuit as the clock source. Figure 6–33 shows the block diagram of the
QEP circuit for EVA and Figure 6–34 shows the block diagram of the QEP cir-
cuit for EVB.
Figure 6–33. Quadrature Encoder Pulse (QEP) Circuit Block Diagram for EVA
2
CAPCONA[13,14]
2
2
2
QEP
decoder
logic
GPT2 clock
GPT2 dir
T2CON[4,5]
TDIRA
CLK
DIR
CAP1/QEP1
CAP2/QEP2
GP timer 2
Prescaler
T2CON[8,9,10]
CLKOUT
CLKIN
2
Capture
unit 1,2
M
U
X
M
U
X
M
U
X
2