23.3.4.4.3 Single-Slope PWM Generation
For Single-Slope Pulse-Width Modulation (PWM) generation, the period (T) is controlled by the TCEn.PER register, while the values of the TCEn.CMPn registers control the duty cycles of the generated waveforms. The figure below shows how the counter counts from BOTTOM to TOP and then restarts from BOTTOM. The waveform generator output is set at BOTTOM and cleared on the compare match between the TCEn.CNT and TCEn.CMPn registers.
CMPn = BOTTOM will produce a static low signal on WOn, while CMPn > TOP will generate a static high signal on WOn.
The TCEn.PER register defines the PWM
resolution. The minimum resolution is two bits (TCEn.PER = 0x0002
), and
the maximum is 16 bits (TCEn.PER = MAX-1).
The following equation calculates the exact resolution in bits for Single-Slope PWM (RPWM_SS):
The Single-Slope PWM frequency (fPWM_SS) depends on the period setting (TCEn.PER), the peripheral clock frequency fCLK_PER, and the TCE prescaler (the CLKSEL bit field in the TCEn.CTRLA register). It is calculated by the following equation, where N represents the prescaler divider used: