GETTING STARTED WITH AVR MICROCONTROLLER.This article will make you familiar how to getting started with AVR Microcontroller. You will learn each and every thing about AVR microcontroller. What are the basic features of AVR microcontroller, Architecture of AVR microcontroller? Here you will also learn about the programming strategy of AVR microcontroller & basic introduction of software AVR Studio.

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


After  PIC microcontrollers AVR microcontroller being advanced and sophisticated microcontroller was developed by ATMEL in 1996, its architecture was first envisage by two students Alf-Egil Bogen and Vegard Wollan at Norwegian institute of technology that’s why  the term AVR stands for Alf-Egil Bogen and Vegard Wollan’s RICS (reduced instruction set computing) microcontroller. AVR microcontrollers are divided into following groups:

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


Lets starts with the Atmega32 IC its basic features are:

  • 32K Bytes of flash memory
  • 1024 Bytes EEPROM
  • 2K Byte of SRAM
  • 8 channels, each f 10-bits ADC
  • 32 general purpose I/O lines and registers
  • JTAG interface
  • Internal & external interrupts
  • Serial programmable USART
  • TWI interface
  • 4 PWM channels
  • SPI serial port
  • Operating voltages: 4.5 V – 5.5 V
  • Operating frequency: 16MHz



AVR Atmega32 is low power, efficient and high performance integrated chip comprises of advanced virtual RISC architecture. It can interpret 6millions instructions per seconds (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 & PORTD and other are voltage supply, ground, analog reference, crystal & reset pins. Each port provides bi-directional I/O interface, comprises of 8 pins in which each pin is 8-bits wide.

pin configuration of atmega 32

pin configuration of atmega 32

The RESET pin is an active low pin which activates when a low voltage (0 volts) is applied; it causes the microcontroller to starts from its default (initial) mode/state. Almost all the signals form environment are analog signals but microcontrollers understands only digital language that’s why form analog to digital conversion PORTA is used, comprises of pins from A0 to A7also known as ADC pins. AREF pin is an analog reference pin used for ADC & VACC pin is a voltage supply also used for ADC. There are two ground (GND) pins used to provide ground to AVR microcontroller. VCC is the main supply of AVR Atmega32 which is 5 volts DC. The operating frequency of AVR Atmega32 is 16MHz, for this an external crystal oscillator of 16MHz is connected to XTAL1 & XTAL2 pins along with 22pF capacitors, where XTAL1 is used for providing input to the inverting clock oscillator and internal clock operating circuit while XTAL2 is the output from the inverting oscillator amplifier. AVR also have TWI (two wire interface), JTAG (joint test action group) interface and in system programmer (ISP) serial peripheral interface (SPI). JTAG is used to provide access to its internal memory and register. With the help of this feature we can perform single-stepping execution and setting break points in code.

Following table will helps you while understanding 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


The AVR Atmega32 is a programmable integrated chip that’s why it is necessary to program AVR to operate it for required applications. For the programming of AVR microcontroller the simplest way is to use AVR STUDIO.



AVR Studio (with different versions) is an integrated development environment by ATMEL to develop different applications as per requirements. We can use C language or assembly language to built-up codes for AVR microcontrollers.

To built-up project on AVR Studio follow the steps below:

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

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


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

  • For signal sensing
  • Data acquisition
  • Motion control
  • To interface motors
  • For displays on LCD
  • To interface any type of sensors and transducers
  • To interface GSM and GPS
  • To control and automize industrial plants, mechanical & electrical systems
  • To automize heavy machineries
  • For developments for UAVs (unmanned aerial vehicles)

In next tutorial you will learn about AVR studio 6 and how to create your first project using AVR studio 6. For more information keep visiting our blog.

This Article is written by our new content writer “Farida Ahmed”. Say thanks to her for sharing useful knowledge with us 🙂


  1. JohnLorenzo February 9, 2016
    • BILAL Malik February 10, 2016

Add Comment

Subscribe to our blog to get updates in your email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,395 other subscribers