beautypg.com

Bit timer/counters t/c0 and t/c2 – Rainbow Electronics ATmega103L User Manual

Page 36

background image

ATmega603/103

36

The clock source for Timer/Counter0 prescaler is named PCK0. PCK0 is by default connected to the main system clock
CK. Observe that CPU clock frequency can be lower than the XTAL frequency if the XTAL divider is enabled. By setting the
AS0 bit in ASSR, Timer/Counter 0 prescaler is asynchronously clocked from the TOSC1 pin. This enables use of
Timer/Counter0 as a Real Time Clock (RTC). A crystal can be connected between the TOSC1 and TOSC2 pins to serve as
an independent clock source for Timer/Counter0. This oscillator is optimized for use with a 32.768 kHz crystal.

8-bit Timer/Counters T/C0 and T/C2

Figure 30 shows the block diagram for Timer/Counter0.

Figure 30. Timer/Counter0 Block Diagram

8-BIT DATA BUS

8-BIT ASYNCH T/C0 DATA BUS

ASYNCH. STATUS

REGISTER (ASSR)

TIMER INT. FLAG

REGISTER (TIFR)

TIMER/COUNTER0

(TCNT0)

SYNCH UNIT

8-BIT COMPARATOR

OUTPUT COMPARE
REGISTER0 (OCR0)

TIMER INT. MASK

REGISTER (TIMSK)

0

0

0

7

7

7

T/C CLK SOURCE

UP/DOWN

T/C CLEAR

CONTROL

LOGIC

OCF0

TO

V

0

TO

V

1

OCF2A

OCF2B

ICF1

TO

V

2

OCF2

OCF0

TO

V

0

OCIE0

T

OIE0

T

OIE1

OCIE1A

OCIE1B

TICIE1

T

OIE2

OCIE2

OCR0UB

TC0UB

ICR0UB

PCK0

CK

TCK0

T/C0 OVER-

FLOW IRQ

T/C0 COMPARE

MATCH IRQ

T/C0 CONTROL

REGISTER (TCCR0)

CS02

COM01

PWM0

AS0

CS01

COM00

CS00

CTC0