Step 1: Download Keil UVision IDE
Keil provides a code-limited (2K bytes) evaluation version) for the 8051 architecture (C51), which is sufficient for learning purposes.
The main limitations of the evaluation version are as follows.
8051 compiler, assembler, linker, and debugger have an object code limit of 2 KB
Programs that generate more than 2 KB of object code will not compile
》
Debugger supports programs 2 KB or smaller
No hardware support for multiple DPTR registers is provided
Keil uVision IDE (evaluation version) can be downloaded through this link.
Clicking on the link above will redirect you to the download section of the Keil website.
Please click on the C51 icon to download 8051. Development tools (above).
and download the Windows executable file.
For more information, click here.
Step 2: Create 8051/8052 project IDE using Keil Uvision
After installing the Keil uVision tool for the 8051, double-click the Keil icon on the Windows desktop to launch the IDE.
To create a new 8051 project using the Keil IDE, click on the 'Project' item on the IDE menu. ar and select 'New uVision Project. ..',As shown in FIG.
Now create a folder to store your project and give your project file a name (*.uvproj) such as Test (Test.uvproj).
Step 3: Select the 8051 device in Keil
You will then be taken to the device selection dialog, where you can select the 8051 derivative for which you want to develop software.
Keil supports various 8051 derivatives on its IDE.
When selecting a specific microcontroller, Keil IDE will also display the capabilities of the selected microcontroller in its left pane. You can confirm your selection by clicking OK.
Step 4:
After selecting the 8051 derivative,
You will see another dialog box as shown above. To copy STARTUP. A51
Click 'Yes'
Step 5:
Now the project pane of his Kiel IDE will look like this (picture above)
Step 6: Add C files to Keil Project
C files can now be added to the project.
Right-click the Source Group1 folder on the Projects pane and select Add New Item to Group SourceGroup1. .
Step 7:
Now you can select the file types to add to your project.
Select the C File (.c) and give it a name (main.c in this case) and click Add .
You can now type a small program in main.c to blink the LED connected to 8051 port 1. You can find the source code below.
#include
void delay(void);
void main(void)
{
while(1)
{
P1 = 0xFF; // Turn ON all LED's connected to Port1
delay();
P1 = 0x00; // Turn OFF all LED's connected to Port1
delay();
}
}
void delay(void)
{
int i,j;
f or (i=0;i《0xff;i++)
for(j=0;j《0xff;j++);
}
Step 8: Build C Project using Keil UVision IDE
After typing the above c program into the main.c file, you can press the F7 key to compile the C file or go to "Project->Build Target" on the IDE menu bar.
Step 9:
If there are no errors, the code will compile and you can view the output in the Build Output pane.
Step 10: Generate 8051 HEX file using Kiel IDE
In order to download the code into the 8051 microcontroller , we have to generate the corresponding hex code.
In the Keil uVision IDE you can generate a hex file for the 8051 derivative by right clicking on the "Target 1" folder and selecting the option for target "Target1". .. .
Step 11:
Then in the Target "Options for Target 1" dialog box,
Select the Output tab and check the Create Hex File option and press OK.
Now press F7 to rebuild the project.
Kiel IDE will generate a hex file with the same name as the project (here Test.hex) in the Objects folder.
Step 12: View the generated hex file
You can use Notepad to open the Test.hex file to see the contents after creation.
Step 13: Download HEX code to 8051
Uploading hex code is specific to the 8051 derivative you are using, for example some microcontrollers like the P89V51 and Nuvoton W78E05D have built-in bootloaders that can upload hex code through their serial port.
Previous article:Detailed description of the physical storage space of MCS-51 microcontroller
Next article:Description of design information for implementing voice alarm system using microcontroller
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- TMS320F28335 Serial Port SCI
- [Raspberry Pi Pico Review] FreePascal RPI Pico Engineering Structure Analysis
- 【phyBOARD-i.MX 8M Plus Development Board】Review 1: Hardware Analysis
- What are the shortcomings of smart homes? How to solve these problems?
- IGBT drive and protection circuit design and application circuit examples (2nd edition)
- The development of smartphones
- [Atria AT32WB415 series Bluetooth BLE 5.0 MCU] Light up in FreeRTOS, all codes, Github long-term update
- OSAL operating system issues
- Want to get better service? TE customer service said: "I can"
- Is the '*' symbol in Verilog considered a multiplier?