Section 5: How to create, close, and open a complete project using Keil software

Publisher:清新微笑Latest update time:2016-03-11 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Ten years of experience in the industry, teaching you the basics of microcontrollers Lecture 5:

I will not talk much about the installation of Keil platform software. There is a lot of information on this topic on the Internet. You can search Baidu for tutorials on how to install Keil. Now let's start to explain the operation process of creating, closing, and opening a complete project using Keil software.

Step 1: Create a new project folder. First, create a new folder in the D drive directory of the computer and name it "stc89c52rc".

Step 2: Start the Keil software. Double-click the "keil uVision4" icon on the desktop to start the Keil software.

Step 3: Close the existing project that is opened by default. When you open the Keil software, if you find that the software opens a previously existing project by default, please close this project first. If the existing project is not opened by default, this step can be ignored. To close an existing project, click the "Project" option above and select "Close Project" in the pop-up drop-down menu.

Step 4: Use the tool wizard to create a new project. Click the "Project" option above, select "new uVision Project..." in the pop-up drop-down menu, and in the pop-up dialog box, select the directory to save in the folder "stc89c52rc" created in the first step, enter the same file name as the folder name "stc89c52rc", and then click the "Save" button. At this time, a dialog box for selecting the microcontroller model will pop up. Double-click the manufacturer "Atmel", select the model "AT89C52" in the expanded drop-down options, and then click "OK". At this time, an English inquiry box will pop up, "Do you want to copy the STARTUP.A51 file to the project?" We just click "No".

Step 5: Create a new .c source file. Click the "File" option above, select "New..." in the pop-up drop-down menu, and you will see a file named "Text1". Click the "File" option above again, select "Save" in the pop-up drop-down menu, and a save dialog box will pop up. Choose to save it in the folder created in the first step, and name it "stc89c52rc.c". Click "Save".

Step 6: Add the newly created .c source file to the project and establish an association with the project. Click the "+" sign in front of "Target 1" in the "Porject" option box on the left (if you do not find the Project, please follow the explanation in the second item below), and you will see "Source Group 1" in the expanded drop-down menu. Right-click the "Source Group 1" option, select the "Add Existing Files to Group 'Source Group 1'..." option in the drop-down menu, and a file selection dialog box will pop up. Click to select the newly created .c source file, and then click the "Add" button once. Although the dialog box is not closed at this time, the .c source file has been added to the project. At this time, just click the "Close" button again to close this dialog box. At this time, you will find that there is an extra "+" sign in front of "Source Group 1" on the left. Click this "+" sign to expand it, and you will find the .c source file "stc89c52rc.c" that we just added below.

Step 7: Double-click to open the "stc89c52rc.c" .c source file added to the project on the left, and then you can enter our C language code in this "stc89c52rc.c" file. Please copy the following sample code into it, and then click the "File" option again, and select "Save" in the pop-up drop-down menu. At this point, the steps of creating a new project have been completed.

Example code to copy:

#include "REG52.H"

void delay_long(unsigned int uiDelayLong); //delay function

sbit led_dr=P3^5;

void main()

{

while(1)

{

led_dr=1; //LED is on

delay_long(100); //Delay time for 50000 empty instructions

led_dr=0; //LED off

delay_long(100); //Delay time for 50000 empty instructions

}

}

void delay_long(unsigned int uiDelayLong) //delay function

{

unsigned int i;

unsigned int j;

for(i=0;i

{

for(j=0;j<500;j++); //Number of empty instructions in the embedded loop

}

}

Step 8: Open an existing project. The previous seven steps have explained how to create a new project. Now let's teach you how to open an existing project. First, click the "X" in the upper right corner to close the entire Keil software, then double-click the "keil uVision4" icon on the desktop to restart the Keil software. If you find that this software opens a previously existing project by default, please close this project according to the previous third step. Then, click the "Project" option above, select "Open Project..." in the pop-up drop-down menu, and in the pop-up file dialog box, find the new project folder created in the first step, click to select the "stc89c52rc.uvproj" file name, and then click "Open" to open an existing project file.

For detailed operation steps, please click here: bbs.21ic.com/forum.php

Reference address:Section 5: How to create, close, and open a complete project using Keil software

Previous article:Section 6: The process of compiling .c source code into .hex machine code
Next article:Section 4: Introduction to platform software and compiler software

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号