Datasheet
103
7728G–AVR–06/10
ATtiny87/ATtiny167
The three Clock Select bits select the clock source to be used by the Timer/Counter, see
Table 10-5.
10.11.2 Timer/Counter0 Register – TCNT0
The Timer/Counter Register gives direct access, both for read and write operations, to the
Timer/Counter unit 8-bit counter. Writing to the TCNT0 Register blocks (removes) the Com-
pare 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
Register.
10.11.3 Output Compare Register A – OCR0A
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.
10.11.4 Asynchronous Status Register – ASSR
• Bit 7 – Res: Reserved Bit
This bit is reserved in the ATtiny87/167 and will always read as zero.
• Bit 6 – 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 XTAL1 pin instead of an external crys-
tal. Writing to EXCLK should be done before asynchronous operation is selected. Note that
the crystal oscillator will only run when this bit is zero.
Table 10-5. Clock Select Bit Description
CS02 CS01 CS00 Description
0 0 0 No clock source (Timer/Counter stopped).
001clk
T
0
S
(No prescaling)
010clk
T
0
S
/8 (From prescaler)
011clk
T
0
S
/32 (From prescaler)
100clk
T
0
S
/64 (From prescaler)
101clk
T
0
S
/128 (From prescaler)
110clk
T
0
S
/256 (From prescaler)
111clk
T
0
S
/1024 (From prescaler)
Bit 76543210
TCNT07 TCNT06 TCNT05 TCNT04 TCNT03 TCNT02 TCNT01 TCNT00 TCNT0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 00000000
Bit 76543210
OCR0A7 OCR0A6 OCR0A5 OCR0A4 OCR0A3 OCR0A2 OCR0A1 OCR0A0 OCR0A
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 00000000
Bit 7654 321 0
– EXCLK AS0 TCN0UB OCR0AUB – TCR0AUB TCR0BUB ASSR
Read/Write R R/W R/W R R R R R
Initial Value 0 0 0 0 0 0 0 0