AT90S/LS4434 and AT90S/LS8535
40
8-bit Timer/Counter2
Figure 34 shows the block diagram for Timer/Counter2.
Figure 34.
Timer/Counter2 Block Diagram
The 8-bit Timer/Counter2 can select clock source from PCK2 or prescaled PCK2. It can also be stopped as described in
the specification for the Timer/Counter Control Register (TCCR2).
The different 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 (TCCR2). The interrupt enable/disable settings are found
in the Timer/Counter Interrupt Mask Register (TIMSK).
This module features a high-resolution and a high-accuracy usage with the lower prescaling opportunities. Similarly, the
high prescaling opportunities make this unit useful for lower speed functions or exact timing functions with infrequent
actions.
The Timer/Counter supports an Output Compare function using the Output Compare Register (OCR2) as the data source
to be compared to the Timer/Counter contents.The Output Compare function includes optional clearing of the counter on
compare match and action on the Output Compare Pin, PD7(OC2), on compare match. Writing to PORTD7 does not set
the OC2 value to a predetermined value.
Timer/Counter2 can also be used as an 8-bit Pulse Width Modulator. In this mode, Timer/Counter2 and the Output Com-
pare Register serve as a glitch-free, stand-alone PWM with centered pulses. Refer to page 42 for a detailed description of
this function.
8-BIT DATA BUS
8-BIT ASYNCH T/C2 DATA BUS
ASYNCH. STATUS
REGISTER (ASSR)
TIMER INT. FLAG
REGISTER (TIFR)
TIMER/COUNTER2
(TCNT2)
SYNCH UNIT
8-BIT COMPARATOR
OUTPUT COMPARE
REGISTER2 (OCR2)
TIMER INT. MASK
REGISTER (TIMSK)
0
0
0
7
7
7
T/C CLK SOURCE
UP/DOWN
T/C CLEAR
CONTROL
LOGIC
TOV0
TOV1
OCF1B
OCF1A
ICF1
TOV2
OCF2
OCF2
TOV2
TOIE0
TOIE1
OCIE1A
OCIE1B
TICIE1
TOIE2
OCIE2
OCR2UB
TC2UB
ICR2UB
TOSC1
CK
PCK2
T/C2 OVER-
FLOW IRQ
T/C2 COMPARE
MATCH IRQ
T/C2 CONTROL
REGISTER (TCCR2)
CS22
COM21
PWM2
AS2
CS21
COM20
CS20
CTC2
CK