ATmega168PA Automotive Atmel Corporation, ATmega168PA Automotive Datasheet - Page 151
ATmega168PA Automotive
Manufacturer Part Number
ATmega168PA Automotive
Description
Manufacturer
Atmel Corporation
- Current page: 151 of 371
- Download datasheet (12Mb)
9223B–AVR–09/11
Figure 18-6. Fast PWM Mode, Timing Diagram
The Timer/Counter Overflow Flag (TOV2) is set each time the counter reaches TOP. If the
interrupt is enabled, the interrupt handler routine can be used for updating the compare value.
In fast PWM mode, the compare unit allows generation of PWM waveforms on the OC2x pin.
Setting the COM2x1:0 bits to two will produce a non-inverted PWM and an inverted PWM out-
put can be generated by setting the COM2x1:0 to three. TOP is defined as 0xFF when
WGM2:0 = 3, and OCR2A when MGM2:0 = 7. (See
OC2x value will only be visible on the port pin if the data direction for the port pin is set as out-
put. The PWM waveform is generated by setting (or clearing) the OC2x Register at the
compare match between OCR2x and TCNT2, and clearing (or setting) the OC2x Register at
the timer clock cycle the counter is cleared (changes from TOP to BOTTOM).
The PWM frequency for the output can be calculated by the following equation:
The N variable represents the prescale factor (1, 8, 32, 64, 128, 256, or 1024).
The extreme values for the OCR2A Register represent special cases when generating a PWM
waveform output in the fast PWM mode. If the OCR2A is set equal to BOTTOM, the output will
be a narrow spike for each MAX+1 timer clock cycle. Setting the OCR2A equal to MAX will
result in a constantly high or low output (depending on the polarity of the output set by the
COM2A1:0 bits.)
A frequency (with 50% duty cycle) waveform output in fast PWM mode can be achieved by
setting OC2x to toggle its logical level on each compare match (COM2x1:0 = 1). The wave-
form generated will have a maximum frequency of f
This feature is similar to the OC2A toggle in CTC mode, except the double buffer feature of the
Output Compare unit is enabled in the fast PWM mode.
f
OCnxPWM
TCNTn
OCnx
OCnx
Period
Atmel ATmega48PA/88PA/168PA [Preliminary]
=
-------------------- -
N
f
clk_I/O
1
256
2
3
4
5
oc2
Table 18-3 on page
6
= f
clk_I/O
7
/2 when OCR2A is set to zero.
OCRnx Interrupt Flag Set
OCRnx Update and
TOVn Interrupt Flag Set
(COMnx1:0 = 2)
(COMnx1:0 = 3)
158). The actual
151
Related parts for ATmega168PA Automotive
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Manufacturer:
Atmel Corporation
Datasheet:
Part Number:
Description:
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
MCU AVR 16K FLASH 20MHZ 32-TQFP
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
Manufacturer:
Atmel Corporation
Datasheet:
Part Number:
Description:
MCU AVR 16K FLASH 20MHZ 32-QFN
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
MCU AVR 16K FLASH 20MHZ 28-PDIP
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
MCU AVR 16KB FLASH 20MHZ 32TQFP
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
MCU AVR 16K FLASH 20MHZ 32-QFN
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
IC MCU AVR 16K FLASH 32TQFP
Manufacturer:
Atmel
Datasheet:
Part Number:
Description:
8-bit Microcontrollers - MCU Microcontroller
Manufacturer:
Atmel