beautypg.com

4 tcnt0 - timer/counter0 register, 5 ocr0a - timer/counter0 output compare register, Atmega128rfa1 – Rainbow Electronics ATmega128RFA1 User Manual

Page 241

background image

241


8266A-MCU Wireless-12/09

ATmega128RFA1

Register Bits

Value

Description

0x04

clk_IO/256 (from prescaler)

0x05

clk_IO/1024 (from prescaler)

0x06

External clock source on T0 pin, clock on
falling edge

0x07

External clock source on T0 pin, clock on
rising edge

17.9.4 TCNT0 – Timer/Counter0 Register

Bit

7

6

5

4

$26 ($46)

TCNT0_7

TCNT0_6

TCNT0_5

TCNT0_4

TCNT0

Read/Write

RW

RW

RW

RW

Initial Value

0

0

0

0

Bit

3

2

1

0

$26 ($46)

TCNT0_3

TCNT0_2

TCNT0_1

TCNT0_0

TCNT0

Read/Write

RW

RW

RW

RW

Initial Value

0

0

0

0

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

Bit 7:0 – TCNT0_7:0 - Timer/Counter0 Byte

17.9.5 OCR0A – Timer/Counter0 Output Compare Register

Bit

7

6

5

4

$27 ($47)

OCR0A_7

OCR0A_6

OCR0A_5

OCR0A_4

OCR0A

Read/Write

RW

RW

RW

RW

Initial Value

0

0

0

0

Bit

3

2

1

0

$27 ($47)

OCR0A_3

OCR0A_2

OCR0A_1

OCR0A_0

OCR0A

Read/Write

RW

RW

RW

RW

Initial Value

0

0

0

0

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

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