Getting Started with AVR Microcontrollers

In this article, we will become familiar with the AVR Microcontroller. We will discuss every detail of the AVR microcontroller. What are its basic features and architecture? We will also learn about the programming strategy of the AVR microcontroller and the basic introduction of the AVR Studio software.

AVR Microcontroller

An AVR microcontroller is an advanced minicomputer integrated on a small chip with a processor, memory, and programmable input and output peripherals. The main function of an AVR microcontroller is to provide digital control over any type of system (electrical, mechanical, or automotive), different devices, industrial plants, and most electronic gadgets and appliances. The AVR microcontroller is the first on-chip flash memory and comes in 8-bit, 16-bit, and 32-bit integrated chips.

AVR Microcontroller’s History

In 1996, ATMEL designed and developed the AVR series of microcontrollers. These are more advanced and sophisticated than PIC microcontrollers. Their architecture was first designed by two students, Alf-Egil Bogen, and Vegard Wollan, at the Norwegian Institute of Technology. This term stands for Alf-Egil Bogen and Vegard Wollan’s RISC (reduced instruction set computing) microcontroller, or AVR for short. AVR microcontrollers are divided into six categories, which are listed below:

  1. Classic AVR (AT90SXXXX)
  2. Tiny AVR (ATtinyXXXX)
  3. Mega AVR (ATmegaXXXX)
  4. Xmega AVR (ATXmegaXXXX)
  5. Application-specific AVR
  6. 32-bit AVR

AVR Microcontroller ATMEGA32 Features

In this section, we will discuss the features of the ATMEGA32 microcontroller by ATMEL. The ATMEGA32 microcontroller comes with the following features:

32K Bytes of flash memory1024 Bytes EEPROM
2K Byte of SRAM8 channels, each f 10-bits ADC
32 general purpose I/O lines and registersJTAG interface
Internal & external interruptsSerial programmable USART
TWI interface4 PWM channels
SPI serial portOperating voltages: 4.5 V – 5.5 V
Operating frequency: 16MHz
Table 1: Features of ATMEGA32 Microcontroller

Architecture of AVR ATMEGA32

The AVR microcontroller, Atmega32 is a low-power, efficient, and high-performance integrated chip that comprises of an advanced virtual RISC architecture. It can interpret 6 million instructions per second (MIPS). AVR Atmega32 is a 40-pin integrated chip in which 32 pins are input/output pins in the form of four ports: PORTA, PORTB, PORTC, and PORTD, and others are voltage supply, ground, analog reference, crystal oscillator, and reset pins. Each port provides a bi-directional I/O interface and comprises 8 pins, each of which is 8 bits wide.

pin configuration ATMEGA32, AVR Microcontroller
Pin configuration of ATMEGA 32

Interface Functions of AVR Microcontroller

Interface and pins Function
ResetThis pin is in the active-low configuration. It activates at 0 volts and resets the microcontroller to its initial state.
PORTAConverts analog values to digital language so ATMEGA32 can understand.
ADCPins A0 to A7 are ADC pins.
AREFThe reference voltage pin is used as an external reference for ADC pins.
AVCCSupplies voltage to the ADC pins.
GNDTwo pins act as GND for ATMEGA32.
VCCThe main supply is 5 volts DC for ATMEGA32.
FrequencyThe operating frequency is 16 MHz; for this, a crystal oscillator is connected to XTAL1 and XTAL2 using a 22 pF capacitor.
TWI interfaceThis interface provides serial communication through two bi-directional bus lines.
JTAGUseful for programming, single-step testing, and debugging the ATMEGA32.
ISPUseful for programming using dedicated pins.
SPIProvides serial communication between ATMEGA32 and other devices.

AVR Microcontroller Pinout

The following table will help you in understanding the functions of each and every pin.


