beautypg.com

Timer/counter(t/c0,t/c1), 1 features, 2 overview – Rainbow Electronics ATmega8HVD User Manual

Page 74: Atmega4hvd/8hvd

background image

74

8052B–AVR–09/08

ATmega4HVD/8HVD

16. Timer/Counter(T/C0,T/C1)

16.1

Features

Clear Timer on Compare Match (Auto Reload)

Input Capture unit

Four Independent Interrupt Sources (TOVn, OCFnA, OCFnB, ICFn)

8-bit Mode with Two Independent Output Compare Units

16-bit Mode with One Independent Output Compare Unit

16.2

Overview

Timer/Counter n is a general purpose 8-/16-bit Timer/Counter module, with two/one Output
Compare units and Input Capture feature.

ATmega4HVD/8HVD has two Timer/Counters, Timer/Counter0 and Timer/Counter1. The
functionality for both Timer/Counters is described below. Timer/Counter0 and Timer/Counter1
have different Timer/Counter registers, as shown in

”Register Summary” on page 151

.

The Timer/Counter general operation is described in 8-/16-bit mode. A simplified block dia-
gram of the 8-/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 device-specific I/O Register and bit
locations are listed in the

”Register Description” on page 86

.

Figure 16-1. 8-/16-bit Timer/Counter Block Diagram

Clock Select

Timer/Counter

D

ATA

B

U

S

OCRnB

=

TCNTnL

Noise

Canceler

ICPn0

=

Edge

Detector

Control Logic

TOP

Count

Clear

Direction

TOVn (Int. Req.)

OCnA (Int. Req.)

OCnB (Int. Req.)

ICFn (Int. Req.)

TCCRnA

TCCRnB

Tn

Edge

Detector

( From Prescaler )

clk

Tn

=

OCRnA

TCNTnH

Fixed TOP value

ICPn1