KEMBAR78
Architecture ATmega328 Microcontroller - 26march | PDF | Microcontroller | Computer Science
0% found this document useful (0 votes)
82 views21 pages

Architecture ATmega328 Microcontroller - 26march

The document provides an overview of the ATmega328P microcontroller, detailing its architecture, features, and components including RAM, ROM, EEPROM, and clock speed. It highlights the microcontroller's specifications such as memory capacity, power supply requirements, and pin configurations, as well as its applications in embedded systems. Additionally, it compares the ATmega328P with the ATmega2560 microcontroller, noting differences in I/O pins, memory, and other specifications.

Uploaded by

kkp002003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views21 pages

Architecture ATmega328 Microcontroller - 26march

The document provides an overview of the ATmega328P microcontroller, detailing its architecture, features, and components including RAM, ROM, EEPROM, and clock speed. It highlights the microcontroller's specifications such as memory capacity, power supply requirements, and pin configurations, as well as its applications in embedded systems. Additionally, it compares the ATmega328P with the ATmega2560 microcontroller, noting differences in I/O pins, memory, and other specifications.

Uploaded by

kkp002003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Unit 2

Architecture : ATmega328 Microcontroller


Introduction to ATmega328P
Microcontroller
• ATmega328P

• AT- Developed by Atmel corporation and acquired by Microchip


technology in 2016.
• Mega – AVR family classification.
• 32- 32 KB Flash program memory.
• 8- 8 bit microcontroller
• P- Pico power.
– It enable the controller to go down up to 1.62v will full functionality.
– It has various sleep modes to reduce power consumption.
– It is optimized to get out of sleep mode faster than any other micro
controller.
Introduction to ATmega328P
Microcontroller
• AVR- Advanced virtual RISC machine.
OR Alf and Vegard RISC machine.
• RISC based single chip with Harvard architecture.
• It has code ROM, Data ROM(EEPROM) ,RAM,IO
and timers.
• Data RAM is twice of the data ROM(EEPROM)
Introduction to ATmega328P Microcontroller
RAM architecture of ATmega 328
ROM architecture of ATmega 328
Syllabus Points

Introduction to ATmega328P Microcontroller

• ATmega328 is an 8-bit microcontroller.


• It has 28-Pin AVR Microcontroller, manufactured by Microchip.
• It uses RISC Architecture.
• It has a flash-type program memory of 32KB.
• Atmega328 is the microcontroller, used in basic Arduino boards i.e.
Arduino UNO.
• It has an EEPROM memory of 1KB and its SRAM memory is 2KB.
• It has 6 Pins for ADC operations, which all combine to form Port C (
PC0 – PC5 ).
• It also has 3 built-in Timers, two of them are 8 Bit timers while the
third one is 16-Bit Timer.
• It operates ranging from 3.3V to 5.5V but normally we use 5V as a
standard.
• It’s normally used in Embedded System applications.
Features of ATmega328

6
Architecture of ATmega328P Microcontroller

8-bit CPU Core Block


Architecture of ATmega328P Microcontroller
• AVR uses a Harvard architecture with separate
memories and buses for program and data.
• Instructions in the program memory are executed with
a single level pipelining and are classified as 8-
bit RISC devices.
• While one instruction is being executed, the next
instruction is pre-fetched from the program memory.
• This concept enables instructions to be executed in
every clock cycle.
• Flash, EEPROM, and SRAM are all integrated into a
single chip in AVR microcontrollers.
• The Data Bus is 8-bit in width.
Different components in AVR ATmega328P CPU

1. AVR Registers
2. Arithmetic Logic Unit (ALU)
3. Program Flash Memory
4. Data Memory
5. EEPROM
6. MCU Clock Speed
Different components in AVR ATmega328P CPU

1. AVR Registers
– AVR contains 32 x 8-bit general
purpose working registers with
a single clock cycle access time.
– Six of the 32 registers can be
used as three 16-bit indirect
address register pointers (X-, Y-,
and Z-registers) for Data Space
addressing.
– One of these address pointers
can be used as an address
pointer for lookup tables in
flash program memory.
– The 32 x 8-bit general
purpose working registers are
mapped into the first 32
memory addresses (000016–
001F16), followed by 64 I/O
registers (002016–005F16).
Different components in AVR ATmega328P CPU

2. AVR ALU
– The ALU supports arithmetic and logic
operations between registers or between a
constant and a register.
– Single clock cycle access of 32 x 8-
bit general purpose working register allows
single-cycle ALU operations.

– In a general ALU computation, two registers


are used as operands, the operation is
executed and the result is stored back in a
register in one clock cycle.
– Single register operations can also be
executed in the ALU.
– After an arithmetic computation, the Status
register is updated to indicate information
about the result of the operation.
– The ALU operations are divided into three
main categories – arithmetic, logical, and
bit functions.
Different components in AVR ATmega328P CPU

3. Program Flash Memory


