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.
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
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Single-chip microcomputer C language programming and simulation
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Limitations of Flash_API for C2000 Series (28335) DSP
- Start learning PIC, record every bit of learning, and share with everyone
- Multifunctional application of LOTO open source DIY expansion board PCB---How to fully tap the DIY potential of your oscilloscope?
- MSP430 MCU Example 7-2-digit digital tube addition and subtraction counting
- Open and recover data from a hard drive made in the US
- SensorTile.box Trial (4) A Preliminary Study on the Programming Mode
- The PCBs drawn by AD always give me round holes.
- [2022 Digi-Key Innovation Design Competition] [Portable Environmental Status Detector] Material Unboxing - ESP32-S2-Kaluga-1
- Qorvo's Programmable Power
- Bluetooth chip CC2541 problem, about RSSI indicator