Installation steps and usage of AVR microcontroller language compiler

Publisher:玉树琼花Latest update time:2020-01-23 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Installation of ICCAVR6.31AC language compiler: Put the matching CD into the computer, open the ICCAVR6.31A installation file and enter the installation interface (left picture). The installation directory can use the default method and install it in the icc folder of the C drive (right picture). After the installation is completed, you need to register to get the full version of the software without time limit. The registration method is as follows:

1. Open the ICCAVR6.31A compiler interface, click the menu bar Help→Registration Software→Ware (left picture), the system will prompt you to turn off the computer's anti-virus program, click the Continue button to enter the registration interface (right picture) o2. Select and copy the 7 groups of values ​​in the box on the right side of the EMailUnLOCkCode column .

3. Open the register and paste the value you just copied (see the picture below).

4. Click Get Unlock Code (see the picture below). Copy the unlock code.

5. In the Paste (~V) the unlock code from Imagecraft 's email field on the registration interface of the ICCAVR6.31A compiler , paste the unlock code (left picture), click the License button and then click OK to complete the registration (right picture).

After registration is completed, the ICCAVR6.31A startup interface is shown in the figure below, which mainly consists of five parts: menu bar, toolbar, source file editing window, project window and compilation output window.

Installation of the AV RS tudio integrated development environment Open the AVRStudio installation file in the matching CD, double-click the Setup.exe file, and follow the prompts to install. After the installation is completed, an interface for installing the USB driver will appear. Since we do not use USB driver devices here, just click CAN cel to close it.

The AVRStudio startup interface after installation is complete is shown in the figure below.

Installation of PonyProg2000 download software Prog2000 software is mainly used for downloading programs for AVR microcontrollers and PIC microcontrollers , and is used on operating systems such as Windows95/98/ME/NT/2000/XP. Double - click the PonyProgV206f software in the matching light to install it. During the installation process, just follow the prompts, click the Next button, and proceed step by step. After the installation is complete, you can also perform Chinese translation. Select the PonyProg2000 file in the Chinese translation package (be careful not to open it), then copy it, then open the C:\ Program Files\PonyProg2000 folder, and click Paste directly. When a dialog box pops up asking whether to replace it, click OK, and the original file will be the Chinese version. The figure below is the startup interface of PonyProg2000.

The AVR microcontroller development process in our lecture is: 1. Set up ICCAVR: 2. Create a project; 3. Input C source file; 4. Add source file to the project; 5. Compile the text, and generate COFF/HEX file after compilation; 6. Open the COFF file in the AVRStudio integrated development environment, use JTAG simulation to perform real-time online simulation or software simulation; 7. Use PonyProg2000 software to download the HEX file to the microcontroller; 8. Application.

AVR Getting Started Program

The first AVR program we will make next is to control the 8 LEDs on the AVR microcontroller integrated experiment board, making them flash on and off.

1. Set ICCAVR Before compiling and connecting the project through ICCAVR, you need to set the compiler properties. Some of the set properties can be retained as the default properties for the new project.

Open the ICCAVR software interface, select Project→Operation to enter the property setting dialog box. There are four property tabs: Paths, Compiler, Target, and ConfigSalvo. 1). Paths tab (below): Set the compiler's header file directory (IncludePath{s):) and library file directory (LibraryPath:) in the properties. We use the system default header file directory and library file directory.

Since we are not developing in assembly language, the assembly language header file path (AsmIncludePath(s):) is left blank.

If the output file directory (OutputDirec-tory:) is left blank, the output file will be automatically stored in the project directory, otherwise it will be stored in the path filled in by the user.

2). Compiler tab (below): Selecting StrictANSICCheckings means strict C syntax checking.

AcceptExtensions ( C++ comments, binaryconstants) is selected to accept C++ style program comments.

Intsizeenum (forbackwordcompa TI bility) is selected to indicate that the program can be backward compatible.

0p TI miza TI ons column can select the default setting (Default) or enable code compression function (Enablecodecompression) to optimize the compilation of the program.

Select the output format in the OutputFormat column. COFF format files are used for program simulation debugging, and HEX format files can be burned into the microcontroller.

In the AVRStudioVersion (COFF) column, select Studio4.06andabove.

3). Target tab (below): In the Device Configuration drop-down list, select the MCU chip model we are using. Here we select ATMegal6. Other settings are based on the default settings.

