Datasheet

155
ATmega169A/PA/329A/PA/649A/P/3290A/PA/6490A/P [DATASHEET]
8284E–AVR–02/2013
18.10.2 TCNT2 – Timer/Counter Register
The Timer/Counter Register gives direct access, both for read and write operations, to the Timer/Counter unit 8-bit
counter. Writing to the TCNT2 Register blocks (removes) the compare match on the following timer clock. Modify-
ing the counter (TCNT2) while the counter is running, introduces a risk of missing a compare match between
TCNT2 and the OCR2A Register.
18.10.3 OCR2A – Output Compare Register A
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.
18.10.4 ASSR – Asynchronous Status Register
Bit 4 – EXCLK: Enable External Clock Input
When EXCLK is written to one, and asynchronous clock is selected, the external clock input buffer is enabled and
an external clock can be input on Timer Oscillator 1 (TOSC1) pin instead of a 32kHz XTAL. Writing to EXCLK
should be done before asynchronous operation is selected. Note that the XTAL Oscillator will only run when this bit
is zero.
Bit 3 – AS2: Asynchronous Timer/Counter2
When AS2 is written to zero, Timer/Counter2 is clocked from the I/O clock, clk
I/O
. When AS2 is written to one,
Timer/Counter2 is clocked from an XTAL Oscillator connected to the Timer Oscillator 1 (TOSC1) pin. When the
value of AS2 is changed, the contents of TCNT2, OCR2A, and TCCR2A might be corrupted.
Bit 2 – TCN2UB: Timer/Counter2 Update Busy
When Timer/Counter2 operates asynchronously and TCNT2 is written, this bit becomes set. When TCNT2 has
been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates
that TCNT2 is ready to be updated with a new value.
Bit 1 – OCR2UB: Output Compare Register2 Update Busy
When Timer/Counter2 operates asynchronously and OCR2A is written, this bit becomes set. When OCR2A has
been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates
that OCR2A is ready to be updated with a new value.
Bit 76543210
(0xB2)
TCNT2[7:0] TCNT2
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value00000000
Bit 76543210
(0xB3)
OCR2A[7:0] OCR2A
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value00000000
Bit 76543 2 1 0
(0xB6)
EXCLK AS2 TCN2UB OCR2UB TCR2UB ASSR
Read/Write R R R R/W R/W R R R
Initial Value 0 0 0 0 0 0 0 0