16.3.2 Hysteresis
By default the pulse counter wraps to 0 when passing the configured top value, and wraps to the top value when counting down from 0.
On these events, a system will likely want to wake up to store and track the overflow count. This is fine if the pulse counter is tracking a
monotonic value or a value that does not change directions frequently. In the latter scenario, if the counter changes directions around
the overflow/underflow point, the system will have to wake up frequently to keep track of the rotations, resulting in higher current con-
sumption.
To solve this, the pulse counter has a way of introducing hysteresis to the counter. When HYST in PCNTn_CTRL is set, the pulse coun-
ter will always wrap to TOP/2 on underflows and overflows. This takes the counter away from the area where it might overflow or under-
flow, removing the problem.
Figure 16.8 PCNT Hysteresis behavior of Counter on page 454
illustrates the hysteresis behavior.
TOP
TOP/2
Overflow wrap
Overflow continue cnt
Underflow warp
underflow continue cnt
COUNTER
MIN VAL
MAX VAL
Overflow continue cnt
underflow continue cnt
Figure 16.8. PCNT Hysteresis behavior of Counter
Given a starting value of 0 for the counter, the absolute count value when hysteresis is enabled can be calculated with the equations
Figure 16.9 Absolute Position With Hysteresis and Even TOP Value on page 454
or
Figure 16.10 Absolute Position With Hysteresis
, depending on whether the TOP value is even or odd.
CNT
abs
= CNT - UF
CNT
x (TOP/2+1) + OF
CNT
x (TOP/2+1)
Figure 16.9. Absolute Position With Hysteresis and Even TOP Value
CNT
abs
= CNT - UF
CNT
x (TOP/2+1) + OF
CNT
x (TOP/2+2)
Figure 16.10. Absolute Position With Hysteresis and Odd TOP Value
Reference Manual
PCNT - Pulse Counter
silabs.com
| Building a more connected world.
Rev. 1.1 | 454