Installation of ICC AVR6.31AC language compiler: Put the matching CD into the computer, open the installation file of IC CAVR6.31A and enter the installation interface (left picture). The installation directory can use the default method and install it in the icc folder of 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 sets of values in the box on the right side of the EMailUnLOC kCode 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 AVRStudio integrated development environment Open the AVRStudio installation file in the supporting 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 Windows 95/98/ME/NT/2000/XP. Double-click the PonyProgV206f software in the supporting 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 localization. Select the PonyProg2000 file in the Chinese localization package (be careful not to open it), then copy it, then open the C:\ProgramFiles\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 test board to make 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→Option 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 using assembly language for development, 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++com-ments, binaryconstants) is selected to accept C++ style program comments.
Intsizeenum(forbackwordcompatibility) is selected to indicate that the program can be backward compatible.
In the Optimizations column, you can select the default setting (Default) or enable the 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 (below): Use the system default without real-time operating system (Do not use Sal VOC onfigu-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 (as shown below).
# 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, 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-AVRSimulatorOptions, and the simulation options shown in the figure below will appear. We change the simulation frequency in the Frequency item to 8.OOM Hz to make it consistent with the actual operating frequency of the test board.
In the Works PAC e 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 PIN B 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 sure 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~15V socket. Inserting the wrong power supply will damage the chip!
When using PonyProg2000 to download a program, you need to set up PonyProg2000, select the appropriate download interface method, and calibrate the port. PonyProg2000 supports serial port and parallel port downloads. Here we use the wellhead SPI method to download the program.
Double-click the PonyProg2000 shortcut icon on the desktop to run the software (see the picture below). Click OK when the pony head icon appears.
Before downloading the program, please set and calibrate the port. Select Settings → Interface Settings, and the following dialog box will appear. If the operating system used by our computer is Windows 95/98/ME, click Parallel, select AvrISPAPI, and select LPT1; if the operating system used by our computer is Windows NT/2000/XP, click Parallel, select AvrISPI/0, and select LPT1.
Then select Settings → Calibration, calibrate the port, and the window shown below will appear.
Click Yes to start calibration. When calibration is complete, there will be a prompt (see the picture below). Just click OK.
Select Devices → AVRmicro → At → megal6 (below).
Select File → Open Program (FLASH) File, select *HEX as the file type, and load the programming file (see the figure below).
Select Command→Erase to erase the device first (see the figure below).
Select Command → Security and Configuration Bits..., and configure the fuse bits according to Figure 36. Click Write to write the fuse bit configuration.
Select Command → Write All to start downloading the flash file (see the figure below).
When downloading files, the LED DO next to the ISP will light up.
8. When the application download and burning is completed, we can see that the 8 LEDs driven by the PB port start to flash, with a cycle of about 0.8s, that is, they light up for 0.4s and go out for 0.4s, and repeat this process.
Previous article:Introduction to the main features of AVR microcontroller
Next article:Design and product development of digital control constant current source circuit based on PWM function of AVR microcontroller
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
- Intelligent Valve Control System Based on Fieldbus
- How to select external clock and external memory for TI DSP?
- Can UST_OTG1 be used with a USB flash drive?
- Altium Designer 20.0.9.164
- "Introduction to Arduino Interactive Design with Perfect Illustrations" - Getting Started with Microcontrollers from Scratch
- TI wM-Bus 169MHz RF Subsystem with Receiver for Smart Gas and Water Meters
- AT89S51 download line information
- Delay calculation by cross-correlation method
- i.MX6ULL Embedded Linux Development 4-Root File System Construction
- 【NUCLEO-L552ZE Review】-1: Start from TrustZone