Quadrature Encoder (Qei); Introduction; Functions - Texas Instruments Tiva TM4C123GH6PM User Manual

Table of Contents

Advertisement

16

Quadrature Encoder (QEI)

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

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
ROM_QEIConfigure
int32_t
void
ROM_QEIDisable
void
ROM_QEIEnable
April 8, 2013
(uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32MaxPosition)
ROM_QEIDirectionGet
(uint32_t ui32Base)
(uint32_t ui32Base)
(uint32_t ui32Base)
Quadrature Encoder (QEI)
175

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents