element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs ATmega328P and it's Architecture
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: yesha98
  • Date Created: 2 Mar 2021 3:53 PM Date Created
  • Views 3349 views
  • Likes 7 likes
  • Comments 3 comments
Related
Recommended

ATmega328P and it's Architecture

yesha98
yesha98
2 Mar 2021

This article is meant to explain the architecture of the ATmega328P from Atmel for further projects on AVR Assembly programming

ATmega328P and it's Architecture

The overview:

The high-performance Microchip picoPower 8-bit AVR RISC-based microcontroller combines 32KB ISP flash memory with read-while-write capabilities, 1024B EEPROM, 2KB SRAM, 23 general-purpose I/O lines, 32 general purpose working registers, three flexible timer/counters with compare modes, internal and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI serial port, a 6-channel 10-bit A/D converter (8-channels in TQFP and QFN/MLF packages), programmable watchdog timer with internal oscillator, and five software selectable power saving modes. The device operates between 1.8-5.5 volts.

By executing powerful instructions in a single clock cycle, the device achieves throughputs approaching 1 MIPS per MHz, balancing power consumption and processing speed.

Source: microchip.com

 

Features:

Wikipedia.org
                                        Wikipedia.org

The Pinout:

image

The block diagram:

Datasheet
                                 Datasheet

The code that we write in any language will be compiled into a binary file and will be stored in the available flash memory (non-volatile), thus retaining the code even if we disconnect the power supply from the MCU.

The AVR CPU executes the instruction from the flash memory one-by-one. The temporary variables that require memory will use the available memory in SRAM.

The MCU has various modules such as Timer/Counter, ADC (Analog-to-Digital Converter), DAC (Digital-to-Analog Converter), USART (Universal Synchronous Asynchronous Receiver Transmitter), SPI (Serial Peripheral Interface), Analog comparator, etc.

The Arduino can be programmed using the Arduino IDE. Either C or Assembly language can be used, but the upcoming projects mainly focus on Assembly programming and how the different modules present in the Atmega328P can be interfaced with.

 

The AVR Architecture:

image

 

To maximize performance and parallelism, the 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. 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. The program memory is in-system reprogrammable flash memory.

-Datasheet

Registers and Pointers:

The C programming in Arduino IDE is very easy, and one can just declare variables and initialize them such as

int a=2;

But in assembly programming it's different. You need to go deep into the hardware and write the code based on the availability of resources.

For storing such variables, ATmega328P makes use of the registers.

 

There are 32 8-bit registers available
                                             There are 32 8-bit registers available

A register is nothing but a flip-flop (Memory storage element)

Then there are pointers to store the addresses of the memory locations, peripherals etc. Basically, the last 6 registers are used as pointers.

 

There are 3 16-bit pointers available
                                                                                 There are 3 16-bit pointers available

The Data memory map:

Datasheet
                                                                           Datasheet

Die shot of ATmega328P:

 

Wikimedia.org
                                                             Wikimedia.org

There are other modules and registers which will be discussed as we learn various modules available.

Stay tuned!

  • Sign in to reply

Top Comments

  • genebren
    genebren over 4 years ago +3
    Nice chip, but I prefer the ATmega328PB version with two serial ports. From: Atmel - AT15007: Differences between the ATmega328/P and the ATmega328PB
  • DAB
    DAB over 4 years ago +2
    Interesting architecture, let us see what they provide next. DAB
  • yesha98
    yesha98 over 4 years ago in reply to genebren +1
    True, that's why we need to use the software serial when we need an additional serial port.
  • yesha98
    yesha98 over 4 years ago in reply to genebren

    True, that's why we need to use the software serial when we need an additional serial port.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    Interesting architecture, let us see what they provide next.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 4 years ago

    Nice chip, but I prefer the ATmega328PB version with two serial ports.

    image

     

     

    From: Atmel - AT15007: Differences between the ATmega328/P and the ATmega328PB

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube