Datasheet
82
8024A–AVR–04/08
ATmega8HVA/16HVA
17.5.5 8-bit Input Capture Mode
The Timer/Counter can be used in a 8-bit Input Capture mode, see Table 17-2 on page 80 for bit
settings. For full description, see ”Input Capture Unit” on page 82.
17.5.6 16-bit Input Capture Mode
The Timer/Counter can also be used in a 16-bit Input Capture mode, see Table 17-2 on page 80
for bit settings. For full description, see ”Input Capture Unit” on page 82.
17.6 Input Capture Unit
The Timer/Counter incorporates an Input Capture unit that can capture external events and give
them a time-stamp indicating time of occurrence. The external signal indicates an event, or mul-
tiple events. For Timer/Counter0, the events can be applied via the PC0 pin (ICP01), or
alternatively via the osi_posedge pin on the Oscillator Sampling Interface (ICP00). For
Timer/Counter1, the events can be applied by the Battery Protection Interrupt (ICP10) or alter-
natively by the Voltage Regulator Interrupt (ICP11). The time-stamps can then be used to
calculate frequency, duty-cycle, and other features of the signal applied. Alternatively the time-
stamps can be used for creating a log of the events.
The Input Capture unit is illustrated by the block diagram shown in Figure 17-4 on page 82. The
elements of the block diagram that are not directly a part of the Input Capture unit are gray
shaded.
Figure 17-4. Input Capture Unit Block Diagram
The Output Compare Register OCRnA is a dual-purpose register that is also used as an 8-bit
Input Capture Register ICRn. In 16-bit Input Capture mode the Output Compare Register
OCRnB serves as the high byte of the Input Capture Register ICRn. In 8-bit Input Capture mode
the Output Compare Register OCRnB is free to be used as a normal Output Compare Register,
but in 16-bit Input Capture mode the Output Compare Unit cannot be used as there are no free
Output Compare Register(s). Even though the Input Capture register is called ICRn in this sec-
tion, it is referring to the Output Compare Register(s). For more information on how to access
the 16-bit registers refer to ”Accessing Registers in 16-bit Mode” on page 86.
ICFn (Int.Req.)
WRITE
ICRn (16-bit Register)
OCRnB (8-bit)
Noise
Canceler
ICPn0
Edge
Detector
TEMP (8-bit)
DATA BUS
(8-bit)
OCRnA (8-bit)
TCNTn (16-bit Counter)
TCNTnH (8-bit) TCNTnL (8-bit)
ICNCn ICESn
ICPn1
ICSn