1XCK/T0/PBOT0 -Timer 0 external counter input or XCK- USART clock I/O or PB0-I/O pin 0 of PORTB
2PB1/T1Timer 1 external counter input or I/O pin 1 of PORTB
3PB2/INT2/AIN0PB2-I/O pin 2 of PORTB or INT2-external interrupt 2 or   AIN0-analog comparator
4PB3/OC0/AIN1PB3-I/O pin 3 of PORTB or OC0-timer0 output or   AIN1-analog comparator
5PB4/SSI/O pin 4 of PORTB or ISP & SPI
6PB5/MOSII/O pin 5 of PORTB or ISP & SPI
7PB6/MISOI/O pin 6 of PORTB or ISP & SPI
8PB7/SCKI/O pin 7 of PORTB or ISP & SPI
9RESETactive low, RESET pin
10VCCMain supply (5 volts DC)
12XTAL1for providing input to the inverting clock oscillator and internal clock operating circuit
13XTAL2output from the inverting oscillator amplifier
14PD0/RXDI/O pin 0 of PORTD or USART serial communication interface
15PD1/TXDI/O pin 1 of PORTD or USART serial communication interface
16PD2/INT0I/O pin 2 of PORTD or external interrupt 0
17PD3/INT1I/O pin 3 of PORTD or external interrupt 1
18PD4/OC1BI/O pin 4 of PORTD or PWM channel
19PD5/OC1AI/O pin 5 of PORTD or PWM channel
20PD6/OCIBI/O pin 6 of PORTD or timer/counter 1 input
21PD7/ICP1I/O pin 7 of PORTD or timer/counter 2 output
22PC0/SCLI/O pin 0 of PORTC or TWI interface
23PC1/SDAI/O pin 1 of PORTC or TWI interface
24PC2/TCKI/O pin 2 of PORTC or JTAG interface
25PC3/TMSI/O pin 3 of PORTC or JTAG interface
26PC4/TD0I/O pin 4 of PORTC or JTAG interface
27PC5/TDII/O pin 5 of PORTC or JTAG interface
28PC6/TOSC1I/O pin 6 of PORTC or timer oscillator pin1
29PC7/TOSC2I/O pin 7 of PORTC or timer oscillator pin2
30AVCCvoltage supply for ADC
32AREFanalog reference pin for ADC
33-40PA0/ADC0 – PA7/ADC7I/O PORTA or 8 channel, 10-bit wide ADC

AVR ATMEGA32 Programming Strategy

The AVR ATMEGA32 is a programmable integrated chip, which is why it is necessary to program ATMEGA32 to operate it for the required applications. For the programming of an AVR microcontroller, the simplest way is to use AVR Studio.

AVR Studio

AVR Studio is an integrated development environment by ATMEL for developing different applications as per requirements. We can use C or assembly language to build up codes for AVR microcontrollers.

To build a project on AVR Studio, follow the steps below:

  1. First, open the AVR Studio and select the “New Project” option.
  2. Enter the project name and select AVR GCC; enter the location; then click “next”.
  3. Select your debug platform (AVR simulator) and required device (AtmegaXX) and click “Finish”.
  4. A window will open; click the “project” button, go to the configuration option, select the required options, and click “OK”.
  5. Write the code in the main window.
  6. For compilation, select the build button and go to the compile option. In the event of an error, compiling will fail.

After the generation of the HEX file, store the program on the AVR microcontroller. For this, you have to dump the HEX file into AVR by using the programmer. The common programmers used for AVR microcontrollers are AVRISP and AVRISP2.

AVR Microcontrollers Applications

AVR microcontroller can be used for any type of project application such as:

Signal SensingData Acquisition
Motion ControlInterface motors
LCD DisplaysInterface sensors and transducers
Interface GSM and GPS systemsAutomation and control of industrial plants.
Automation of electrical and mechanical systems.Automation of heavy machines
Development of UAVs (Unmanned Aerial Vehicles)


In this article we have discussed the following topics:

  • AVR Microcontroller and its history.
  • Features of AVR Microcontroller.
  • Architecture of AVR Microcontroller.
  • Pinout of AVR Microcontroller.
  • Getting started with AVR Studio.

You may also like to read about other AVR Microcontrollers:

Related Articles

If you liked reading this article, there are similar articles provided in the list below:

In the next tutorial, we will talk about AVR Studio 6 and how to create our first project using AVR Studio 6. For more information, keep visiting our blog. In case you face any issues, leave a comment below.

3 thoughts on “Getting Started with AVR Microcontrollers”

  1. Can I use ATmega32A to control a fan, heater, led, and PMDC motor, while the microcontroller is interfaced with a temperature and humidity sensor and an LCD?


Leave a Comment