5 tcnt2 - timer/counter2, 6 ocr2a - timer/counter2 output compare register a, 7 ocr2b - timer/counter2 output compare register b – Rainbow Electronics ATmega128RFA1 User Manual

Page 327: Atmega128rfa1

Advertising
background image

327


8266A-MCU Wireless-12/09

ATmega128RFA1

the counter even if the pin is configured as an output. This feature allows software
control of the counting.

Table 21-10 CS2 Register Bits

Register Bits

Value

Description

0x00

No clock source (Timer/Counter2 stopped)

0x01

clk_T2S/1 (no prescaling)

0x02

clk_T2S/8 (from prescaler)

0x03

clk_T2S/32 (from prescaler)

0x04

clk_T2S/64 (from prescaler)

0x05

clk_T2S/128 (from prescaler)

0x06

clk_T2S/256 (from prescaler)

CS22:20

0x07

clk_T2S/1024 (from prescaler)

21.11.5 TCNT2 – Timer/Counter2

Bit

7

6

5

4

3

2

1

0

NA ($B2)

TCNT27:20

TCNT2

Read/Write

RW

RW

RW

RW

RW

RW

RW

RW

Initial Value

0

0

0

0

0

0

0

0

The Timer/Counter Register gives direct access, both for read and write operations, to
the 8-bit counter unit of the Timer/Counter2. Writing to the TCNT2 Register blocks
(removes) the Compare Match on the following timer clock. Modifying the counter
(TCNT2) while the counter is running, introduces a risk of missing a Compare Match
between TCNT2 and the OCR2x Registers.

Bit 7:0 – TCNT27:20 - Timer/Counter2 Byte

21.11.6 OCR2A – Timer/Counter2 Output Compare Register A

Bit

7

6

5

4

3

2

1

0

NA ($B3)

OCR2A7:0

OCR2A

Read/Write

RW

RW

RW

RW

RW

RW

RW

RW

Initial Value

0

0

0

0

0

0

0

0

The Output Compare Register A contains an 8-bit value that is continuously compared
with the counter value (TCNT2). A match can be used to generate an Output Compare
interrupt, or to generate a waveform output on the OC2A pin.

Bit 7:0 – OCR2A7:0 - Output Compare Register

21.11.7 OCR2B – Timer/Counter2 Output Compare Register B

Bit

7

6

5

4

3

2

1

0

NA ($B4)

OCR2B7:0

OCR2B

Read/Write

RW

RW

RW

RW

RW

RW

RW

RW

Initial Value

0

0

0

0

0

0

0

0

Advertising