A Free Template From Joomlashack

A Free Template From Joomlashack

Programming AVR microcontrollers without a programmer PDF Print E-mail
Written by Jurij Mikeln   

Our task here is to program our target microcontroller with a Bootloader program. What is a Bootloader? It’s a short program that is placed at the upper end of a microcontroller’s Flash memory which is normally inactive. We can activate it by pulling the Reset line low or pressing the Reset button.

Setting Up

The Bootloader program can be downloaded from our web page for free. When you open the file with Bascom-AVR, you will see some configurations pre-written for most common AVR MCU’s, as follows:

$regfile = “m16def.dat”
Const Loaderchip = 16
‘$regfile = “m32def.dat”
‘Const Loaderchip = 32
‘$regfile = “m88def.dat”
‘Const Loaderchip = 88
‘$regfile = “m162def.dat”
‘Const Loaderchip = 162


From amongst these configurations, choose the pair of statements that correspond to your target microcontroller, and un-comment them. In our case it’s the ATmega16, and you can see that these statements have no leading comment symbols. The program should be compiled with Bascom-AVR and programmed using any suitable programmer that can set the Fuse bits. Next, the Fuse bits should be set to the Bootloader memory space as shown in the Bootloader program. For example, in the case of the ATmega16:

#if Loaderchip = 16            ‘ Mega16   
$loader = $1c00                ‘ 1024 words   
Const Maxwordbit = 6        ‘Z6 is maximum bit
Config Com1 = Dummy , Synchrone = 0, Parity = None , Stopbits = 1 ,_
Databits = 8 , Clockpol = 0

You can see from the statement $loader = $1c00 ‘ 1024 words that the loader size is 1024 words, and its starting memory address is $1C00: that is the value that we have choosen within AVR Studio’s Bootsz window, as shown in Figure 1.

Within the Fuses menu, also tick the BOOTRST box and then click the Program button. That’s all there is to do for the Fuse bits settings. You have successfully programed Bootloader program to AT Mega16

Now, let’s continue with other settings within Bascom-AVR. Using Options/Programmer you must set the Programmer listbox to MCS Bootloader, as shown in Figure 2.

Make sure you set the Baud rate to value shown in the Bootloader program itself. Also set the COM port to the correct number. How do we know the correct COM port number? Well, connect MiniPin II to your PC via a USB cable and examine the COM/LPT Ports within the Device Manager on your PC (Control panel/ System/Hardware/Device Manager). There is one last setting that we must set within the MCS Loader tab, as shown in Figure 3.

Programming AVR microcontrollers without a programmer


Continue reading

Shop area

Last Updated on Wednesday, 01 August 2012 14:33
Free Joomla Templates: by JoomlaShack