Getting Started with AVR : Basics & Architecture

In one of our last article We discussed a little about microcontroller. We discussed how it is different from a microprocessor. In this article I will move ahead and start discussing more about AVR family of microcontroller from Atmel. This will be covered in a series of articles.

AVR has a 8 bit RISC architecture. It has internal flash memory to store the instruction codes. Figure below shows architecture of ATmega32 microcontroller of this family.


ATmega32 Architecture  

Figure 1 : ATmega32 Architecture from Datasheet

AVR controllers are basically divided into following groups:

  • tinyAVR
  • megaAVR
  • xmegaAVR
  • Application specific AVR
  • 32 bit AVR

tinyAVRs have a very limited set of peripherals. They have very low program space of up to 8kB. megaAVR has this limit to 256kB which allows the user to create a bigger application. They have extensive set of peripherals like USART, SPI, ADC,Analog Comparator are few to mention. We will keep coming across these peripherals in our next article with discussion involving their usages and programming.

xmegaAVR extends the memory limit to 384kB with adding more sophisticated features to the microcontrollers. It has DAC, DMA, cryptographic support etc.  Application specific AVRs include USB controllers, LCD controllers, CAN etc.

32 bit AVR are more complex controllers based on AVR. Their instruction set is similar to basic RISC architecture but not same as 8 bit AVRs, They also include signal processing functions for example audio processing capabilities.

In startup articles we we will be discussing 8 bit AVR. Here 8 bit means the register size of microcontroller. These registers are used to store the data inside microcontroller. AVR has 32 such registers.

We can go through some of peripherals shown in above figure. PORTA, PORTB, PORTC and PORTD are GPIO (General Purpose Input Output) pins. They are used  for digital input and output purpose.

ADC interface is used for Analog to Digital conversion. We will be using Analog signals as temperature sensor output, humidity sensor output as input to our microcontrollers. This peripheral helps us in converting those analog values into digital ones so that we can process them with our digital AVR processing core.

Timers are used for setting the timings of events. They are also used in PWM application. Counters are used for counting some external events. Interrupts are used for signaling the microcontroller of some event and processing the instructions associated with that event. Interrupts may be hardware or software interrupt. Software interrupts are generated from the peripherals like USART, ADC, TIMERS, SPI etc.

USART, SPI and TWI are used for communicating with other devices which have similar interface. These are serial interface with different speed. SPI is the fastest among all. SPI is 4 wire serial interface while USART is three wire and TWI(I2C) is a two wire serial interface.

We will be discussing using these peripheral, their usage and their programming in our forthcoming articles. We will be using megaAVR serias of microcontrollers in our articles coming ahead.