dsPIC30F Quadrature Encoder Interface Module
© 2005 Microchip Technology Inc.
Page 12
© 2005 Microchip Technology Incorporated. All Rights Reserved. dsPIC30F Quadrature Encoder Interface Module 12
QEI as a 16 bit Timer/Counter
If the quadrature decoder functionality is not needed, the QEI peripheral module
can be configured as an additional 16 bit counter/timer.
In this mode, the Position Counter register has the same functionality as the
Timer registers in general-purpose timers, while the Maximum Count register
serves as a period register. An additional feature compared to the general-
purpose timers is that the QEI counter is able to both increment and decrement
its count, thus providing up-down counter functionality.
The timer clock can be either internal or external; in the latter case the input pin
is the QEA pin and the input clock, after digital filtering, will be synchronized
with the instruction cycle. As in the general-purpose timers, gated time
accumulation is also possible.
The counting direction can be selected either with the UPDN bit in register
QEICON, or with the QEB pin.
An interrupt is generated when the value in the Position Counter register
maches the value in the Maximum Count register.