atmega103 ATMEL Corporation, atmega103 Datasheet - Page 41

no-image

atmega103

Manufacturer Part Number
atmega103
Description
Atmega103 8-bit With 128k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
atmega103-6AC
Manufacturer:
ATMEL
Quantity:
1
Part Number:
atmega103-6AI
Manufacturer:
ATMEL
Quantity:
586
Part Number:
atmega103-6AI
Manufacturer:
Atmel
Quantity:
10 000
Timer/Counter0 Control
Register – TCCR0
Timer/Counter2 Control
Register – TCCR2
0945I–AVR–02/07
• Bit 7 – Res: Reserved Bit
This bit is a reserved bit in the ATmega103(L) and always reads as zero.
• Bit 6 – PWM0/PWM2: Pulse Width Modulator Enable
When set (one), this bit enables PWM mode for Timer/Counter0 or Timer/Counter2.
This mode is described on page 43.
• Bits 5, 4 – COM01, COM00/COM21, COM20: Compare Output Mode, Bits 1 and 0
The COMn1 and COMn0 control bits determine any output pin action following a com-
pare match in Timer/Counter2. Any output pin actions affect pins PB4 (OC0/PWM0) or
PB7 (OC2/PWM2). Since this is an alternative function to an I/O port, the corresponding
direction control bit must be set (one) to control an output pin. The control configuration
is shown in Table 10.
Table 10. Compare Mode Select
Note:
• Bit 3 – CTC0/CTC2: Clear Timer/Counter on Compare Match
When the CTC0 or CTC2 control bit is set (one), the Timer/Counter is reset to $00 in the
CPU clock cycle after a compare match. If the control bit is cleared, the Timer continues
counting and is unaffected by a compare match. Since the compare match is detected in
the CPU clock cycle following the match, this function will behave differently when a
prescaling higher than 1 is used for the Timer. When a prescaling of 1 is used and the
Compare Register is set to C, the Timer will count as follows if CTC0/2 is set:
... | C-2 | C-1 | C | 0 | 1 | ...
When the prescaler is set to divide by 8, the Timer will count like this:
... | C-2, C-2, C-2, C-2, C-2, C-2, C-2, C-2 | C-1, C-1, C-1, C-1, C-1, C-1, C-1, C-1 | C, 0,
0, 0, 0, 0, 0, 0 | 1, 1, 1, ...
Bit
33 ($53)
Read/Write
Initial Value
Bit
$25 ($45)
Read/Write
Initial Value
COMn1
0
0
1
1
n = 0 or 2
In PWM mode, these bits have a different function. Refer to Table 13 for a detailed
description.
COMn0
R
R
7
0
7
0
0
1
0
1
PWM0
PWM2
R/W
R/W
6
0
6
0
Description
Timer/Counter disconnected from output pin OCn/PWMn
Toggle the OCn/PWMn output line.
Clear the OCn/PWMn output line (to zero).
Set the OCn/PWMn output line (to one).
COM01
COM21
R/W
R/W
5
0
5
0
COM00
COM20
R/W
R/W
4
0
4
0
CTC0
CTC2
R/W
R/W
3
0
3
0
CS02
CS22
R/W
R/W
2
0
2
0
ATmega103(L)
CS01
CS21
R/W
R/W
1
0
1
0
CS00
CS20
R/W
R/W
0
0
0
0
TCCR0
TCCR2
41

Related parts for atmega103