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

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
Special Function IO Register –
SFIOR
1228D–AVR–02/07
Figure 30. Timer/Counter2 Prescaler
The clock source for Timer/Counter2 prescaler is named PCK2. PCK2 is by default con-
nected to the main system clock (CK). By setting the AS2 bit in ASSR, Timer/Counter2
is asynchronously clocked from the PD4(TOSC1) pin. This enables use of
Timer/Counter2 as a Real-time Clock (RTC). When AS2 is set, pins PD4(TOSC1) and
PD5(TOSC2) are disconnected from Port D. A crystal can then be connected between
the PD4(TOSC1) and PD5(TOSC2) pins to serve as an independent clock source for
Timer/Counter2. The Oscillator is optimized for use with a 32.768 kHz crystal. Alterna-
tively, an external clock signal can be applied to PD4(TOSC1). The frequency of this
clock must be lower than one fourth of the CPU clock and not higher than 256 kHz. Set-
ting the PSR2 bit in SFIOR Resets the prescaler. This allows the user to operate with a
predictable prescaler.
• Bits 7..2 – Res: Reserved Bits
These bits are reserved bits in the ATmega161 and always read as zero.
• Bit 1
When this bit is set (one), the Timer/Counter2 prescaler will be reset. The bit will be
cleared by hardware after the operation is performed. Writing a zero to this bit will have
no effect. This bit will always be read as zero if Timer/Counter2 is clocked by the internal
CPU clock. If this bit is written when Timer/Counter2 is operating in asynchronous
mode, however, the bit will remain as one until the prescaler has been reset. See “Asyn-
chronous Operation of Timer/Counter2” on page 48 for a detailed description of
asynchronous operation.
Bit
$30 ($50)
Read/Write
Initial Value
TOSC1
PSR2: Prescaler Reset Timer/Counter2
PSR2
CS20
CS21
CS22
AS2
CK
R
7
0
R
6
0
PCK2
R
5
0
Clear
TIMER/COUNTER2 CLOCK SOURCE
R
4
0
0
R
3
0
10-BIT T/C PRESCALER
TCK2
R
2
0
ATmega161(L)
PSR2
R/W
1
0
PSR10
R/W
0
0
SFIOR
39

Related parts for atmega161-4pi