
103
ATmega8515(L)
2512A–AVR–04/02
measuring frequency only, the clearing of the ICF1 flag is not required(if an interrupt
handler is used).
Output Compare Units The16-bit comparatorcontinuously compares TCNT1 with the
Output Compare Regis-
ter
(OCR1x). If TCNTequals OCR1x the comparatorsignals amatch.Amatch will set
the
Output Compare Flag
(OCF1x) at thenexttimerclock cycle. If enabled(OCIE1x=
1), theoutput compare flag generates an output compareinterrupt. The OCF1xflag is
automatically clearedwhen theinterruptis executed.Alternatively the OCF1xflag can
be clearedbysoftware by writing a logical onetoitsI/Obit location. The waveform gen-
erator uses thematch signal to generateanoutput according to operating mode set by
the
Waveform Generation mode
(WGM13:0)bits and
Compare Output mode
(COM1x1:0)bits.TheTOPandBOTTOM signals areusedbythe waveform generator
forhandling the specialcases of theextreme values in some modes of operation. See
“Modes ofOperation” on page 106.
A specialfeatureof output compareunitAallows it to define theTimer/Counter TOP
value (i.e.,counterresolution). Inadditiontothe counterresolution, theTOPvalue
defines the period time forwaveforms generatedbythe waveform generator.
Figure49shows a block diagram of the output compareunit.The small “n” in the regis-
ter andbit names indicates the devicenumber(n = 1 for Timer/Counter1), and the“x”
indicates output compare unit (A/B).Theelements of the block diagram that are not
directly a partof the output compare unit aregrayshaded.
Figure 49. Output Compare Unit,Block Diagram
The OCR1xregister isdouble bufferedwhen using any of thetwelve
Pulse Width Modu-
lation
(PWM) modes. For thenormal and
Clear Timer on Compare
(CTC) modes of
operation, the double buffering isdisabled.The double buffering synchronizes the
update of the OCR1xCompare Register to either TOPorBOTTOM of the counting
OCFnx (Int.Req.)
=
(16-bit Comparator )
OCRnx Buffer (16-bit Register)
OCRnxH Buf. (8-bit)
OCnx
TEMP (8-bit)
DATA BUS
(8-bit)
OCRnxL Buf. (8-bit)
TCNTn (16-bit Counter)
TCNTnH (8-bit) TCNTnL (8-bit)
COMnx1:0WGMn3:0
OCRnx (16-bit Register)
OCRnxH (8-bit) OCRnxL (8-bit)
Waveform Generator
TOP
BOTTOM
Commentaires sur ces manuels