The
following assumes that you have already installed WinAVR and
AVR Studio 4.
Procedure
12. You
should then see the dialog box shown in Figure 5, which shows the fuse settings. In the pane at the bottom of the window, you should see that AVR Studio was
successful in communicating with the avr.
13. Once you have verified that the fuse settings are correct, click on the ‘Program’ tab, and you should see the dialog box shown in Figure 6. In the section titled, ‘Flash’, the ‘Input Hex File’ radio button should be checked and a path to the hex file corresponding to target filename should be in the path box. You can also navigate to another folder to download an alternate hex file if desired.
Procedure
1. Open Studio 4. If you don’t see the Project
Wizard screen as shown below, click on ‘Project’
from the main menu bar, and select, ‘Project Wizard’.
2. In the ‘Project Wizard’, click on ‘New Project’.
3. Under Project Type, select AVR GCC.
4. Enter the name you want to call the project
5. If you want to
have Studio automatically open a new file for you to begin typing your code,
check the box labeled, ‘Create initial file’. Similarly, if you would like to
create a folder in which to put the project
files, check the box labeled, ‘Create folder’.
6. In the box labeled, ‘Location’, either enter
the location you wish the new file and folder to be put, or click the browse button (with three dots) to browse to the location.
7. Click on Next to go to the next screen.
8. Select AVR Simulator in the left column
labeled, ‘Select debug platform and device’, and select ATmega128 from the list of devices in the right column. Then click ‘Finish’.
9. The Wizard will
set up the project file structure, which will appear on the left window pane,
and if you checked ‘Create initial file’, it will open a window to the right in
which you can start typing or paste your C code.
10. Press
F7 or select, ‘Build’ from the Build pull-down menu to start the compilation process.
11. Once you have successfully built your program,
connect a serial cable to the STK500 RS-232 connector. Turn on the STK500, then click on ‘Tools’ from the main menu bar, select ‘Program AVR’ from the drop-down menu, then select, ‘Connect’ (or just click on the ‘Connect’ icon on the toolbar. You should
then see the ‘Select AVR Programmer’ dialog box as shown in Figure 4. The
selection on the left side should be STK500 or AVRISP and that on the right should be Auto
(to auto-detect for an available COM port on your PC). Make sure these selections have been made, and click on ‘Connect’.
Select
AVR Programmer dialog box. This window allows you to choose the platform and
COM port with which to program the avr. The selection on the left side should be STK500 or AVRISP and that on
the right should be Auto (to autodetect for an available COM port on your PC).
Fuse
dialog box. This window allows you to select the fuses on the ATmega
13. Once you have verified that the fuse settings are correct, click on the ‘Program’ tab, and you should see the dialog box shown in Figure 6. In the section titled, ‘Flash’, the ‘Input Hex File’ radio button should be checked and a path to the hex file corresponding to target filename should be in the path box. You can also navigate to another folder to download an alternate hex file if desired.
14. Click
on the button labeled, ‘Program’ to download the hex file to the microcontroller. You
should see the following lines appear at the bottom of the window:
Reading FLASH input file.. OK
Setting mode and device parameters.. OK!
Entering programming mode.. OK!
Erasing device.. OK!
Entering programming mode.. OK!
Erasing device.. OK!
Programming FLASH .. OK!
Reading FLASH .. OK!
Reading FLASH .. OK!
FLASH contents is equal to file.. OK
Leaving programming mode.. OK!
Leaving programming mode.. OK!
Program
dialog box. This window allows you to navigate to the hex file to be downloaded to the microcontroller.
15. Press the Reset button on the STK500, and your program is now running on the ATmega.
No comments:
Post a Comment