AT90S/LS4434 and AT90S/LS8535
31
The clock source for Timer/Counter2 prescaler is named PCK2. PCK2 is by default connected to the main system clock
(CK). By setting the AS2 bit in ASSR, Timer/Counter2 prescaler is asynchronously clocked from the PC6(TOSC1) pin. This
enables use of Timer/Counter2 as a Real-time Clock (RTC). When AS2 is set, pins PC6(TOSC1) and PC7(TOSC2) are
disconnected from Port C. A crystal can then be connected between the PC6(TOSC1) and PC7(TOSC2) pins to serve as
an independent clock source for Timer/Counter2. The oscillator is optimized for use with a 32.768 kHz crystal. Alternatively,
an external clock signal can be applied to PC6(TOSC1). The frequency of this clock must be lower than one fourth of the
CPU clock and not higher than 256 kHz.
8-bit Timer/Counter0
Figure 30 shows the block diagram for Timer/Counter0.
The 8-bit Timer/Counter0 can select clock source from CK, prescaled CK or an external pin. In addition, it can be stopped
as described in the specification for the Timer/Counter0 Control Register (TCCR0). The overflow status flag is found in the
Timer/Counter Interrupt Flag Register (TIFR). Control signals are found in the Timer/Counter0 Control Register (TCCR0).
The interrupt enable/disable settings for Timer/Counter0 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/Counter0 features both a high-resolution and a high-accuracy usage with the lower prescaling opportuni-
ties. Similarly, the high prescaling opportunities make the Timer/Counter0 useful for lower speed functions or exact timing
functions with infrequent actions.
Figure 30.
Timer/Counter0 Block Diagram
8-BIT DA
T
A
BUS
T/C0 CONTROL
REGISTER (TCCR0)
TIMER/COUNTER0
(TCNT0)
0
7
T/C CLK SOURCE
CONTROL
LOGIC
CS02
CS01
CS00
CK
T/C0 OVER-
FLOW IRQ
TIMER INT. MASK
REGISTER (TIMSK)
TOIE0
TOIE1
OCIE1A
OCIE1B
TICIE1
TOIE2
OCIE2
TIMER INT. FLAG
REGISTER (TIFR)
TOV0
TOV1
OCF1A
OCF1B
ICF1
TOV2
OCF2
T0