12.07.2015 Views

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ATmega32A</strong>17.10 Timer/Counter PrescalerFigure 17-12. Prescaler for Timer/Counter2clk I/OTOSC1AS2clkT2SClearclk T2S /810-BIT T/C PRESCALERclk T2S /32clk T2S /64clk T2S /128clk T2S /256clk T2S /1024PSR20CS20CS21CS22TIMER/COUNTER2 CLOCK SOURCEclk T2The clock source for Timer/Counter2 is named clk T2S . clk T2S is by default connected to the mainsystem I/O clock clk IO . By setting the AS2 bit in ASSR, Timer/Counter2 is asynchronouslyclocked from the TOSC1 pin. This enables use of Timer/Counter2 as a Real Time Counter(RTC). When AS2 is set, pins TOSC1 and TOSC2 are disconnected from Port C. A crystal canthen be connected between the TOSC1 and TOSC2 pins to serve as an independent clocksource for Timer/Counter2. The Oscillator is optimized for use with a 32.768kHz crystal. Applyingan external clock source to TOSC1 is not recommended.For Timer/Counter2, the possible prescaled selections are: clk T2S /8, clk T2S /32, clk T2S /64,clk T2S /128, clk T2S /256, and clk T2S /1024. Additionally, clk T2S as well as 0 (stop) may be selected.Setting the PSR2 bit in SFIOR resets the prescaler. This allows the user to operate with a predictableprescaler.17.11 Register Description17.11.1 TCCR2 – Timer/Counter Control RegisterBit 7 6 5 4 3 2 1 0FOC2 WGM20 COM21 COM20 WGM21 CS22 CS21 CS20 TCCR2Read/Write W R/W R/W R/W R/W R/W R/W R/WInitial Value 0 0 0 0 0 0 0 0• Bit 7 – FOC2: Force Output CompareThe FOC2 bit is only active when the WGM bits specify a non-PWM mode. However, for ensuringcompatibility with future devices, this bit must be set to zero when TCCR2 is written whenoperating in PWM mode. When writing a logical one to the FOC2 bit, an immediate comparematch is forced on the waveform generation unit. The OC2 output is changed according to itsCOM21:0 bits setting. Note that the FOC2 bit is implemented as a strobe. Therefore it is thevalue present in the COM21:0 bits that determines the effect of the forced compare.8155C–AVR–02/11132

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!