Specifications

Quadrature Encoder Pulse (QEP) Circuit
6-80
Quadrature Encoded Pulse Decoding Example
Figure 6–35 shows an example of quadrature encoded pulses and the derived
clock and counting direction.
Figure 6–35. Quadrature Encoded Pulses and Decoded Timer Clock and Direction
QEP0
QEP1
Quadrature CLK
DIR
6.9.4 QEP Counting
GP timer 2 (or 4) always starts counting from its current value. A desired value
can be loaded to the GP timer’s counter prior to enabling the QEP mode. When
the QEP circuit is selected as the clock source, the timer ignores the TDIRA/B
and TCLKINA/B input pins.
GP Timer Interrupt and Associated Compare Outputs in QEP Operation
Period, underflow, overflow, and compare interrupt flags for a GP timer with
a QEP circuit clock are generated on respective matches. A peripheral inter-
rupt request can be generated by an interrupt flag, if the interrupt is unmasked.
6.9.5 Register Setup for the QEP Circuit
To start the operation of the QEP circuit in EVA:
1) Load GP timer 2’s counter, period, and compare registers with desired val-
ues, if necessary.
2) Configure T2CON to set GP timer 2 in directional-up/down mode with the
QEP circuits as clock source, and enable the selected timer.
3) Configure CAPCONA to enable the QEP circuit.