How to Program an AVR Microcontroller

Now that you have made your first program of LED Blinking and simulate it as well. But it’s incomplete if you just simulate it without transferring into the actual microcontroller. So, in this post, I am going to guide you, how to program an AVR microcontroller. I hope you guys already bought a development board (AVR Development Board), an Atmega 16 microcontroller(Atmega 16 microcontroller), an AVR USB-ASP programmer(USB ASP Programmer) and a Jumper Wire(Jumper Wire). The software we need to program the microcontroller is SinaProg (Sinaprog). This software is a GUI to a program called avrdude. The “avr dude”  is a command line program used to transfer “.hex” file to your AVR microcontroller. Therefore, we needed a simpler GUI program to transfer the code. SinaProg is the simplest GUI program based on avrdude and that’s what we are going to use. Only one thing, this software doesn’t run on Windows 10. For Windows 10, you can use Extreme Burner(Extreme Burner).  Nowadays, the USB ASP programmer comes with a plug-in driver(If you need a driver of USB ASP Programmer). It means you don’t have to look for the driver on the internet and try installing unlike me. You just need to bring the programmer which has a plug-in driver.(Note that all the links for buying the products mentioned above redirect to Amazon.in. Also, I have tried my best to suggest you a better product.) In your development board, there are pins given for connection with the programmer, look for the pins Vcc, SCK, RESET, MISO, MOSI, GROUND. Connect MISO of the board to MISO of the programmer. Similarly, connect all the pins using jumper wires to the programmer according to the connection diagram shown:

How to program an AVR Microcontroller?

Programming an AVR microcontroller is not difficult. Just follow the steps to learn How to program an AVR microcontroller:

  • Connect the programmer to the computer’s USB port.
  • Now, open Device Manager on your computer. If it is showing yellow caution sign, something like this image, you should try one thing-Turn the driver signature enforcement off(Turn off the driver signature).Error of Driver signature
  • If your device is recognized by the computer, that means you can continue.Download the SinaProg from the given link and Extract to the desired location.In the extracted folder, look for the application SinaProg.
  • Open Sina prog. In the option “programmer” click on the drop-down button and select USB ASP.

  • Under the device name, click on Search. If your microcontroller’s name appears in the device’s name, means everything you have done so far is great. If not there is one cool solution, check the circuit.

  • In fuses click on drop down option and select the frequency 4MHz and hit program. It means your Microcontroller is now programmed to work with the clock speed of 4 MHz.

  • Under the “hex” file name tab, click on a folder icon and browse where your .hex file is stored. Double click on your “.hex” file.

  • Now, under the flash click on the program button to program the flash memory of your microcontroller. Click on the expand button to check if the microcontroller is programmed or not.

  • If the successful message appears, it means your microcontroller is loaded with the program. If there is some other message, you should program once again.

This is the complete guide on How to program an AVR microcontroller. For the execution of the program, connect the LED given in your board to PORT B0 pin via Jumper wire and if it blinks in the interval of one second, Voila!

How to program a microocontroller

Edit:

I have mentioned above that SinaProg doesn’t work on Windows 10. At that time, I wasn’t using Windows 10 but now, I use it. So, I figure out a way to run SinaProg on windows 10 a while ago. You can easily run that in compatibility settings. What you have to do is go to sinaprog, right click on it and go to properties. There, go to compatibility mode. Under the compatibility mode, click on Run on compatibility mode and select Windows 8. Apply it and now Sinaprog will run on Windows 10.

5 thoughts on “How to Program an AVR Microcontroller”

    1. Dude, you cannot install Atmega16. I am assuming you are asking about Atmel Studio. Atmel studio 5 should run on the medium range of laptops to advance range without any issues. I had a laptop of a very weak processor and 4Gb of RAM and I was able to run it. All the other software doesn’t take much RAM

    2. Here are the system hardware requirements taken from their official release-

      • Computer that has a 1.6GHz or faster processor
      • 1 GB RAM for x86
      • 2 GB RAM for x64
      • An additional 512 MB RAM if running in a Virtual Machine
      • 3GB of available hard disk space
      • 5400 RPM hard disk drive
      • DirectX 9-capable video card that runs at 1024 x 768 or higher display resolution

      For more information, you can read their official release by visiting here-
      http://ww1.microchip.com/downloads/archive/as5installer-stable-5.1.208-readme.pdf

  1. I know what I am asking is not related directly to your post, but I do not know who to turn to about this.

    I am ‘playing’ with a device that has a AtMega16 at its heart. The device is a Daytona Twin Tec TC88A motorcycle ignition.

    I am looking for clues to see if I can read the Firmware currently on the ATMega16 in the ignition module.

    I have the OEM MegaBoot Software, one set of firmware files (hex and eep files) supplied by the manufacturer, and the OEM programming cable. USB to a box, to a three wire plug on the motorbike that connects to the ignition.

    If you do get back to me either here on on my e-mail and are able to help with anything on this, that would be great and I could give you more info

    Thanks

Leave a Comment

Your email address will not be published. Required fields are marked *

Share This
Scroll to Top