
144
8210C–AVR–09/11
Atmel AVR XMEGA D
1.
A waveform generation mode must be selected.
2.
Event actions must be disabled.
3.
The CC channels used must be enabled. This will override the corresponding port pin
output register.
4.
The direction for the associated port pin must be set to output.
Inverted waveform output is achieved by setting the invert output bit for the port pin.
12.8.2
Frequency (FRQ) Waveform Generation
For frequency generation the period time (T) is controlled by the CCA register instead of PER.
The waveform generation (WG) output is toggled on each compare match between the CNT and
CCA registers, as shown in
Figure 12-14.
Frequency waveform generation.
The waveform frequency (f
FRQ
) is defined by the following equation:
where N represents the prescaler divider used. The waveform generated will have a maximum
frequency of half of the peripheral clock frequency (fclk
PER
) when CCA is set to zero (0x0000)
and no prescaling is used. This also applies when using the hi-res extension, since this
increases the resolution and not the frequency.
12.8.3
Single-slope PWM Generation
For single-slope PWM generation, the period (T) is controlled by PER, while CCx registers con-
trol the duty cycle of the WG output.
shows how the counter counts from BOTTOM
to TOP and then restarts from BOTTOM. The waveform generator (WG) output is set on the
compare match between the CNT and CCx registers and cleared at TOP.
CNT
MAX
"update"
TOP
CNT written
Direction Change
Period (T)
BOTTOM
WG Output
f
FRQ
fclk
PER
2
N CCA
1
+
(
)
-----------------------------------
=