25.3.3.2 Waveform Generation Modes
The TCF provides four waveform generation modes controlled by the Waveform Generation Mode
(WGMODE) bit field in the Control B (TCFn.CTRLB) register. The waveform generation modes
are:
- Frequency generation
- NCO Pulse-Frequency
- NCO Fixed Duty Cycle
- 8-bit PWM
The registers functionality might be different for each mode and is summarized in the table
below:
Mode | CNT2 | CNT1 | CNT0 | CMP2 | CMP1 | CMP0 | CMP1 Flag | CMP0 Flag | OVF Flag |
---|---|---|---|---|---|---|---|---|---|
Frequency Generation | Counter | Compare/TOP | CMP Match(1) | CMP Match(1) | TOP | ||||
NCO Pulse-Frequency | Counter/Accumulator | Increment | WO pulse end | WO pulse start | MAX | ||||
NCO Fixed Duty-Cycle | Counter/Accumulator | Increment | MAX(1) | MAX(1) | MAX | ||||
8-bit PWM | - | Period | Counter | - | Compare 1 | Compare 0 | CMP1 Match | CMP0 Match | TOP |
Note:
- CMP0 and CMP1 interrupts and events are generated on alternating overflows where one will match the rising edge of the waveform and the other the falling edge. An overflow interrupt/event is generated on all overflows.