
78
ATtiny40 [DATASHEET]
8263B–AVR–01/2013
In 16-bit mode one more 8-bit register is available, the Timer/Counter1 High Byte Register (TCNT1H). Also, in 16-
bit mode, there is only one output compare unit as the two Output Compare Registers, OCR1A and OCR1B, are
combined to one, 16-bit Output Compare Register, where OCR1A contains the low byte and OCR1B contains the
high byte of the word. When accessing 16-bit registers, special procedures described in section
“Accessing Regis-12.2.2
Definitions
Many register and bit references in this section are written in general form. A lower case “n” replaces the
Timer/Counter number, in this case 1. A lower case “x” replaces the Output Compare Unit, in this case Compare
Unit A or Compare Unit B. However, when using the register or bit defines in a program, the precise form must be
used, i.e. TCNT1L for accessing Timer/Counter1 counter value, and so on.
The definitions in
Table 11-1 are also used extensively throughout the document.
12.3
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 (CS1[2:0]) bits located in the Timer/Counter Control Reg-
12.4
Counter Unit
The main part of the 8-bit Timer/Counter is the programmable bi-directional counter unit.
Figure 12-2 shows a
block diagram of the counter and its surroundings.
Table 12-2.
Counter Unit Block Diagram
Signal description (internal signals):
count
Increment or decrement TCNT1 by 1.
clk
Tn
Timer/Counter clock, referred to as clk
T1 in the following.
top
Signalize that TCNT1 has reached maximum value.
Table 12-1.
Definitions
Constant
Description
BOTTOM
The counter reaches BOTTOM when it becomes 0x00
MAX
The counter reaches its MAXimum when it becomes 0xFF (decimal 255)
TOP
The counter reaches the TOP when it becomes equal to the highest value in the count
sequence. The TOP value can be assigned to be the fixed value 0xFF (MAX) or the
value stored in the OCR1A Register. The assignment depends on the mode of operation
DATA BUS
TCNTn
Control Logic
count
TOVn
(Int.Req.)
Clock Select
top
Tn
Edge
Detector
( From Prescaler )
clk
Tn