atmega161-4pi ATMEL Corporation, atmega161-4pi Datasheet - Page 41

no-image

atmega161-4pi

Manufacturer Part Number
atmega161-4pi
Description
8-bit Microcontroller With 16k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
1228D–AVR–02/07
Figure 32. Timer/Counter2 Block Diagram
The 8-bit Timer/Counter0 can select clock source from CK, prescaled CK or an external
pin.The 8-bit Timer/Counter2 can select clock source from CK, prescaled CK or external
TOSC1.
Both Timer/Counters can be stopped as described in sections “Timer/Counter0 Control
Register
The various Status Flags (Overflow and Compare Match) are found in the
Timer/Counter Interrupt Flag Register (TIFR). Control signals are found in the
Timer/Counter Control Register (TCCR0 and TCCR2). The interrupt enable/disable set-
tings are found in the Timer/Counter Interrupt Mask Register (TIMSK).
When Timer/Counter0 is externally clocked, the external signal is synchronized with the
Oscillator frequency of the CPU. To assure proper sampling of the external clock, the
minimum time between two external clock transitions must be at least one internal CPU
clock period. The external clock signal is sampled on the rising edge of the internal CPU
clock.
The 8-bit Timer/Counters feature both a high resolution and a high accuracy usage with
the lower prescaling opportunities. Similarly, the high prescaling opportunities make the
Timer/Counter0 useful for lower speed functions or exact timing functions with infre-
quent actions.
Timer/Counters 0 and 2 can also be used as 8-bit Pulse Width Modulators. In this
mode, the Timer/Counter and the Output Compare Register serve as a glitch-free,
stand-alone PWM with centered pulses. Refer to page 44 for a detailed description of
this function.
7
7
7
TCCR0” and “Timer/Counter2 Control Register
8-BIT COMPARATOR
TIMER/COUNTER2
OUTPUT COMPARE
REGISTER2 (OCR2)
REGISTER (TIMSK)
TIMER INT. MASK
(TCNT2)
TCK2
CK
0
0
0
T/C2 OVER-
FLOW IRQ
T/C CLEAR
T/C CLK SOURCE
UP/DOWN
REGISTER (TIFR)
TIMER INT. FLAG
SYNCH UNIT
T/C2 COMPARE
MATCH IRQ
8-BIT ASYNCH T/C2 DATA BUS
8-BIT DATA BUS
REGISTER (TCCR2)
T/C2 CONTROL
CONTROL
LOGIC
REGISTER (ASSR)
ASYNCH. STATUS
ATmega161(L)
TCCR2”.
SPECIAL FUNCTIONS
IO REGISTER (SFIOR)
CK
TOSC1
41

Related parts for atmega161-4pi