Overflow and underflow of the counter
An overflow or underflow of the counter is indicated via the status bits "Counter overflow" or "Counter underflow" in the process data.
- "Counter underflow" is set to 1 if the counter falls below the value 0.
It is reset if 2/3 of the counting range are underrun. - "Counter overflow" is set to 1 if the counter exceeds the maximum value "Counter reload value".
It is reset if 1/3 of the counting range is exceeded.
Example of resetting the status bits:
With 0x8000:12 "Counter reload value" = 212-1 = 4095:
- "Counter underflow" is reset when: 2/3 × 4095 = 2730 is reached.
- "Counter overflow" is reset when: 1/3 × 4095 = 1365 is reached.