Datasheet

139
7766F–AVR–11/10
ATmega16/32U4
Figure 15-1. Timer/Counter4 Block Diagram
15.2.1 Speed
The maximum speed of the Timer/Counter4 is 64 MHz. However, if a supply voltage below 4
volts is used, it is recommended to decrease the input frequency, because the Timer/Counter4
is not running fast enough on low voltage levels.
15.2.2 Accuracy
The Timer/Counter4 is a 10-bit Timer/Counter module that can alternatively be used as an 8-bit
Timer/Counter. The Timer/Counter4 registers are basically 8-bit registers, but on top of that
there is a 2-bit High Byte Register (TC4H) that can be used as a common temporary buffer to
access the two MSBs of the 10-bit Timer/Counter4 registers by the AVR CPU via the 8-bit data
bus, if the 10-bit accuracy is used. Whereas, if the two MSBs of the 10-bit registers are written to
zero the Timer/Counter4 is working as an 8-bit Timer/Counter. When reading the low byte of any
8-bit register the two MSBs are written to the TC4H register, and when writing the low byte of
any 8-bit register the two MSBs are written from the TC4H register. Special procedures must be
followed when accessing the 10-bit Timer/Counter4 values via the 8-bit data bus. These proce-
dures are described in the section “Accessing 10-Bit Registers” on page 159.
The Enhanced PWM mode allows to add a resolution bit to each Compare register A/B/D, while
the output frequency remains identical to a Normal PWM mode. That means that the TC4H reg-
ister contains one more bit that will be the MSB in a 11-bits enhanced PWM operation. See the
section “Enhanced Compare/PWM mode” on page 148 for details about this feature and how to
use it.
8-BIT DATABUS
T/C INT. FLAG
REGISTER (TIFR4)
10-BIT COMPARATOR
8-BIT OUTPUT COMPARE
REGISTER A (OCR4A)
T/C INT. MASK
REGISTER (TIMSK4)
TIMER/COUNTER4
(TCNT4)
DIRECTION
TIMER/COUNTER4 CONTROL LOGIC
OCF4B
TOV4
TOIE4
OCIE4B
OCIE4A
OCF4A
TOV4 OCF4B OC4AOCF4A
T/C CONTROL
REGISTER A (TCCR4A)
COM4B1
PWM4A
PWM4B
COM4B0
FOC4A
FOC4B
10-BIT COMPARATOR
8-BIT OUTPUT COMPARE
REGISTER B (OCR4B)
COM4A1
COM4A0
T/C CONTROL
REGISTER B (TCCR4B)
CS42
PSR4
CS41
CS40
CS43
OC4A
OC4B
OC4B
DEAD TIME GENERATOR
DEAD TIME GENERATOR
10-BIT COMPARATOR
8-BIT OUTPUT COMPARE
REGISTER C (OCR4C)
10-BIT COMPARATOR
8-BIT OUTPUT COMPARE
REGISTER D (OCR4D)
COM4A1
PWM4D
COM4A0
FOC4D
T/C CONTROL
REGISTER C (TCCR4C)
OCF4D
OCF4D
OCIE4D
OC4D
OC4D
DEAD TIME GENERATOR
PSR4
PSR4
OCW4A
OCW4B
OCW
4D
2-BIT HIGH BYTE
REGISTER (TC4H)
WGM41
FPEN4
T/C CONTROL
REGISTER D (TCCR4E)
COM4B1
COM4B0
COM4D1
COM4D0
FPNC4
FPES4
FPAC4
10-BIT OUTPUT
COMPARE REGISTER B
10-BIT OUTPUT
COMPARE REGISTER C
10-BIT OUTPUT
COMPARE REGISTER D
10-BIT OUTPUT
COMPARE REGISTER A
CLEAR
COUNT
CLK
T/C CONTROL
REGISTER C (TCCR4D)
FAULT_PROTECTION
WGM40
FPIE4
FPF4
OC4OE5
OC4OE4
OC4OE3
OC4OE2
OC4OE1
OC4OE0
FPIE4
FPF4