4 pwm6 mode – Rainbow Electronics ATtiny861_V User Manual
Page 105

105
2588B–AVR–11/06
ATtiny261/461/861
In the Phase and Frequency Correct PWM mode, the compare unit allows generation of PWM
waveforms on the OC1x pins. Setting the COM1x1:0 bits to two will produce a non-inverted
PWM and setting the COM1x1:0 to three will produce an inverted PWM output. Setting the
COM1A1:0 bits to one will enable complementary Compare Output mode and produce both the
non-inverted (OC1x) and inverted output (OC1x). The actual values will only be visible on the
port pin if the data direction for the port pin is set as output. The PWM waveform is generated by
clearing (or setting) the Waveform Output (OCW1x) at the Compare Match between OCR1x and
TCNT1 when the counter increments, and setting (or clearing) the Waveform Output at Compare
Match when the counter decrements. The PWM frequency for the output when using the Phase
and Frequency Correct PWM can be calculated by the following equation:
The N variable represents the number of steps in dual-slope operation. The value of N equals to
the TOP value.
The extreme values for the OCR1C Register represent special cases when generating a PWM
waveform output in the Phase and Frequency Correct PWM mode. If the OCR1C is set equal to
BOTTOM, the output will be continuously low and if set equal to MAX the output will be continu-
ously high for non-inverted PWM mode. For inverted PWM the output will have the opposite
logic values.
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 configurations of the Output
Compare Pins are described in
Table 16-4
.
16.7.4
PWM6 Mode
The PWM6 Mode (PWM1A = 1, WGM11 = 1 and WGM10 = x) provide PWM waveform genera-
tion option e.g. for controlling Brushless DC (BLDC) motors. In the PWM6 Mode the OCR1A
Register controls all six Output Compare waveforms as the same Waveform Output (OCW1A)
from the Waform Generator is used for generating all waveforms. The PWM6 Mode also pro-
vides an Output Compare Override Enable Register (OC1OE) that can be used with an instant
response for disabling or enabling the Output Compare pins. If the Output Compare Override
Enable bit is cleared, the actual value from the port register will be visible on the port pin.
The PWM6 Mode provides two counter operation modes, a single-slope operation and a dual-
slope operation. If the single-slope operation is selected (the WGM10 bit is set to 0), the counter
counts from BOTTOM to TOP (defined as OCR1C) then restart from BOTTOM like in Fast PWM
Mode. The PWM waveform is generated by setting (or clearing) the Waveforn Output (OCW1A)
at the Compare Match between OCR1A and TCNT1, and clearing (or setting) the Waveform
Table 16-4.
Output Compare pin configurations in Phase and Frequency Correct PWM Mode
COM1x1
COM1x0
OC1x Pin
OC1x Pin
0
0
Disconnected
Disconnected
0
1
OC1x
OC1x
1
0
Disconnected
OC1x
1
1
Disconnected
OC1x
f
OCnxPCPWM
f
clkT1
N
-------------
=