
81
ATmega8515(L)
2512A–AVR–04/02
Compare Match Output
Unit
The Compare Output mode (COM01:0)bitshave two functions.The Waveform Genera-
tor uses the COM01:0 bitsfordefining the Output Compare (OC0)state at thenext
comparematch.Also, the COM01:0 bitscontrol the OC0 pin output source. Figure 36
shows a simplified schematic of the logic affectedbythe COM01:0 bit setting. The I/O
Registers, I/Obits, andI/Opins in the figureare showninbold. Only the parts of the
generalI/Oport Control Registers (DDRand PORT) that areaffectedbythe COM01:0
bits are shown. When referring to the OC0 state, the referenceisfor theinternalOC0
Register, not the OC0 pin. If a System Reset occur, the OC0Register isreset to “0”.
Figure 36. Compare Match Output Unit,Schematics
The generalI/Oport function is overridden by the output compare (OC0)from the Wave-
form Generator if either of the COM01:0 bits are set. However, the OC0 pin direction
(input or output) isstill controlledbythe Data Direction Register(DDR)for the port pin.
The Data Direction Registerbit for the OC0 pin (DDR_OC0) must be set as output
beforethe OC0value is visibleonthe pin. The portoverride function is independent of
the Waveform Generation mode.
The design of theoutput compare pin logic allows initialization of the OC0 state before
the output is enabled. Note that some COM01:0 bit settings are reservedforcertain
modes of operation. See “8-bit Timer/Counter RegisterDescription” on page 87.
Compare Output Mode and
Waveform Generation
The waveformgenerator uses the COM01:0 bitsdifferently in Normal, CTC, and PWM
modes. For all modes, setting the COM01:0 = 0tells the Waveform Generator that no
action on the OC0Register is to be performed on thenext comparematch. Forcompare
output actions in the non-PWM modesrefer to Table45onpage 88. ForfastPWM
mode,refer to Table46 on page 89, andforphase correctPWM refer to Table47 on
page 89.
A change of the COM01:0 bitsstate will have effectatthe first comparematch after the
bits are written. For non-PWM modes, theaction can be forced to have immediate effect
by using the FOC0 strobe bits.
PORT
DDR
DQ
DQ
OCn
Pin
OCn
DQ
Waveform
Generator
COMn1
COMn0
0
1
DATA BU S
FOCn
clk
I/O
Commentaires sur ces manuels