(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:AVR Tutorials]]
+
<p>
 +
Learning architecture of the micro-controller gives deep understanding of how it works. It also enables in writing better software for the same. Also programmers who understand the underlying hardware tend to write better programs.
 +
</p>
 +
 
 +
 
 +
= Video Tutorials =
 +
== AVR Architecture Part 1 ==
 +
<html>
 +
<iframe src="https://www.youtube.com/embed/BKg2hoD89jY?list=PLRuRKN7_FVgvhdj6JmelCihl6jmKHc_Xt"></iframe>
 +
</html>
 +
 
 +
== AVR Architecture Part 2 ==
 +
{{#ev:youtube|BKg2hoD89jY}}
 +
== AVR Architecture Part 3 ==
 +
{{#ev:youtube|c4ZNE2HZzmA}}
 +
 
 
=Why learn AVR Architecture?=
 
=Why learn AVR Architecture?=
 
Learning architecture of the micro-controller gives deep understanding of how it works. It also enables in writing better software for the same. Also programmers who understand the underlying hardware tend to write better programs.<br>
 
Learning architecture of the micro-controller gives deep understanding of how it works. It also enables in writing better software for the same. Also programmers who understand the underlying hardware tend to write better programs.<br>
 
The entire tutorial series will be based around '''Atmega32''' MCU from Atmel. Hence in this tutorial we will look at AVR architecture in general however all the specifics would point to Atmega32.  
 
The entire tutorial series will be based around '''Atmega32''' MCU from Atmel. Hence in this tutorial we will look at AVR architecture in general however all the specifics would point to Atmega32.  
 
=Block Diagram=
 
=Block Diagram=
 +
Fig below shows the architecture of the MegaAVR series of controllers.
 +
As with any MCU ALU forms the core of the controller. A typical AVR Mega Series MCU has following hardware units inbuilt:
 +
[[File:AVR Architecture.GIF|x380px|right]]
 +
*The ALU
 +
*32 General Purpose Registers
 +
*Special Function Registers
 +
*Static RAM
 +
*EEPROM
 +
*Flash
 +
*Timer/Counter
 +
*Compartor
 +
*Watch Dog timer
 +
*Protocols: UART, SPI, I2C
 +
*Interrupt Handler
 +
*IO Ports
 +
**Analog
 +
**Digital
 +
 +
The ALU of an AVR MCU process data 8 bits at  a time. It performs the arithmetic and logical operations. The data for the ALU comes from the registers. If you wish to understand how an ALU works go through this [[ALU_in_Detail]] tutorial. Now instead of going into details of all other units described above, let me give you a analogy with 'C' program that you write and execute on a desktop computer.
 +
 +
Let's say we write a simple program like below:
 +
<syntaxhighlight>
 +
#include<stdio.h>
 +
int count = 0;
 +
void main()
 +
{
 +
for( i = 0; i<100; i++)
 +
{
 +
printf("hello world %d", i);
 +
}
 +
}
 +
</syntaxhighlight>
 +
 +
You might be saying where did this thing come from now? Exactly, lets put this into context. There are lot of things that the compiler and the accompanying software takes care of, when you write a similar programs on your computer. Things like '''printf''' will display the content and the string on monitor. You really need not care about how the system does it. Neither you'll have to worry about where the variables like '''i''' will be stored. Not that you'll have to know all of this for writing AVR programs. However understanding what goes where will help you a long way. Now that I have put things in air, let me show you a simple blinky program on AVR.
 +
 +
==32 General Purpose Registers==
 +
==Special Function Registers==
 +
==Static RAM==
 +
==EEPROM==
 +
==Flash==
 +
==Timer/Counter==
 +
==Compartor==
 +
==Watch Dog timer==
 +
==Protocols: UART, SPI, I2C==
 +
==Interrupt Handler==
 +
==IO Ports==

Latest revision as of 15:51, 4 March 2016

Learning architecture of the micro-controller gives deep understanding of how it works. It also enables in writing better software for the same. Also programmers who understand the underlying hardware tend to write better programs.


Video Tutorials

AVR Architecture Part 1



AVR Architecture Part 2

AVR Architecture Part 3

Why learn AVR Architecture?

Learning architecture of the micro-controller gives deep understanding of how it works. It also enables in writing better software for the same. Also programmers who understand the underlying hardware tend to write better programs.
The entire tutorial series will be based around Atmega32 MCU from Atmel. Hence in this tutorial we will look at AVR architecture in general however all the specifics would point to Atmega32.

Block Diagram

Fig below shows the architecture of the MegaAVR series of controllers. As with any MCU ALU forms the core of the controller. A typical AVR Mega Series MCU has following hardware units inbuilt:

AVR Architecture.GIF
  • The ALU
  • 32 General Purpose Registers
  • Special Function Registers
  • Static RAM
  • EEPROM
  • Flash
  • Timer/Counter
  • Compartor
  • Watch Dog timer
  • Protocols: UART, SPI, I2C
  • Interrupt Handler
  • IO Ports
    • Analog
    • Digital

The ALU of an AVR MCU process data 8 bits at a time. It performs the arithmetic and logical operations. The data for the ALU comes from the registers. If you wish to understand how an ALU works go through this ALU_in_Detail tutorial. Now instead of going into details of all other units described above, let me give you a analogy with 'C' program that you write and execute on a desktop computer.

Let's say we write a simple program like below:

#include<stdio.h>
int count = 0;
void main()
{
for( i = 0; i<100; i++)
{
printf("hello world %d", i);
}
}

You might be saying where did this thing come from now? Exactly, lets put this into context. There are lot of things that the compiler and the accompanying software takes care of, when you write a similar programs on your computer. Things like printf will display the content and the string on monitor. You really need not care about how the system does it. Neither you'll have to worry about where the variables like i will be stored. Not that you'll have to know all of this for writing AVR programs. However understanding what goes where will help you a long way. Now that I have put things in air, let me show you a simple blinky program on AVR.

32 General Purpose Registers

Special Function Registers

Static RAM

EEPROM

Flash

Timer/Counter

Compartor

Watch Dog timer

Protocols: UART, SPI, I2C

Interrupt Handler

IO Ports