Overflow and underflow of the counter limits
Counter overflow and Counter underflow
An overflow or underflow of the counter limits is indicated by the process data 0x6000:04 "Counter underflow" or 0x6000:05 "Counter overflow".
- The "Counter underflow" bit in index 0x6000:04 is set when an underflow 0x8001:1B "Reset counter value" → 0x8001:1A "Limit counter value" occurs.
- With the preset parameters, this corresponds to "..00 → ..FF"
It is reset if 2/3 of the counter range are underrun. - For counter limits with fixed value range, this corresponds to:
2/3 * ("Limit counter value" - "Reset counter value") + "Reset counter value" - The "Counter overflow" bit 0x6000:05 is set when an overflow 0x8001:1A "Limit counter value" → 0x8001:1B "Reset counter value" occurs.
- With default parameters "..FF → ..00"
It is reset if 1/3 of the counter range is exceeded. - For counter limits with fixed value range, this corresponds to:
1/3 * ("Limit counter value" - "Reset counter value") + "Reset counter value"
Example 1:
0x8001:1A "Limit counter value" = 212-1 = 4095
0x8001:1B "Reset counter value" = 0
"Counter underflow" bit is reset when: 2/3 * 4095 = 2730 is reached.
"Counter overflow" bit is reset when: 1/3 * 4095 = 1365 is reached.
Example 2:
0x8001:1A "Limit counter value" = 212-1 = 4095
0x8001:1B "Reset counter value" = 400
"Counter underflow" bit is reset when: 2/3 * (4095-400) +400 = 2463 is reached.
"Counter overflow" bit is reset when: 1/3 * (4095-95) +400 = 1232 is reached.