Datasheet

Table Of Contents
78
ATmega32A [DATASHEET]
Atmel-8155D-AVR-ATmega32A-Datasheet_02/2014
Figure 15-11. Timer/Counter Timing Diagram, Clear Timer on Compare Match Mode, with Prescaler (f
clk_I/O
/8)
15.9 Register Description
15.9.1 TCCR0 – Timer/Counter Control Register
Bit 7 – FOC0: Force Output Compare
The FOC0 bit is only active when the WGM00 bit specifies a non-PWM mode. However, for ensuring compatibility
with future devices, this bit must be set to zero when TCCR0 is written when operating in PWM mode. When writ-
ing a logical one to the FOC0 bit, an immediate compare match is forced on the Waveform Generation unit. The
OC0 output is changed according to its COM0[1:0] bits setting. Note that the FOC0 bit is implemented as a strobe.
Therefore it is the value present in the COM0[1:0] bits that determines the effect of the forced compare.
A FOC0 strobe will not generate any interrupt, nor will it clear the timer in CTC mode using OCR0 as TOP.
The FOC0 bit is always read as zero.
Bit 6, 3 – WGM0[1:0]: Waveform Generation Mode
These bits control the counting sequence of the counter, the source for the maximum (TOP) counter value, and
what type of Waveform Generation to be used. Modes of operation supported by the Timer/Counter unit are: Nor-
mal mode, Clear Timer on Compare Match (CTC) mode, and two types of Pulse Width Modulation (PWM) modes.
See Table 14-2 and “Modes of Operation” on page 78.
OCFn
OCRn
TCNTn
(CTC)
TOP
TOP - 1 TOP BOTTOM BOTTOM + 1
clk
I/O
clk
Tn
(clk
I/O
/8)
Bit 76543210
FOC0 WGM00 COM01 COM00 WGM01 CS02 CS01 CS00 TCCR0
Read/Write W R/W R/W R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
Table 15-2. Waveform Generation Mode Bit Description
(1)
Mode
WGM01
(CTC0)
WGM00
(PWM0)
Timer/Counter Mode of
Operation TOP
Update of
OCR0
TOV0 Flag
Set-on
0 0 0 Normal 0xFF Immediate MAX
1 0 1 PWM, Phase Correct 0xFF TOP BOTTOM
2 1 0 CTC OCR0 Immediate MAX
3 1 1 Fast PWM 0xFF BOTTOM MAX