4).ConfigSalvo tab: Use the system default without real-time operating system (Do not use Salvo Configu-rator).

After completing the settings, click OK to complete the property settings of ICCAVR. If we use these already made property settings when developing the next project, we do not need to set the properties again.

2. Create a project Create a new folder named acl in My Documents. In the IC-CAVR software interface, click Project, select the New option in the pop-up drop-down menu, and the screen will be displayed as Figure 16. In the Save New Project As dialog box that appears, select the path to store the project (stored in the newly created ac1 folder) and enter the name of the new project (here we name it acl), click the Save button, and the system will automatically initialize three empty folders: Files, Headers, and Documents, as shown in the figure on the right.

3. Enter the C source file. Click the File menu, select New in the drop-down menu, and then enter the following source program in the Untitled-0 text file editing window that appears.

#include《iom1 6v.h》

void delay(void )

}

unsigned int i, j;

for (i=0; i<1000; i++)

{

for (j = 0; j < 500; i++)

}

}

//========

void main(void)

{

DDRB = Oxff;

PORTB = Oxff;

while(1)

{

PORTB = Ox00;

delay();

PORTB = Oxff;

delay();

}

}

After the program is entered, select File, select Saveas in the drop-down menu, save it in the Ac1 folder, and the source file name is ac1.c. After saving, you can see that the source file name changes from Untitled-0 to acl.c.

4. Add source files to the project Select the File folder in the project area and right-click. Select AddFiles in the drop-down window that appears, as shown on the right. Select the acl.c source file in the Add File window and click the Open button. The acl.c file will then be added to the project (see the figure below).

5. Compile the file Select Project in the main menu bar) and select MakeProject in the drop-down menu. The compilation information of the source program will appear in the compilation output window, as shown in the figure below. If a compilation error occurs, it will be displayed in the compilation output window. The user can re-enter and modify the source program file in the source program editing window and compile again until the compilation is successful and the file required by the user is generated.

6. Software simulation opens the AVRStudio integrated development environment, and a welcome interface to AVRStudio appears (below left).

Click the Open button, select the acl and cof files and click Open. When the interface for generating the AVRStudio project file appears, click Save. Then the interface for selecting the simulation platform appears (see the figure below).

Here we perform software simulation, select AVRSimulator in the DebugPlatform column, and select At-megal6 chip in the Device column (left picture). Click Finish to enter the simulation interface (right picture).

Open Debug in the main menu. You can see the commonly used simulation shortcut keys from the Debug drop-down menu. Here we choose F1O (StepOver) for debugging.

Select Debug-AVR Simulator Options, and the simulation options shown in the figure below will appear. We change the simulation frequency in the Frequency item to 8.OOMHz to make it consistent with the actual operating frequency of the test board.

In the WorksPACe window on the left, the status values ​​of various registers of ATMega6 are stored . We expand the plus sign before I/0ATMEGA16, and then expand the plus sign before PORTB to open the PORTB output port (see the figure below).

Click the cursor arrow of the program, and then press F1O. You can find that the registers of PORTB port will change. DDRB is all black (OxFF), indicating that the direction register is set to output mode. As F1O continues to be pressed, PORTB and PINB will turn black (OxFF) and white (0xO0) for a while. Expand the plus sign in front of Processor in the Workspace window. There is a StopWatch item below. This item is the running time calculated by AVRStudio at the selected clock frequency (see the figure below). We can find that the time interval from PORTB outputting low level to level is about 0.439 seconds, and it repeats repeatedly. After the simulation debugging is passed, close the AVRStudio development environment.

7. Download the HEX file to the microcontroller. Plug the parallel port downloader into the parallel port of the computer, and plug the other end of the download cable into the ISP port of the AVR microcontroller integrated test board. Unplug the 8 short-circuit blocks on the double-row pins marked PBO-PB7 on the test board, and plug them into the double-row pins marked LED to connect the PB port and the LED. Power on the test board and make it work. Note that the 5V regulated power supply is connected to the DC5V socket; if a power supply of 9V or above is used, plug it into the 9~l5V socket. Inserting the wrong power supply will damage the chip!

[1] [2]
Reference address:Installation steps and usage of AVR microcontroller language compiler

Previous article:Design of a multifunctional guide car system based on AVR MCU
Next article:How to make a simple AVR emulator

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号