178
8331B–AVR–03/12
Atmel AVR XMEGA AU
synchronization prevents the occurrence of odd-length, non-symmetrical pulses for glitch-free
output.
14.8.1
Waveform Generation
The compare channels can be used for waveform generation on the corresponding port pins. To
make the waveform visible on the connected port pin, the following requirements must be
fulfilled:
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.
14.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 14-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.
14.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
CNT
MAX
"update"
TOP
CNT written
Direction Change
Period (T)
BOTTOM
WG Output
f
FRQ
fclk
PER
2
N CCA
1
+
(
)
-----------------------------------
=