Datasheet
99
ATtiny25/45/85 [DATASHEET]
2586Q–AVR–08/2013
In PWM mode, the Timer Overflow Flag - TOV1 is set when the TCNT1 counts to the OCR1C value and the
TCNT1 is reset to $00. The Timer Overflow Interrupt1 is executed when TOV1 is set provided that Timer Overflow
Interrupt and global interrupts are enabled. This also applies to the Timer Output Compare flags and interrupts.
The PWM frequency can be derived from the timer/counter clock frequency using the following equation:
The duty cycle of the PWM waveform can be calculated using the following equation:
...where T
PCK
is the period of the fast peripheral clock (1/25.6 MHz = 39.1 ns).
Resolution indicates how many bits are required to express the value in the OCR1C register. It can be calculated
using the following equation:
1 0 OCR1C H
11$00H
1 1 OCR1C L
Table 13-3. Timer/Counter1 Clock Prescale Select in the Asynchronous Mode
PWM Frequency Clock Selection CS1[3:0] OCR1C RESOLUTION
20 kHz PCK/16 0101 199 7.6
30 kHz PCK/16 0101 132 7.1
40 kHz PCK/8 0100 199 7.6
50 kHz PCK/8 0100 159 7.3
60 kHz PCK/8 0100 132 7.1
70 kHz PCK/4 0011 228 7.8
80 kHz PCK/4 0011 199 7.6
90 kHz PCK/4 0011 177 7.5
100 kHz PCK/4 0011 159 7.3
110 kHz PCK/4 0011 144 7.2
120 kHz PCK/4 0011 132 7.1
130 kHz PCK/2 0010 245 7.9
140 kHz PCK/2 0010 228 7.8
150 kHz PCK/2 0010 212 7.7
Table 13-2. PWM Outputs OCR1A = $00 or OCR1C
COM1A1 COM1A0 OCR1A Output OC1A
f
f
TCK1
OCR1C + 1
----------------------------------- -=
D
OCR1A 1+T
TCK1
T
PCK
–
OCR1C 1+T
TCK1
----------------------------------------------------------------------------=
R 2OCR1C 1+()log=