3.2.18 Quadrature Encoder Interface (QEI)
The Quadrature Encoder Interface (QEI) module provides the interface to incremental encoders for obtaining mechanical position data. This module provides below features:
-
Four input pins: two phase signals, an index pulse and a home pulse
-
Programmable digital noise filters on inputs
-
Count direction status
-
Index (INDX) pulse to reset the position counter
-
32-bit position counter
-
32-bit position Initialization/Capture register
-
32-bit Compare Less Than and Greater Than registers
Using The Library
Quadrature encoder signals Phase A, Phase B and an optional index signal and an optional home signal are connected to the QEI peripheral. The quadrature decoder in the QEI peripheral processes these signals with an internal counter to get the position, velocity and revolution count. The quadrature decoder increments or decrements the 32-bit Up/Down Counter for each change of state. The counter increments when QEA leads QEB and decrements when QEB leads QEA
Library Interface
QEI peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
QEIx_Initialize | Initializes given instance of QEIx peripheral in quadrature mode |
QEIx_Deinitialize | De-initializes QEIx peripheral |
QEIx_IMVGatedValueSet | Sets the QEIx Index Match Value Configuration |
QEIx_CounterModeSet | Sets the QEIx Counter mode |
QEIx_PositionCaptureSet | Initializes the 32 bit position capture register value |
QEIx_PositionCapture16bitGet | Returns the 16-bit position capture value |
QEIx_PositionCaptureGet | Reads the 32-bit position capture value |
QEIx_PositionCaptureDisable | Deasserts the QEIx position counter input capture |
QEIx_PositionCaptureEnable |
Sets the QEIx position counter input capture |
QEIx_PhaseInputSwappedSet | Facilitates swapping of QEA and QEB |
QEIx_PhaseInputSwappedGet | Gets the status of QEIx input phase swap configuration |
QEIx_ModuloRangeSet | Sets the 32bit modulo count value |
QEIx_PositionCountWrite | Sets the QEIx position count value |
QEIx_PositionCount16bitRead | Returns the 16-bit position count value |
QEIx_PositionCountRead | Reads the position count value |
QEIx_Enable | Enables the QEIx peripheral |
QEIx_Disable | Disables the QEIx peripheral |
Data types and constants
Name | Type | Description |
---|---|---|
QEI_MODE | Enum | Defines the QEI operating modes |
QEI_IMV_STATE | Enum | Defines the QEI Index Match Value states |