Datasheet
Figure 20-5. Compare Match Output Unit, Schematic
PORT
DDR
D Q
D Q
OCnx
Pin
OCnx
D Q
Waveform
Generator
COMnx[1]
COMnx[0]
0
1
DATA BUS
FOCnx
clk
I/O
Note: The “n” in the register and bit names indicates the device number (n = 1 for Timer/Counter 1), and
the “x” indicates output compare unit (A/B).
The general I/O port function is overridden by the Output Compare (OC1x) from the waveform generator
if either of the TCCR1A.COM1x[1:0] bits are set. However, the OC1x pin direction (input or output) is still
controlled by the Data Direction Register (DDR) for the port pin. The DDR bit for the OC1x pin
(DDR_OC1x) must be set as output before the OC1x value is visible on the pin. The port override
function is generally independent of the waveform generation mode, but there are some exceptions.
The design of the output compare pin logic allows initialization of the OC1x state before the output is
enabled. Note that some TCCR1A.COM1x[1:0] bit settings are reserved for certain modes of operation.
The TCCR1A.COM1x[1:0] bits have no effect on the input capture unit.
20.11.1 Compare Output Mode and Waveform Generation
The waveform generator uses the TCCR1A.COM1x[1:0] bits differently in normal, CTC, and PWM
modes. For all modes, setting the TCCR1A.COM1x[1:0] = 0 tells the waveform generator that no action
on the OC1x register is to be performed on the next compare match. Refer also to the descriptions of the
output modes.
A change of the TCCR1A.COM1x[1:0] bits state will have effect at the first compare match after the bits
are written. For non-PWM modes, the action can be forced to have immediate effect by using the
TCCR1C.FOC1x strobe bits.
20.12 Modes of Operation
The mode of operation, i.e., the behavior of the timer/counter and the output compare pins, is defined by
the combination of the Waveform Generation mode (WGM1[3:0]) and Compare Output mode
(TCCR1A.COM1x[1:0]) bits. The Compare Output mode bits do not affect the counting sequence, while
the Waveform Generation mode bits do. The TCCR1A.COM1x[1:0] bits control whether the PWM output
generated should be inverted or not (inverted or non-inverted PWM). For non-PWM modes the
TCCR1A.COM1x[1:0] bits control whether the output should be set, cleared, or toggle at a compare
match.
ATmega48PA/88PA/168PA
16-bit Timer/Counter1 (TC1) with PWM
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40002011A-page 172