Tutorial On AVR Microcontroller, Its Basics And Architecture
There are a number of standard microcontroller families which are used in various applications as per their competence and possibility to perform the preferred task, most common microcontrollers are 8051, AVR and PIC microcontroller. In the year 1996, AVR was developed by Atmel Corporation. The architecture of this microcontroller was developed by “Alf-Egil Bogen” and “Vegard Wollan”. The term AVR derives from its developers and stands for Alf-Egil Bogen Vegard Wollan RISC microcontroller, also known as “Advanced Virtual RISC”. The first microcontroller AT90S8515 was based on the AVR architecture, but the first microcontroller to hit the salable market was AT90S1200 in the year 1997. In this article, we will present you to this basic of microcontroller, and its applications.
What is AVR Microcontroller?
AVR microcontrollers are very popular, used in numerous applications, particularly in project prototyping and also in embedded devices. This microcontroller is an 8-bit RISC (Reduced Instruction Set Computing) architecture microcontroller in the market since 1996 which is having SRAM, on-chip programmable flash memory, IO data space, and the EEPROM. This is the first microcontroller in the marketplace, which has on-chip flash storage.
AVR microcontrollers are obtainable in three categories
Tiny AVR: This microcontroller has Less memory, small in size, apt only for simpler applications.
Mega AVR: This microcontroller is the most popular ones having a good amount of memory up to 256KB, higher no. of inbuilt peripherals and fit for modest to difficult applications.
Xmega AVR: This microcontroller is used commercially for compound applications, which need large program memory and also high speed.
AVR microcontroller performs most of the commands in the single execution cycle. These are around 4 times faster than PIC microcontrollers, they consume low power and can be worked in different power saving modes. The following table shows the comparison between the three most commonly used microcontrollers namely, 8051, PIC and AVR.
AVR is an 8-bit microcontroller appropriate to the family of RISC. In this architecture, the instruction set of the computer are not only less in number but also faster and simpler in operation. The other kind of classification is CISC.
Series Name | Pins | Flash Memory | Special Feature |
Tiny AVR | 6-32 | 0.5-8 KB | Small in size |
Mega AVR | 6-32 | 4-256KB | Extended peripherals |
Xmega AVR | 44-100 | 16-384KB | DMA, Event System included |
AVR Microcontroller Architecture
The architecture of the AVR is shown below, it uses a “Harvard architecture” thus it has separate buses and memories for data and program. Instructions in the program memory are performed with a single level pipelining. While one instruction is being achieved, the subsequent instruction is pre-fetched from the program memory. This thought allows instructions to be performed in every CLK cycle and that suggest AVR runs at around 1 MIPS / MHz
CPU
The CPU of the AVR microcontroller is same but so simple like the one in a computer. The main purpose of the CPU is to confirm correct program performance. Therefore, the CPU must be able to access perform calculations, memories, control peripherals & handle interrupts. The CPUs of Atmel’s 8-bit and 32-bit AVR are based on an innovative “Harvard architecture” thus every IC has two buses namely one instruction bus and data bus. The CPU reads executable instructions in instruction bus, wherein the data bus, is to read or write the corresponding data. The CPU core of the AVR consists of the ALU, General Purpose Registers, Program Counter, Instruction Register, Instruction Decoder, Status Register and Stack Pointer
Flash Program Memory
The program of the AVR microcontroller is stored in non-volatile programmable Flash program memory which is just similar to the flash storage in your SD Card or Mp3 Player. The Flash program memory is separated into two units. The first unit is the Application Flash section. It is where the program of the AVR is stored. The second section is named as the Boot Flash section and can be fixed to perform directly when the device is powered up. One significant fact to note is that the microcontrollers Flash program memory has a resolution of at least 10,000 writes/erase cycles.
SRAM
The SRAM (Static Random Access Memory) of the AVR microcontroller is just like computer RAM. While the registers are used to execute calculations, the SRAM is used to supply data through the runtime. This volatile memory is prearranged in 8-bit registers.
EEPROM
The term EEPROM stands for Electronically Erasable Read-Only Memory is like a nonvolatile memory, but you can’t run a program from it, but it is used as long time storage. The EEPROM doesn’t get removed when the IC loses power. It’s a great place for storing data like device parameters and configuration of the system at runtime so that it can continue between resets of the application processor. One significant fact to note is that the EEPROM memory of the AVR has a limited lifetime of 100,000 writes / EEPROM page – reads are limitless. Keep this in mind in your application and try to keep writing to a minimum, so that you only write the small amount of info required for your application every time you update the EEPROM.
Digital I/O Modules
The digital I/O modules let digital communication or logic communication with the AVR microcontroller and the exterior world. Communication signals are that of TTL/CMOS logic.
Analog I/O Modules
Analog I/O modules are used to input or output analog information from or to the exterior world. These modules comprise analog comparators and analog-to-digital converters (ADC).
Interrupt Unit
Interrupts have enabled the microcontroller to monitor particular events in the background while performing and application program & respond to the occurrence if required pausing the unique program. This is all synchronized by the interrupt Unit.
Timer
Most AVR microcontrollers have at least one Timer or Counter module which is used to achieve timing or counting operations in the microcontroller. These comprise time stamping, counting events, measuring intervals, etc.
Watchdog
All AVR microcontrollers have an internal Watchdog Timer. It has very limited useful features comprising: distinct 128kHz CLK source, skill to reset the microcontroller and produce an interrupt.
USART / SPI / I2C
The units like USART or SPI or I2C are used for serial communication with the exterior world. An instance is the USART peripheral which uses the RS232 standard.
Thus, this is all about a tutorial on AVR microcontroller, its basics, and architecture.We hope that you have got a better understanding of this concept. Furthermore, any doubts regarding of this concept or to implement any microcontroller based projects. Please give your valuable suggestions by commenting in the comment section below. Here is a question for you, What are the applications of AVR microcontroller?
Add Comment