3 phase and frequency correct pwm mode – Rainbow Electronics ATtiny861_V User Manual

Page 104

Advertising
background image

104

2588B–AVR–11/06

ATtiny261/461/861

16.7.3

Phase and Frequency Correct PWM Mode

The Phase and Frequency Correct PWM Mode (PWMx = 1 and WGM10 = 1) provides 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 repeat-
edly 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 Compare
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 16-12

in 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.

Figure 16-12. Phase and Frequency Correct PWM Mode, Timing Diagram

The Timer/Counter Overflow Flag (TOV1) is set each time the counter reaches BOTTOM. The
Interrupt Flag can be used to generate an interrupt each time the counter reaches the BOTTOM
value.

Table 16-3.

Output Compare Pin Configurations in Fast PWM Mode

COM1x1

COM1x0

OC1x Pin

OC1x Pin

0

0

Disconnected

Disconnected

0

1

OC1x

OC1x

1

0

Disconnected

OC1x

1

1

Disconnected

OC1x

TOVn Interrupt Flag Set

OCnx Interrupt Flag Set

1

2

3

TCNTn

Period

OCWnx

OCWnx

(COMnx = 2)

(COMnx = 3)

OCRnx Update

Advertising