AVR1306
Figure 3-3.
Frequency Generation Mode
TCNT
MAX
"update"
TOP
CNT written
Direction Change
Period (T)
BOT
WG Output
The waveform generated will have a maximum frequency of f
clk
/2 when CCA[H:L] is
set to zero (0x0000). The waveform frequency is defined by Equation 3-1.
Equation 3-1.
Frequency Calculation, Frequency generation mode
(
)
1
2
+
⋅
=
CCA
N
f
f
CLK
FRQ
Where
N
represents the TC clock prescaler.
The Overflow Status Flag (OVFIF) or Compare A Flag (CCAIF) can be used to
generate interrupts. If enabled, the interrupt handler routine can be used for updating
CCA[H:L] to change the output frequency.
3.8.3 Single Slope PWM Mode
As Figure 3-4 shows, in this mode of operation the counter counts from BOTTOM to
TOP then restarts from BOTTOM. The waveform generator output is set on the
compare match between the count and compare registers, and cleared at TOP.
Figure 3-4.
Single slope PWM
CNT
M AX
TOP
Period (T)
"match"
BOT
WG Output
CCx=BOT
CCx
CCx=TOP
"update "
The single-slope Pulse Width Modulation (PWM) provides twice the PWM frequency
compared to dual-slope PWM. The high frequency makes this mode well suited for
power regulation, rectification, and DAC applications. High frequency allows
physically small sized external filtering components, which reduces total system cost.
The period register (PER[H:L]) defines the PWM resolution. The minimum resolution
allowed for this module is 2-bit (PER[H:L]=0x0003), and maximum resolution is 16-bit
7
8045A-AVR-02/08