English
Language : 

ATMEGA406_14 Datasheet, PDF (95/263 Pages) ATMEL Corporation – High Performance, Low Power AVR
ATmega406
16. 16-bit Timer/Counter1
The 16-bit Timer/Counter unit allows accurate program execution timing (event management).
The main features are:
• One Output Compare Unit
• Clear Timer on Compare Match (Auto Reload)
• Two Independent Interrupt Sources (TOV1 and OCF1A)
16.1 Overview
Most register and bit references in this document are written in general form. A lower case “n”
replaces the Timer/Counter number, and a lower case “x” replaces the output compare unit
channel. However, when using the register or bit defines in a program, the precise form must be
used, i.e., TCNT1 for accessing Timer/Counter1 counter value and so on. The physical I/O reg-
ister and bit locations for ATmega406 are listed in the ”16-bit Timer/Counter Register
Description” on page 100.
A simplified block diagram of the 16-bit Timer/Counter is shown in Figure 16-1. CPU accessible
I/O registers, including I/O bits and I/O pins, are shown in bold.
The PRTIM1 bit in ”PRR0 – Power Reduction Register 0” on page 36 must be written to zero to
enable TImer/Counter1 module.
Figure 16-1. 16-bit Timer/Counter Block Diagram
Count
Clear
Control Logic
clkTn
TOVn
(Int.Req.)
OCFnA
(Int.Req.)
Timer/Counter
TCNTn
=
OCRnA
=0xFFFF
TCCRnB
16.1.1 Registers
The Timer/Counter (TCNT1) and the Output Compare Register (OCR1A) are both 16-bit regis-
ters. Special procedures must be followed when accessing the 16-bit registers. These
procedures are described in the section ”Accessing 16-bit Registers” on page 96.The
Timer/Counter Control Register (TCCR1B) is an 8-bit register an has no CPU access restric-
tions. Interrupt requests (abbreviated to Int.Req. in the figure) signals are visible in the Timer
Interrupt Flag Register (TIFR). Both interrupts are individually masked with the Timer Interrupt
Mask Register (TIMSK). TIFR and TIMSK are not shown in the figure.
The Timer/Counter is clocked internally via the prescaler. The Clock Select logic block controls
which clock source the Timer/Counter uses to increment 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 (clkT1).
95
2548F–AVR–03/2013