The counter-compare submodule takes as input the
time-base counter value. This value is continuously compared to the counter-compare
A (CMPA), counter-compare B (CMPB), counter-compare C (CMPC), and counter-compare D
(CMPD) registers. When the time-base counter is equal to one of the compare
registers, the counter-compare unit generates an appropriate event.
The counter-compare:
- Generates events based on programmable time stamps using the CMPA, CMPB, CMPC,
and CMPD registers:
- CTR = CMPA: Time-base
counter equals counter-compare A register (TBCTR = CMPA)
- CTR = CMPB: Time-base
counter equals counter-compare B register (TBCTR = CMPB)
- CTR = CMPC: Time-base counter equals counter-compare C
register (TBCTR = CMPC)
- CTR = CMPD: Time-base counter equals counter-compare D
register (TBCTR = CMPD)
- Controls the PWM duty cycle, if the action-qualifier submodule is configured
appropriately using counter-compare A (CMPA) and counter-compare B (CMPB)
- Shadows new compare values to prevent corruption or glitches during the active PWM cycle