AVR Proteus simulation lesson 1: installation and setting of AVR Studio and WinAVR

Publisher:EtherealLoveLatest update time:2017-01-11 Source: eefocusKeywords:avr  studio  winavr Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The avr development environment requires the installation of two software:

 

Reprint and modify an article to explain the installation and settings of these two software

 

 

WinAVR+AVR Studio must-read for beginners

 

1. Obtain the necessary software. 
  Please obtain the latest version of AVR Studio from Atmel. For
the download address, see: http://www.cnblogs.com/proteus/archive/2011/11/09/2242583.html
. Please obtain the latest version of WinAVR from WinAVR.

Download address:  http://sourceforge.net/projects/winavr/files/WinAVR/
Note: WinAVR and AVR Studio are two different software. The former is an open source project and is not owned by Atmel, while the latter is copyrighted by Atmel. 

2. Installation steps 
1) Install WinAVR 
2) Install AVR Studio 
3) Install AVR Studio Service Pack (if any) 

3. Create a new test project 
1) Start AVR Studio 
2) Select "New Project" 
3) Select "AVR GCC" in "Project type", click the button next to "Location" and select the project save location (here it is assumed to be C:\), avoid Chinese characters in the path,

   (Note: make sure there is no Chinese path in the project save location, so it cannot be saved in "My Documents" or "Desktop" or other folders with Chinese paths) 
     Enter the project name test01 in "Project name:", uncheck "Create initial file", check "Create folder", and 
     click "Next>>" 
4) Select "AVR Simulator" in "Debug platform:", select "Atmega128" in "Device:", and click "Finish" 
5) Select File->New File, create a blank document, and copy the following code to the document (Note: there is a blank line under the last "}"): 

#include "avr/io.h" 

int main(void) 

         while(1); 


6) Select File->Save, and in the "Save As" dialog box, select the folder named by the project name under the path where the project is saved (here it is assumed to be C:\test01\), and 
     you will see that there is already a test01.aps file, which is the project file of AVR Studio. Enter "main.c" in "File name" and save. 
7) Right-click on "Source Files" in the "AVR GCC" project management pane, select "Add Existing Source File(s)..." in the right-click menu, and 
     select the main.c file you just created in "Add Source File". You will see that there is an additional main.c file under "Source Files" in the project management pane. 
8) Menu Project->Configuration Oprions, under "General" (it is by default), confirm that "Use External MakeFile" is not checked, 
     fill in the frequency "8000000" in "Frequency:", select "-00" in "Optimiztion", confirm that "Create Hex File" is checked, 
     and then click OK (do not modify other settings) 
9) Menu Build->ReBuild All, compile the project. If the operation is correct, there should be no warnings and errors. 
10) Menu Debug->Start Debugging, if everything goes well, the software simulation has been started. 
11) So far, the test project has been successful. You can see a default folder in the project save directory. After opening it, there are test01.elf (one of the simulation debugging file formats supported by AVR Studio) and test01.hex (the file to be used when burning). 
The successful display is:

 

Build started 9.11.2011 at 16:14:41
avr-gcc -mmcu=atmega128 -Wl,-Map=liaojie.map main.o -o liaojie.elf
avr-objcopy -O ihex -R .eeprom -R .fuse - R .lock -R .signature liaojie.elf liaojie.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no -change-warnings -O ihex liaojie.elf liaojie.eep || exit 0
avr-objdump -h -S liaojie.elf > liaojie.lss

AVR Memory Usage
-------------
Device: atmega128

Program: 204 bytes (0.2% Full)
(.text + .data + .bootloader)

Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)


Build succeeded with 0 Warnings...

 


4. Advice for beginners: 

If the book/material compiles files using command line, please skip the command line operations in these examples and use AVR Studio to create a new project to compile instead. 
If there are explanations about Makefile, please skip them because these explanations may be too brief and difficult to understand. 
1) Do not use the Makefile generated by the mfile that comes with WinAVR. Only use the AVR Studio menu Project->Configuration Oprions to configure the project (do not check "Use External MakeFile"). 
2) There should be no Chinese name in the project save path, that is, only in the English name folder (including the folders at all levels above it are also in English). 
3) Always use Build->ReBuild All to compile the project. 
4) When creating a new project, do not use Makefile as the project name (regardless of the uppercase and lowercase combination). 
5) When creating a new project, do not check "Create initial file". 
6) Do not modify the file name in "Output File". 
7) Now, the interrupt program is declared in ISR(...). Books and materials may lag behind the changes in WinAVR. Please feel free to check the current WinAVR functions and header file descriptions through avr-libc Manual [WinAVR] under WinAVR in the start menu. 

5. Further learning: 
When you are more familiar with using AVR Studio to complete your project compilation process, you can consider learning Makefile.


Keywords:avr  studio  winavr Reference address:AVR Proteus simulation lesson 1: installation and setting of AVR Studio and WinAVR

Previous article:AVR microcontroller proteus simulation lesson 3: single digital tube
Next article:ATMEGA16 MCU fuse programming settings

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号