Rainbow-electronics ATmega128L Uživatelský manuál Strana 153

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 331
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 152
153
ATmega128(L)
2467B09/01
If external pin modes are used for the Timer/Counter2, transitions on the T2 pin will
clock the counter even if the pin is configured as an output. This feature allows software
control of the counting.
Timer/Counter Register
TCNT2
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. Modifying the counter (TCNT2) while the
counter is running, introduces a risk of missing a compare match between TCNT2 and
the OCR2 register.
Output Compare Register
OCR2
The Output Compare Register 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 OC2 pin.
Timer/Counter Interrupt Mask
Register TIMSK
Bit 7- OCIE2: Timer/Counter2 Output Compare Match Interrupt Enable
When the OCIE2 bit is written to one, and the I-bit in the Status Register is set (one), the
Timer/Counter2 Compare Match interrupt is enabled. The corresponding interrupt is
executed if a compare match in Timer/Counter2 occurs, i.e. when the OCF2 bit is set in
the Timer/Counter Interrupt Flag Register TIFR.
Table 68. Clock Select Bit Description
CS22 CS21 CS20 Description
0 0 0 No clock source (Timer/counter stopped)
001
clk
I/O
/(No prescaling)
010
clk
I/O
/8 (From prescaler)
011clk
I/O
/32 (From prescaler)
100
clk
I/O
/256 (From prescaler)
101
clk
I/O
/1024 (From prescaler)
1 1 0 External clock source on T2 pin. Clock on falling edge
1 1 1 External clock source on T2 pin. Clock on rising edge
Bit 76543210
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
OCR2[7:0] OCR2
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial value00000000
Bit 76543210
OCIE2 TOIE2 TICIE1 OCIE1A OCIE1B TOIE1 OCIE0 TOIE0 TIMSK
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial value00000000
Zobrazit stránku 152
1 2 ... 148 149 150 151 152 153 154 155 156 157 158 ... 330 331

Komentáře k této Příručce

Žádné komentáře