ATMEGA324P-A15MZ Atmel, ATMEGA324P-A15MZ Datasheet - Page 74

MCU AVR 32KB FLASH 15MHZ 44-VQFN

ATMEGA324P-A15MZ

Manufacturer Part Number
ATMEGA324P-A15MZ
Description
MCU AVR 32KB FLASH 15MHZ 44-VQFN
Manufacturer
Atmel
Series
AVR® ATmegar
Datasheet

Specifications of ATMEGA324P-A15MZ

Package / Case
44-VQFN Exposed Pad
Voltage - Supply (vcc/vdd)
2.7 V ~ 5.5 V
Operating Temperature
-40°C ~ 125°C
Speed
16MHz
Number Of I /o
32
Eeprom Size
1K x 8
Core Processor
AVR
Program Memory Type
FLASH
Ram Size
2K x 8
Program Memory Size
32KB (32K x 8)
Data Converters
A/D 8x10b
Oscillator Type
Internal
Peripherals
Brown-out Detect/Reset, POR, PWM, WDT
Connectivity
I²C, SPI, UART/USART
Core Size
8-Bit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Clear Timer on
Compare Match (CTC)
Mode
74
ATmega32(L)
timer clock cycle as the TCNT0 becomes zero. The
bit, except that it is only set, not cleared. However, combined with the timer overflow interrupt
that automatically clears the
There are no special cases to consider in the normal mode, a new counter value can be written
anytime.
The output compare unit can be used to generate interrupts at some given time. Using the out-
put compare to generate waveforms in Normal mode is not recommended, since this will occupy
too much of the CPU time.
In Clear Timer on Compare or CTC mode (WGM01:0 = 2), the OCR0 Register is used to manip-
ulate the counter resolution. In CTC mode the counter is cleared to zero when the counter value
(TCNT0) matches the OCR0. The OCR0 defines the top value for the counter, hence also its
resolution. This mode allows greater control of the compare match output frequency. It also sim-
plifies the operation of counting external events.
The timing diagram for the CTC mode is shown in
increases until a compare match occurs between TCNT0 and OCR0, and then counter (TCNT0)
is cleared.
Figure 31. CTC Mode, Timing Diagram
An interrupt can be generated each time the counter value reaches the TOP value by using the
OCF0 Flag. If the interrupt is enabled, the interrupt handler routine can be used for updating the
TOP value. However, changing TOP to a value close to BOTTOM when the counter is running
with none or a low prescaler value must be done with care since the CTC mode does not have
the double buffering feature. If the new value written to OCR0 is lower than the current value of
TCNT0, the counter will miss the compare match. The counter will then have to count to its max-
imum value (0xFF) and wrap around starting at 0x00 before the compare match can occur.
For generating a waveform output in CTC mode, the OC0 output can be set to toggle its logical
level on each compare match by setting the Compare Output mode bits to toggle mode
(COM01:0 = 1). The OC0 value will not be visible on the port pin unless the data direction for the
pin is set to output. The waveform generated will have a maximum frequency of f
when OCR0 is set to zero (0x00). The waveform frequency is defined by the following equation:
The N variable represents the prescale factor (1, 8, 64, 256, or 1024).
As for the Normal mode of operation, the TOV0 Flag is set in the same timer clock cycle that the
counter counts from MAX to 0x00.
TCNTn
OCn
(Toggle)
Period
1
TOV
0 Flag, the timer resolution can be increased by software.
f
OCn
2
=
---------------------------------------------- -
2 N
f
(
clk_I/O
1
3
+
TOV
OCRn
Figure
0 Flag in this case behaves like a ninth
)
4
31. The counter value (TCNT0)
OCn Interrupt Flag Set
(COMn1:0 = 1)
2503N–AVR–06/08
OC0
= f
clk_I/O
/2

Related parts for ATMEGA324P-A15MZ