12.07.2015 Views

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ATmega32A</strong>Register has been read. After a change of the edge, the Input Capture Flag (ICF1) must becleared by software (writing a logical one to the I/O bit location). For measuring frequency only,the clearing of the ICF1 Flag is not required (if an interrupt handler is used).16.6.4 Output Compare UnitsThe 16-bit comparator continuously compares TCNT1 with the Output Compare Register(OCR1x). If TCNT equals OCR1x the comparator signals a match. A match will set the OutputCompare Flag (OCF1x) at the next timer clock cycle. If enabled (OCIE1x = 1), the Output CompareFlag generates an output compare interrupt. The OCF1x Flag is automatically clearedwhen the interrupt is executed. Alternatively the OCF1x Flag can be cleared by software by writinga logical one to its I/O bit location. The Waveform Generator uses the match signal togenerate an output according to operating mode set by the Waveform Generation mode(WGM13:0) bits and Compare Output mode (COM1x1:0) bits. The TOP and BOTTOM signalsare used by the Waveform Generator for handling the special cases of the extreme values insome modes of operation (See “Modes of Operation” on page 103.)A special feature of output compare unit A allows it to define the Timer/Counter TOP value (thatis, counter resolution). In addition to the counter resolution, the TOP value defines the periodtime for waveforms generated by the Waveform Generator.Figure 16-4 shows a block diagram of the output compare unit. The small “n” in the register andbit names indicates the device number (n = 1 for Timer/Counter1), and the “x” indicates outputcompare unit (A/B). The elements of the block diagram that are not directly a part of the outputcompare unit are gray shaded.Figure 16-4.Output Compare Unit, Block DiagramDATA BUS (8-bit)TEMP (8-bit)OCRnxH Buf. (8-bit)OCRnxL Buf. (8-bit)TCNTnH (8-bit)TCNTnL (8-bit)OCRnx Buffer (16-bit Register)TCNTn (16-bit Counter)OCRnxH (8-bit)OCRnxL (8-bit)OCRnx (16-bit Register)= (16-bit Comparator )OCFnx (Int.Req.)TOPBOTTOMWaveform GeneratorOCnxWGMn3:0COMnx1:0The OCR1x Register is double buffered when using any of the twelve Pulse Width Modulation(PWM) modes. For the normal and Clear Timer on Compare (CTC) modes of operation, the doublebuffering is disabled. The double buffering synchronizes the update of the OCR1x Compare8155C–AVR–02/11100

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

Saved successfully!

Ooh no, something went wrong!