14.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 14.8 PCNT Hysteresis behavior of Counter on page 369
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 14.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 14.9 Absolute position with hysteresis and even TOP value on page 369
Figure 14.10 Absolute position with hysteresis and
, 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 14.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 14.10. Absolute position with hysteresis and odd TOP value
EFM32JG1 Reference Manual
PCNT - Pulse Counter
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 369