beautypg.com

Timer / counters, Timer/counter prescalers, Atmega163(l) – Rainbow Electronics ATmega163L User Manual

Page 33

background image

ATmega163(L)

33

Bit 3 - ACME: Analog Comparator Multiplexer Enable

When this bit is set (one) and the ADC is switched off (ADEN in ADCSR is zero), the ADC multiplexer selects the negative
input to the Analog Comparator. When this bit is cleared (zero), AIN1 is applied to the negative input of the Analog Compar-
ator. For a detailed description of this bit, see “Analog Comparator Multiplexed Input” on page 89.

Bit 2 - PUD: Pull-up Disable

When this bit is set (one), all pull-ups on all ports are disabled. If the bit is cleared (zero), the pull-ups can be individually
enabled as described in the chapter “I/O-Ports” on page 99

Bit 1 - PSR2: Prescaler Reset Timer/Counter2

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. The bit will remain
one until the prescaler has been reset. See “Asynchronous Operation of Timer/Counter2” on page 49 for a detailed descrip-
tion of asynchronous operation.

Bit 0 - PSR10: Prescaler Reset Timer/Counter1 and Timer/Counter0

When this bit is set (one) the Timer/Counter1 and Timer/Counter0 prescaler will be reset. The bit will be cleared by hard-
ware after the operation is performed. Writing a zero to this bit will have no effect. Note that Timer/Counter1 and
Timer/Counter0 share the same prescaler and a reset of this prescaler will affect both timers. This bit will always be read as
zero.

Timer / Counters

The ATmega163 provides three general purpose Timer/Counters - two 8-bit T/Cs and one 16-bit T/C. Timer/Counter2 can
optionally be asynchronously clocked from an external oscillator. This oscillator is optimized for use with a 32.768 kHz
watch crystal, enabling use of Timer/Counter2 as a Real Time Clock (RTC). Timer/Counters 0 and 1 have individual pres-
caling selection from the same 10-bit prescaler. Timer/Counter2 has its own prescaler. Both these prescalers can be reset
by setting the corresponding control bits in the Special Functions IO Register (SFIOR). These Timer/Counters can either be
used as a timer with an internal clock time-base or as a counter with an external pin connection which triggers the counting.

Timer/Counter Prescalers

Figure 30. Prescaler for Timer/Counter0 and Timer/Counter1

For Timer/Counters 0 and 1, the four different prescaled selections are: CK/8, CK/64, CK/256, and CK/1024, where CK is
the oscillator clock. For the two Timer/Counters 0 and 1, CK, external source, and stop can also be selected as clock

PSR10

Clear

TCK1

TCK0