7 compare match output unit – Rainbow Electronics ATtiny10 User Manual
Page 61

61
8127B–AVR–08/09
ATtiny4/5/9/10
11.7
Compare Match Output Unit
The Compare Output Mode (COM0x1:0) bits have two functions. The Waveform Generator uses
the COM0x1:0 bits for defining the Output Compare (OC0x) state at the next compare match.
Secondly the COM0x1:0 bits control the OC0x pin output source.
Figure 11-7 on page 61
shows
a simplified schematic of the logic affected by the COM0x1:0 bit setting. The I/O Registers, I/O
bits, and I/O pins in the figure are shown in bold. Only the parts of the general I/O port control
registers (DDR and PORT) that are affected by the COM0x1:0 bits are shown. When referring to
the OC0x state, the reference is for the internal OC0x Register, not the OC0x pin. If a system
reset occur, the OC0x Register is reset to “0”.
Figure 11-7. Compare Match Output Unit, Schematic (non-PWM Mode)
The general I/O port function is overridden by the Output Compare (OC0x) from the Waveform
Generator if either of the COM0x1:0 bits are set. However, the OC0x pin direction (input or out-
put) is still controlled by the Data Direction Register (DDR) for the port pin. The Data Direction
Register bit for the OC0x pin (DDR_OC0x) must be set as output before the OC0x value is visi-
ble on the pin. The port override function is generally independent of the Waveform Generation
mode, but there are some exceptions. See
Table 11-2 on page 74
,
Table 11-3 on page 74
and
Table 11-4 on page 74
for details.
The design of the Output Compare pin logic allows initialization of the OC0x state before the out-
put is enabled. Note that some COM0x1:0 bit settings are reserved for certain modes of
operation. See
“Register Description” on page 73
The COM0x1:0 bits have no effect on the Input Capture unit.
PORT
DDR
D
Q
D
Q
OCnx
Pin
OCnx
D
Q
Waveform
Generator
COMnx1
COMnx0
0
1
D
ATA
B
U
S
FOCnx
clk
I/O