dsPIC33FJ32MC302/304, dsPIC33FJ64MCX02/X04 AND dsPIC33FJ128MCX02/X04
17.0 QUADRATURE ENCODER
INTERFACE (QEI) MODULE
Note 1: This data sheet summarizes the features
of the dsPIC33FJ32MC302/304,
dsPIC33FJ64MCX02/X04
and
dsPIC33FJ128MCX02/X04 family of
devices. It is not intended to be a
comprehensive reference source. To
complement the information in this data
sheet, refer to Section 15. “Quadrature
Encoder Interface (QEI)” (DS70208) of
the
“dsPIC33F/PIC24H
Family
Reference Manual”, which is available
from the Microchip web site
(www.microchip.com).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
Section 4.0 “Memory Organization” in
this data sheet for device-specific register
and bit information.
This chapter describes the Quadrature Encoder
Interface (QEI) module and associated operational
modes. The QEI module provides the interface to incre-
mental encoders for obtaining mechanical position data.
The operational features of the QEI include:
• Three input channels for two phase signals and
index pulse
• 16-bit up/down position counter
• Count direction status
• Position Measurement (x2 and x4) mode
• Programmable digital noise filters on inputs
• Alternate 16-bit Timer/Counter mode
• Quadrature Encoder Interface interrupts
These operating modes are determined by setting the
appropriate bits, QEIM<2:0> bits (QEIxCON<10:8>).
Figure 17-1 depicts the Quadrature Encoder Interface
block diagram.
Note:
An ‘x’ used in the names of pins, control/
status bits and registers denotes a
particular Quadrature Encoder Interface
(QEI) module number (x = 1 or 2).
FIGURE 17-1:
QUADRATURE ENCODER INTERFACE BLOCK DIAGRAM (x = 1 OR 2)
Sleep Input
Synchronize
Det
TQCS
TCY
0
1
TQCKPS<1:0>
2
Prescaler
1, 8, 64, 256
QEIM<2:0>
1
0
TQGATE
DQ
CK Q
QExIF
Event
Flag
QEAx
QEBx
Programmable
2
Digital Filter
UPDN_SRC
Quadrature
Encoder
Interface Logic
QEIxCON<11>
0
1
3
QEIM<2:0>
Mode Select
Programmable
Digital Filter
16-bit Up/Down Counter
(POSxCNT)
Reset
Comparator/
Zero Detect
Equal
Max Count Register
(MAXxCNT)
INDXx
UPDNx
Programmable
Digital Filter
PCDOUT
3
Existing Pin Logic
Up/Down
1
© 2007-2012 Microchip Technology Inc.
DS70291G-page 227