Quadrature Encoder (QEI)
16
Quadrature Encoder (QEI)
16.1
Introduction
The quadrature encoder API provides a set of functions for dealing with the Quadrature Encoder
with Index (QEI). Functions are provided to configure and read the position and velocity captures,
register a QEI interrupt handler, and handle QEI interrupt masking/clearing.
The quadrature encoder module provides hardware encoding of the two channels and the index
signal from a quadrature encoder device into an absolute or relative position. There is additional
hardware for capturing a measure of the encoder velocity, which is simply a count of encoder pulses
during a fixed time period; the number of pulses is directly proportional to the encoder speed. Note
that the velocity capture can only operate when the position capture is enabled.
The QEI module supports two modes of operation: phase mode and clock/direction mode. In phase
mode, the encoder produces two clocks that are 90 degrees out of phase; the edge relationship is
used to determine the direction of rotation. In clock/direction mode, the encoder produces a clock
signal to indicate steps and a direction signal to indicate the direction of rotation.
When in phase mode, edges on the first channel or edges on both channels can be counted;
counting edges on both channels provides higher encoder resolution if required. In either mode,
the input signals can be swapped before being processed; this allows wiring mistakes on the circuit
board to be corrected without modifying the board.
The index pulse can be used to reset the position counter; this causes the position counter to
maintain the absolute encoder position. Otherwise, the position counter maintains the relative
position and is never reset.
The velocity capture has a timer to measure equal periods of time. The number of encoder pulses
over each time period is accumulated as a measure of the encoder velocity. The running total for
the current time period and the final count for the previous time period are available to be read. The
final count for the previous time period is usually used as the velocity measure.
The QEI module will generate interrupts when the index pulse is detected, when the velocity timer
expires, when the encoder direction changes, and when a phase signal error is detected. These
interrupt sources can be individually masked so that only the events of interest cause a processor
interrupt.
16.2
Functions
Functions
void
(uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32MaxPosition)
int32_t
(uint32_t ui32Base)
void
(uint32_t ui32Base)
void
(uint32_t ui32Base)
April 8, 2013
175
Summary of Contents for Tiva TM4C123GH6PM
Page 26: ...Boot Loader 26 April 8 2013...
Page 68: ...Controller Area Network CAN 68 April 8 2013...
Page 122: ...Hibernation Module 122 April 8 2013...
Page 136: ...Inter Integrated Circuit I2C 136 April 8 2013...
Page 152: ...Memory Protection Unit MPU 152 April 8 2013...
Page 174: ...Pulse Width Modulator PWM Returns None 174 April 8 2013...
Page 196: ...Synchronous Serial Interface SSI 196 April 8 2013...
Page 222: ...System Control 222 April 8 2013...
Page 270: ...UART 270 April 8 2013...
Page 296: ...uDMA Controller 296 April 8 2013...
Page 351: ...April 8 2013 351...