Create a new Keil C51 project (3)

Publisher:千变万化Latest update time:2021-05-08 Source: eefocusKeywords:keil Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Download, install and register Keil C51 UV3 version software


I won’t go into the details of the steps here.


2. Open the Keil C51 working interface, as shown below.



1. Create a new project


Click the "Project"---"New Project" option in the menu bar, and the "Create New Project" dialog box will pop up as shown in the figure below. First, select the save path of the project, and then enter the project name (note that it is saved in .uv2 format). After the settings are completed, click the "Save" button to complete the creation of the new project.



2. Select the target device


After the new project is created, the "Select device for target 1" dialog box pops up. You can select the model of the microcontroller in the "Library Directory" option. Here, select the atmel series AT89C51 microcontroller, as shown in the figure below, and then click the "OK" button. At this time, you will be prompted whether to add the standard startup code. Select "OK" to complete the operation.



3. Create a new source program file


After selecting the target device, you can see a new folder "target1" added in the project management area on the left side of the Keil work interface, as shown in the figure below.



Click the "File"---"New" option in the menu bar, the system will automatically create a blank text file with the default name "text 1", enter the following program code,


#include


void main(void)


{


P1=0xfe;


}


After the code is entered, the result is as shown in the figure below.



After entering the program, click the "File"--"Save" command, select the path to save to the new project, and enter the file name to be saved (note to save in .c format).


4. Add the newly created source program file to the project


Click the "+" in front of "Target 1" in the project management to expand the project. Select the "Source Code Group 1" folder, right-click, and select "Add File to Source Code Group 1" in the pop-up dialog box. As shown in the figure below, select the c source code file created earlier, and then click "add" to add the file to the project. The add file dialog box will not disappear automatically, and we can continue to select to add files. If you do not need to continue adding files, click "close" to close the dialog box. At this time, you can see that the new file has been added in the project manager.



5. Compile the program


After the source program is written and added to the project file, the program needs to be checked for errors, compiled and debugged.


Click "Project"--"Rebuild All Target Files" in the menu bar to compile the program. The information output bar will display relevant compilation information. As shown in the figure below, if there is an error, the error location and error type will be indicated (note that the indication of the error location may not be accurate and needs to be carefully checked).



6. Generate burning files


The MCU cannot process C language files. You must convert the C language program into a binary or hexadecimal file that the MCU can recognize. You need to set the compilation options to generate files that the MCU can recognize. Select "Target 1" in the project management area, right-click, and the target setting dialog box pops up.


First, set the clock frequency in the "Project" option and select 11.05692. As shown in the figure below



Then check "Output hex" file in "Output Project" and click OK to complete the setting. Compile the program again. After the compilation is completed, a .hex file will be generated in the project folder. This file is the code file used to burn into the microcontroller.



7. So far, the whole process of establishing a project in Keil has been completed.


Keywords:keil Reference address:Create a new Keil C51 project (3)

Previous article:8051 MCU Tutorial Lesson 12: Logical Operation Instructions
Next article:The difference between bit and sbit

Recommended ReadingLatest update time:2024-11-16 13:38

Keil IAR - Cortex M3 debugging problems and solutions (3)
Last time, we talked about that due to the continuous upgrade of the stm32 official library and iare ew arm, many configurations have changed. 1 This error occurred when upgrading stm32 stdlib 3.5 using ewarm 6.30 Error(Pe47)   declaration is incompatible with "__interwork__softfp unsigned long __get_PSP(void)", 
[Microcontroller]
Keil5.15 uses GCC compiler to compile STM32 project
We use Keil to compile MCU project code using ARMCC. In fact, Keil also supports embedded GCC compiler. We can use GCC to compile our project code. 1. Download the GCC compiler GCC compiler download address  2. Install GCC We can unzip GCC to the installation directory of Keil. As shown below 3. Configure Keil t
[Microcontroller]
Keil5.15 uses GCC compiler to compile STM32 project
How to generate bin file in Keil
Anyone who has used Keil knows that by default, Keil can output .axf debug files and .hex executable files by checking the output options, but there is no option to output bin (binary) files. However, sometimes you need or habitually use .bin files for programming. Here are two examples: 1. Users who have been using A
[Microcontroller]
Description of printf() function in Keil C51
In C51, when using the printf() function for formatted output, the format control characters are different from those in ANSI C. In the format control characters, b stands for byte Output uint8_t in decimal: %bu Output int8_t in decimal: %bd #include   void tst_printf (void) {   char a = 1;   int b = 12365;
[Microcontroller]
Keil uVision4 Simple Tutorial
First, we use Keil to open an existing project to get to know the Keil software, as shown in Figure 1-7. Figure 1-7 Project File From Figure 1-7, we can easily distinguish the menu bar, toolbar, project management area, program code area and information output window. This is the English version of Keil4. There are
[Microcontroller]
Keil uVision4 Simple Tutorial
Tip 1 -- Add STC model in Keil C51
Some MCUs are STC models. When creating a project in Keil C51, there is no corresponding chip model...   Solution: Go to the STC official website and download the STC model plug-in. Here is the extraction code for the 115 network disk as a backup: For Keil uVision2 (uv2 for short), plugin extraction code: bewxzw
[Microcontroller]
Tip 1 -- Add STC model in Keil C51
KEIL compiler distinguishes between RW-data and ZI-data
There is a statement "Program Size: Code=xx RO-data=xx RW-data=xx ZI-data=xx" in the compilation prompt output information of the KEIL project, which describes the size of each domain of the program. After compilation, all data with the same nature (including code) in the application program are classified into one do
[Microcontroller]
KEIL compiler distinguishes between RW-data and ZI-data
Watch window variables are not displayed in real time during debugging in Keil
In debug mode, check View- Periodic Window Update
[Microcontroller]
Watch window variables are not displayed in real time during debugging in Keil
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号