– The memory spaces in the AVR architecture
are designed in a linear and regular memory
map.
– The size of the flash program memory is
usually indicated in the part number of the
device itself (e.g., the ATmega32x line has
32KB of flash, while the ATmega64x line has
64KB).
– The AVR Flash is an on-chip in-system
reprogrammable flash memory for program
instruction storage.
– The Flash memory has a typical endurance of
at least 10,000 writes/erase cycles
– AVR Program Flash memory space is divided
into two sections, the Boot Program section
and the Application Program section.
– Lock bits are available to read/write
protection to prevent tampering. The
application section can be updated by the
bootloader.
– Boot loader is basically the initial piece of
code which runs whenever any micro
controller is powered up or Resets.
Different components in AVR ATmega328P CPU

4. Data Memory
– AVR Data Memory is implemented in a separate address
bus than the Program Memory.
– There are two data buses
• one that can access all data
• IN/OUT data bus with limited access to a small
section of memory.
– The AVR Data Address Space consists of :
• Registers (32 x 8-bit) (000016–001F16)
Consists of 32 8-bit general purpose working registers
(R0-R31)
• I/O Memory (64 x 8-bit) (002016–005F16)
Contains addressable space for peripheral control
registers and other I/O registers
• Extended I/O Memory (device dependent) (160 x 8-bit)
(006016–00FF16)
Some AVR microcontrollers with more peripherals need
more space than the I/O memory can address.
• some of the SRAM is used as Extended I/O memory to
handle the extra peripherals control registers and other
I/O functions
• Internal SRAM (2048 x 8-bit) (010016–08FF16)
SRAM is used for temporarily storing intermediate
results and variables, stack within a software application.
Different components in AVR ATmega328P CPU
5. EEPROM
– AVR Electrically Erasable Programmable Read-
Only Memory (EEPROM) is organized as a
separate data space, in which single bytes can
be read and written.
– The EEPROM has an endurance of at least
100,000 writes/erase cycles.
– Erase and write can be performed separately in
many cases, byte-by-byte, which may also help
prolong life when bits only need to be set to all
1s (erase) or selectively cleared to 0s (write).
– Programming the EEPROM can be made in
a byte-wise manner. Only an erased
byte should be programmed and only the
foreground bytes can be read or
programmed.
– Access from the CPU to EEPROM is done
through the EEPROM Address Registers,
the EEPROM Data Register, and the EEPROM
Control Register.
Different components in AVR ATmega328P CPU

6. MCU Clock Speed and MIPS


Performance
– Most AVR devices support 1MHz to
20MHz Clock Speed.
– AVR also has an internal oscillator
removing the need for external clocks.
– Some AVRs also have a system clock
Pre-scaler that can divide down the
system clock by up to 1024.
– This Pre-scaler can be reconfigured by
software during run-time, allowing the
clock speed to be changed on the go.
– AVR can achieve up to 1 MIPS per MHz,
i.e. a 12 MHz processor can achieve up
to 12 MIPS.
– Most instructions take one clock cycle to
execute. Loads and stores to/from memory
take two cycles, branching takes two cycles.
ATmega328 Pinout configuration and
pin description
ATmega-328 is an AVR Microcontroller having twenty-eight (28) pins in total.
ATmega328 pin description
• VCC is a digital voltage supply. VCC pin is used to power all the digital components of the microcontroller.

• AVCC is a supply voltage pin for analog to digital converter. AVCC is used to power all analog components (Port C
pins and internal A/D).

• The idea of having different power supply is that digital power supply(VCC) may get a little noisy due to various
switching operations, therefore to avoid these noises to adversely affect the precision of ADC, a separate cleaner
supply can be used. So you can either connect AVCC through a low pass filter.

• GND denotes Ground and it has a 0V.

• AREF
• AREF means Analog Reference. It allows us to feed the Arduino a reference voltage from an external power supply
in order to configure the reference voltage used for analog input
• EXAMPLE:
• if we want to measure voltages with a maximum range of 3.3V, we would feed a nice smooth 3.3V into the AREF
pin. Then the each step of the ADC would represent 3.22 mill volts.

• VCC and AREF are ADC VCC and ADC REF Voltage pins respectively.

• Port B consists of the pins from PB0 to PB7. This port is an 8 bit bidirectional IO port having an internal pull-up
resistor.

• Port C consists of the pins from PC0 to PC6. Port C is a 7 bit bidirectional IO port with internal pull up resisters.

• Port D consists of the pins from PD0 to PD7. It is also an 8 bit input/output port having an internal pull-up resistor.
comparison of ATmega328 with
ATmega2560 microcontroller.
• Arduino Uno • Arduino Mega
• Microcontroller (MCU) • Microcontroller (MCU)
ATmega328P ATmega2560
• Operating Voltage-5v • Operating Voltage-5v
• Digital I/O Pins : 14 • Digital I/O Pins 54
• PWM outputs: 06 • PWM outputs: 15
• Analogue Input Pins: 06 • Analogue Input Pins: 16
• Flash memory of MCU • Flash memory of MCU
32KB 256KB
• Boot loader footprint0.5 KB • Boot loader footprint4 KB
• SRAM of MCU: 2KB • SRAM of MCU: 8KB
• EEPROM of MCU: 1KB • EEPROM of MCU: 4KB
• Clock Speed 16 MHz • Clock Speed 16 MHz
Unit 2 Completed

You might also like