atmega163l ATMEL Corporation, atmega163l Datasheet - Page 53

no-image

atmega163l

Manufacturer Part Number
atmega163l
Description
Atmega163 8-bit Avr Microcontroller With 16k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
atmega163l-4AI
Manufacturer:
ATMEL
Quantity:
984
Timer/Counter2 – TCNT2
1142E–AVR–02/03
• Bit 3 – CTC2: Clear Timer/Counter on Compare Match
When the CTC2 control bit is set (one), Timer/Counter2 is Reset to $00 in the CPU clock
cycle following a Compare Match. If the control bit is cleared, the Timer/Counter2 contin-
ues counting and is unaffected by a Compare Match. When a prescaling of 1 is used,
and the Compare Register is set to C, the Timer will count as follows if CTC2 is set:
... | C-1 | C | 0 | 1 |...
When the prescaler is set to divide by eight, the Timer will count like this:
... | C-1, C-1, C-1, C-1, C-1, C-1, C-1, C-1 | C, C, C, C, C, C, C, C | 0, 0, 0, 0, 0, 0, 0, 0 |
1, 1, 1, ...
In PWM mode, this bit has a different function. If the CTC2 bit is cleared in PWM mode,
the Timer/Counter acts as an up/down counter. If the CTC2 bit is set (one), the
Timer/Counter wraps when it reaches $FF. Refer to page 54 for a detailed description.
• Bits 2, 1, 0 – CS22, CS21, CS20: Clock Select Bits 2, 1, and 0
The Clock Select bits 2, 1, and 0 define the prescaling source of Timer/Counter2.
Table 20. Timer/Counter2 Prescale Select
The Stop condition provides a Timer Enable/Disable function. The prescaled modes are
scaled directly from the PCK2 clock.
This 8-bit register contains the value of Timer/Counter2.
Timer/Counters2 is implemented as an up or up/down (in PWM mode) counter with read
and write access. If the Timer/Counter2 is written to and a clock source is selected, it
continues counting in the timer clock cycle following the write operation.
Bit
$24 ($44)
Read/Write
Initial Value
CS22
0
0
0
0
1
1
1
1
MSB
R/W
7
0
CS21
0
0
1
1
0
0
1
1
R/W
6
0
R/W
CS20
5
0
0
1
0
1
0
1
0
1
R/W
4
0
Description
Timer/Counter2 is stopped.
PCK2
PCK2/8
PCK2/32
PCK2/64
PCK2/128
PCK2/256
PCK2/1024
R/W
3
0
R/W
2
0
ATmega163(L)
R/W
1
0
LSB
R/W
0
0
TCNT2
53

Related parts for atmega163l