46
ATmega161(L)
1228B–09/01
Figure 35.
Effects of Unsynchronized OCR Latching in Overflow Mode.
Note:
n = 0 or 2 (Figure 34 and Figure 35)
During the time between the write and the latch operation, a read from the Output Com-
pare Registers will read the contents of the temporary location. This means that the
most recently written value always will read out of OCR0 and OCR2.
When the Output Compare Register contains $00 or $FF, and the up/down PWM mode
is selected, the output PB0(OC0/PWM0)/PB1(OC2/PWM2) is updated to low or high on
the next compare match according to the settings of COMn1/COMn0. This is shown in
Table 13. In overflow PWM mode, the output PB0(OC0/PWM0)/PB1(OC2/PWM2) is
held low or high only when the Output Compare Register contains $FF.
Note:
1. n = 0 or 2
2. In overflow PWM mode, the table above is only valid for OCRn = $FF.
In up/down PWM mode, the Timer Overflow Flag (TOV0 or TOV2) is set when the
counter advances from $00. In overflow PWM mode, the Timer Overflow Flag is set as
in normal Timer/Counter mode. Timer Overflow Interrupt0 and 2 operate exactly as in
normal Timer/Counter mode, i.e., they are executed when TOV0 or TOV2 are set, pro-
vided that Timer Overflow Interrupt and global interrupts are enabled. This also applies
to the Timer Output Compare flag and interrupt.
Asynchronous Status
Register – ASSR
• Bits 7..4
–
Res: Reserved Bits
These bits are reserved bits in the ATmega161 and always read as zero.
Table 13.
PWM Outputs OCRn = $00 or $FF
COMn1
COMn0
OCRn
Output PWMn
1
0
$00
L
1
0
$FF
H
1
1
$00
H
1
1
$FF
L
PWM Output OCn
PWM Output OCn
Unsynchronized OCn Latch
Synchronized OCn Latch
Counter Value
Compare Value
Counter Value
Compare Value
Compare Value changes
Compare Value changes
Glitch
Bit
7
6
5
4
3
2
1
0
$26 ($46)
–
–
–
–
AS2
TCN2UB
OCR2UB
TCR2UB
ASSR
Read/Write
R
R
R
R
R/W
R
R
R
Initial Value
0
0
0
0
0
0
0
0