How to use Keil UVision IDE for 8051 programming

Publisher:平安宁静Latest update time:2023-08-16 Keywords:Keil  UVision  IDE  programming Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Step 1: Download Keil UVision IDE

How to use Keil UVision IDE for 8051 programming

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.


Keywords:Keil  UVision  IDE  programming Reference address:How to use Keil UVision IDE for 8051 programming

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

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号