Datasheet

Note:  1. See About Code Examples.
The assembly code example requires that the r17:r16 Register pair contains the value to be written to
TCNT1.
Related Links
About Code Examples
21.3.1 Reusing the Temporary High Byte Register
If writing to more than one 16-bit register where the High byte is the same for all registers written, then
the High byte only needs to be written once. However, note that the same rule of atomic operation
described previously also applies in this case.
21.4 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 (CS12:0) bits located in the
Timer/Counter Control Register B (TCCR1B). For details on clock sources and prescaler, see Timer/
Counter1 and Timer/Counter0 Prescalers.
Related Links
Timer/Counter0 and Timer/Counter1 Prescalers
21.5 Counter Unit
The main part of the 16-bit Timer/Counter is the programmable 16-bit bi-directional counter unit. The
figure below shows a block diagram of the counter and its surroundings.
Figure 21-2. Counter Unit Block Diagram
TEMP (8-bit)
DATA BUS (8-bit)
TCNTn (16-bit Counter)
TCNTnH (8-bit) TCNTnL (8-bit)
Control Logic
Count
Clear
Direction
TOVn
(Int.Req.)
Clock Select
TOP BOTTOM
Tn
Edge
Detector
( From Prescaler )
clk
Tn
Signal description (internal signals):
count Increment or decrement TCNT1 by 1.
direction Select between increment and decrement.
clear Clear TCNT1 (set all bits to zero).
clk
T1
Timer/Counter clock.
TOP Signalize that TCNT1 has reached maximum value.
BOTTOM Signalize that TCNT1 has reached minimum value (zero).
AVR 8-Bit Microcontroller
16-bit Timer/Counter1
© 2017 Microchip Technology Inc.
Datasheet Complete
40001974A-page 119