Datasheet
19.2.2 Definitions
Many register and bit references in this document are written in general form. A lower case “n” replaces
the Timer/Counter number, in this case 0. However, when using the register or bit defines in a program,
the precise form must be used i.e. TCNT0 for accessing Timer/Counter0 counter value and so on.
The definitions in the table below are also used extensively throughout this datasheet.
Table 19-1. Definitions
BOTTOM The counter reaches the BOTTOM when it becomes 0x00
MAX The counter reaches its MAXimum when it becomes 0xFF (decimal 255)
19.3 Timer/Counter Clock Sources
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 (TCCR0). For details on clock sources and prescaler, see Timer/
Counter0 and Timer/Counter1 Prescalers.
Related Links
Timer/Counter0 and Timer/Counter1 Prescalers
19.4 Counter Unit
The main part of the 8-bit Timer/Counter is the programmable counter unit. The following figure shows a
block diagram of the counter and its surroundings.
Figure 19-2. Counter Unit Block Diagram
DATA BUS
TCNTn Control Logic
count
TOVn
(Int. Req.)
Clock Select
max
Tn
Edge
Detector
( From Prescaler )
clk
Tn
Signal description (internal signals):
count Increment TCNT0 by 1.
clk
Tn
Timer/Counter clock, referred to as clk
T0
in the following.
max Signalize that TCNT0 has reached maximum value.
The counter is incremented at each timer clock (clk
T0
). clk
T0
can be generated from an external or internal
clock source, 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
T0
is present or not. A CPU write overrides (has priority over) all counter clear or count operations.
AVR 8-Bit Microcontroller
8-bit Timer/Counter0
© 2017 Microchip Technology Inc.
Datasheet Complete
40001974A-page 105