18.3.1.9 Quadrature Decoder
Quadrature Decoding mode is used to track motion and determine both rotation direction and position. The Quadrature Decoder uses
two input channels that are 90 degrees out of phase (see
Figure 18.6 TIMER Quadrature Encoded Inputs on page 584
Channel A
Channel B
Forward rotation (Channel A leads Channel B)
90
°
Channel A
Channel B
Backward rotation (Channel B leads Channel A)
90
°
Figure 18.6. TIMER Quadrature Encoded Inputs
In the timer these inputs are tapped from the Compare/Capture channel 0 (Channel A) and 1 (Channel B) inputs before edge detection.
The Timer/Counter then increments or decrements the counter, based on the phase relation between the two inputs. The Quadrature
Decoder Mode supports two channels, but if a third channel (Z-terminal) is available, this can be connected to an external interrupt and
trigger a counter reset from the interrupt service routine. By connecting a periodic signal from another timer as input capture on
Compare/Capture Channel 2, it is also possible to calculate speed and acceleration.
Note:
In Quadrature Decoder mode, overflow and underflow triggers an
update event
Counter
(Controlled by TIMERn_CTRL)
Compare/Capture channel 1
(Controlled by TIMERn_CC1_CTRL)
Compare/Capture channel 0
(Controlled by TIMERn_CC0_CTRL)
TIMn_CC0
PRS channels
PRSSEL
INSEL
Filter
FILT
ICEDGE
Quadrature
Decoder
TIMn_CC1
PRS channels
PRSSEL
INSEL
Filter
FILT
ICEDGE
Input
Capture 0
Input
Capture 1
Counter
Inc
Dec
QDM
MODE
Ch B
Ch A
Figure 18.7. TIMER Quadrature Decoder Configuration
EFM32JG1 Reference Manual
TIMER - Timer/Counter
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 584