The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which was developed by Atmel
in 1996.Since it is a RISC architecture microcontroller, it will take only lesser decoding time for instructions and
will be comparatively faster for Embedded Systems. In this book we will be using the microcontroller ATMEGA 16
and AVR studio as the programming environment. You can get ATMEGA 16 for around Rs.200/- in the Indian
Before we start working on ATMEGA 16, have a look at ATMEGA 16 Pin out Diagram.
Atmega16 have 16 KB flash memory for storing the program and four 8 bit ports which they do label as PA (PORT
A), PB (PORT B), PC (PORT C), and PD (PORT D).
Now you are familiar with Atmega16 pin configuration. Now we will learn about how to connect Microcontroller
(MUC) to the PC for programming!
To connect microcontroller with PC for programming we need an AVR programmer. We are using use USBasp. The
programmer will have a USB cable that can be used to connect with PC and an SPI cable which can be connected to
Connecting SPI cable to PC
It will be more convenient if you can make a permanent Interface board like this so that you just need to plug this
board to the respective pins while programming.
We have made all the hardware requirements for our first program! Next we will see how to configure our PC for
Programming.This is for windows 7.
For windows 8/8.1/10 firstly you have to start your pc in Advance startup in” Device Driver Enforcement Mode“.
We need programmer drivers for connecting our programmer with PC. . As said earlier we are using the
programmer USBasp. So we will see from where to get the drivers for this programmer. Follow these steps.
– Insert USBasp programmer, then open Device Manager. There you‟ll find USBasp in yellow mark.
Right click on the yellow marked USBasp, and then click on Update Driver.
Now update the driver using “Browse my computer for Driver Software”
Select “install this driver software anyway” option.
After installation close the window.
then open open “win32_executable” folder
then run AVR Dude GUI.exe
Burn the program (.HEX file) on “Flash.”
Now we are going to write the program as follows.
Open the installed AVR studio 4.
Select AVR GCC and name the project.
Choose the location at which you want to
save your project.
select the simulator (AVR simulator in our
Now start writing your code in the editer window
After writing your code, click on “Build”
Option in the menu.
After successful building operation select
“Build and Run.”
To Burn/feed the program inside the
Microcontroller, use AVR Dude GUI. and flash the hex file stored in folder documents/default/your program/yourprogram.hex