16. PCNT - Pulse Counter
4
3
2
1
0
Reload value
Interrupt
Quadrature code
0
Quick Facts
What?
The Pulse Counter (PCNT) decodes incoming pul-
ses. The module has a quadrature mode which may
be used to decode the speed and direction of a me-
chanical shaft. PCNT can operate in EM0 Active
down to EM3 Stop.
Why?
The PCNT generates an interrupt after a specific
number of pulses (or rotations), eliminating the need
for timing- or I/O interrupts and CPU processing to
measure pulse widths, etc.
How?
PCNT uses the LFACLK or may be externally
clocked from a pin. The module incorporates an 16-
bit up/down-counter to keep track of incoming pulses
or rotations.
16.1 Introduction
The Pulse Counter (PCNT) can be used for counting incoming pulses on a single input or to decode quadrature encoded inputs in EM0
Active down to EM3 Stop. It can run from the internal LFACLK while counting pulses on the PCNTn_S0IN pin. Or, alternately, the
PCNTn_S0IN pin may be used as an external clock source that runs both the PCNT counter and register access.
16.2 Features
• 16-bit counter with reload register
• Auxiliary counter for counting a single direction
• Single input oversampling up/down counter mode
• Externally clocked single input pulse up/down counter mode
• Quadrature decoder modes
• Externally clocked quadrature decoder 1X mode
• Oversampling quadrature decoder 1X, 2X and 4X modes
• Interrupt on counter underflow and overflow
• Interrupt when a direction change is detected (quadrature decoder mode only)
• Optional pulse width filter
• Optional input inversion/edge detect select
• Optional inputs from PRS
• Asynchronously triggered compare and clear
Reference Manual
PCNT - Pulse Counter
silabs.com
| Building a more connected world.
Rev. 1.1 | 446