102
2588F–AVR–06/2013
ATtiny261/461/861
in a constantly high or low output (depending on the polarity of the output set by the COM1x1:0
bits.)
A frequency (with 50% duty cycle) waveform output in fast PWM mode can be achieved by set-
ting the Waveform Output (OCW1x) to toggle its logical level on each Compare Match
(COM1x1:0 = 1). The waveform generated will have a maximum frequency of f
OC1 = fclkT1/4 when
OCR1C is set to three.
The general I/O port function is overridden by the Output Compare value (OC1x / OC1x) from
the Dead Time Generator, if either of the COM1x1:0 bits are set and the Data Direction Register
bits for the OC1X and OC1X pins are set as an output. If the COM1x1:0 bits are cleared, the
actual value from the port register will be visible on the port pin. The Output Compare Pin config-
12.8.3
Phase and Frequency Correct PWM Mode
The Phase and Frequency Correct PWM Mode (PWM1A/PWM1B = 1 and WGM11:10 = 01) pro-
vides a high resolution Phase and Frequency Correct PWM waveform generation option. The
Phase and Frequency Correct PWM mode is based on a dual-slope operation. The counter
counts repeatedly from BOTTOM to TOP (defined as OCR1C) and then from TOP to BOTTOM.
In non-inverting Compare Output Mode the Waveform Output (OCW1x) is cleared on the Com-
pare Match between TCNT1 and OCR1x while upcounting, and set on the Compare Match while
down-counting. In inverting Output Compare mode, the operation is inverted. In complementary
Compare Output Mode, the Waveform Ouput is cleared on the Compare Match and set at BOT-
TOM. The dual-slope operation has lower maximum operation frequency than single slope
operation. However, due to the symmetric feature of the dual-slope PWM modes, these modes
are preferred for motor control applications.
The timing diagram for the Phase and Frequency Correct PWM mode is shown on
Figure 12-13in which the TCNT1 value is shown as a histogram for illustrating the dual-slope operation. The
counter is incremented until the counter value matches TOP. When the counter reaches TOP, it
changes the count direction. The TCNT1 value will be equal to TOP for one timer clock cycle.
The diagram includes the Waveform Output (OCW1x) in non-inverted and inverted Compare
Output Mode. The small horizontal line marks on the TCNT1 slopes represent Compare
Matches between OCR1x and TCNT1.
Table 12-3.
Output Compare Pin Configurations in Fast PWM Mode
COM1x1
COM1x0
OC1x Pin
0
Disconnected
0
1
OC1x
1
0
Disconnected
OC1x
1
Disconnected
OC1x