ATMEGA48V_11 ATMEL [ATMEL Corporation], ATMEGA48V_11 Datasheet - Page 91

no-image

ATMEGA48V_11

Manufacturer Part Number
ATMEGA48V_11
Description
8-bit Atmel Microcontroller with 4/8/16K Bytes In-System Programmable Flash
Manufacturer
ATMEL [ATMEL Corporation]
Datasheet
15.3
15.4
2545T–AVR–05/11
Timer/counter clock sources
Counter unit
The Timer/Counter can be clocked internally, via the prescaler, or by an external clock source on
the T0 pin. The Clock Select logic block controls which clock source and edge the Timer/Counter
uses to increment (or decrement) its value. The Timer/Counter is inactive when no clock source
is selected. The output from the Clock Select logic is referred to as the timer clock (clk
The double buffered Output Compare Registers (OCR0A and OCR0B) are compared with the
Timer/Counter value at all times. The result of the compare can be used by the Waveform Gen-
erator to generate a PWM or variable frequency output on the Output Compare pins (OC0A and
OC0B).
will also set the Compare Flag (OCF0A or OCF0B) which can be used to generate an Output
Compare interrupt request.
The Timer/Counter can be clocked by an internal or an external clock source. The clock source
is selected by the Clock Select logic which is controlled by the Clock Select (CS02:0) bits
located in the Timer/Counter Control Register (TCCR0B). For details on clock sources and pres-
caler, see
The main part of the 8-bit Timer/Counter is the programmable bi-directional counter unit.
15-2
Figure 15-2. Counter unit block diagram.
Signal description (internal signals):
Depending of the mode of operation used, the counter is cleared, incremented, or decremented
at each timer clock (clk
selected by the Clock Select bits (CS02:0). When no clock source is selected (CS02:0 = 0) the
timer is stopped. However, the TCNT0 value can be accessed by the CPU, regardless of
whether clk
count operations.
shows a block diagram of the counter and its surroundings.
count
direction
clear
clk
top
bottom
See “Using the output compare unit” on page 118.
Tn
“Timer/Counter0 and Timer/Counter1 prescalers” on page
T0
is present or not. A CPU write overrides (has priority over) all counter clear or
DATA BUS
TCNTn
T0
). clk
Increment or decrement TCNT0 by 1.
Select between increment and decrement.
Clear TCNT0 (set all bits to zero).
Timer/Counter clock, referred to as clk
Signalize that TCNT0 has reached maximum value.
Signalize that TCNT0 has reached minimum value (zero).
T0
can be generated from an external or internal clock source,
direction
count
clear
bottom
Control logic
top
TOVn
(Int.req.)
clk
Tn
for details. The compare match event
ATmega48/88/168
Clock select
(From prescaler)
detector
Edge
137.
T0
in the following.
Tn
T0
).
Figure
91

Related parts for ATMEGA48V_11