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).
- 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!
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.