7.2 Functional Description
or high value: 0 does not modify the NEG_MODE and POS_MODE behaviour, 1 inverts it (setting
POS_MODE/NEG_MODE to increase the counter will now decrease the counter and vice versa) and any other
value disables counter effects for that signal level.
To summarize, a few examples have been considered. In this table, the effect on the counter for a rising edge is
shown for both a low and a high control signal and various configuration options. For clarity, a short description in
brackets is added after the values. Note: x denotes 'don't care'.
POS_ MODE
LCTRL_ MODE
1 (inc)
0 (-)
2 (dec)
0 (-)
0 (-)
x
1 (inc)
0 (-)
1 (inc)
1 (inv)
2 (dec)
0 (-)
1 (inc)
0 (-)
1 (inc)
2 (dis)
This table is also valid for negative edges (sig h→l) on substituting NEG_MODE for POS_MODE.
Each pulse counter unit also features a filter on each of the four inputs, adding the option to ignore short glitches
in the signals. If a
PCNT_FILTER_EN_Un
enabled, any pulses shorter than
and will have no effect on the counter. With the filter disabled, in theory infinitely small glitches could possibly
trigger pulse counter action. However, in practice the signal inputs are sampled on APB_CLK edges and even
with the filter disabled, pulse widths lasting shorter than one APB_CLK cycle may be missed.
Apart from the input channels, software also has some control over the counter. In particular, the counter value
can be frozen to the current value by configuring PCNT_CNT_PAUSE_Un. It can also be reset to zero by
configuring PCNT_PULSE_CNT_RST_Un.
7.2.3 Watchpoints
The pulse counters have 5 watchpoints that share one interrupt. Interrupt generation can be enabled or disabled
for each individual watchpoint. The watchpoints are:
• Maximum count value: Triggered when PULSE_CNT >= PCNT_THR_H_LIM_Un. Additionally, this will reset
the counter to zero.
• Minimum count value: Triggered when PULSE_CNT <= PCNT_THR_L_LIM_Un. Additionally, this will reset
the counter to zero. This is most useful when
• Two threshold values: Triggered when PULSE_CNT =
PCNT_THR_THRES1_Un.
• Zero: Triggered when PULSE_CNT = 0.
Espressif Systems
HCTRL_ MODE
0 (-)
0 (-)
x
1 (inv)
0 (-)
1 (inv)
2 (dis)
0 (-)
can be set to filter the four input signals of the unit. If this filter is
REG_FILTER_THRES_Un
PCNT_THR_L_LIM_Un
91
sig l→h when ctrl=0
Inc ctr
Dec ctr
No action
Inc ctr
Dec ctr
Dec ctr
Inc ctr
No action
number of APB_CLK clock cycles will be filtered out
is set to a negative number.
PCNT_THR_THRES0_Un
ESP32 Technical Reference Manual V1.0
7 PULSE_CNT
sig l→h when ctrl=1
Inc ctr
Dec ctr
No action
Dec ctr
Inc ctr
Inc ctr
No action
Inc ctr
or
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers