Create Keil Project for 8051 Microcontroller

In this tutorial, we’ll learn how to Create Keil project for 8051 Microcontroller using uVision5. In the end of this lesson, we will generate HEX file to load into Flash Memory of 8051.

Step By Step: Create Keil Project for 8051

STEP1

Before we proceed any further, first launch Keil uVision5 application from computers program menu.

STEP2

Now click on Project tab and select New uVision Project…

create-new-keil-project
Create new Keil Project

STEP3

Give any name to project (Here we have given a name as project). And Save project in new folder.

name-and-save-project
Name and save Project

STEP4

  • Now in select Device for Target ‘Target 1’… Search for appropriate derivative from family of 8051 microcontroller (for example: P89V51RD2, AT89C51, AT89S51 etc). Here in this case we have chosen P89V51RD2. As we’ll be experimenting in future with P89V51RD2.

Then select your device and hit on OK.

select-p89v51rd2-microcontroller
Select p89v51rd2 Microcontroller

STEP5

When ask for Copy ‘STARTUP.A51’ to Project Folder and Add File to Project? Click NO

select_no_startup_file
Select no. startup file

STEP6

Now to create source file go to File tab and click on New…

create-new-source-file
Create new source file

STEP7

Here save this file with .c (e.g. LED.c) extension in project folder. which we have created earlier.

save_file_as_c_extension
Save file as c extension
save-as-led-c-file
Save as led.c file

STEP8

At this point, we’re ready to write code/program. Now click on File Extension, Books and Environment… tab

setup-file-extension
Setup file extension

STEP9

Then click on Add Files…

Add_led.c_file
Add led.c file

Now select file which we have saved with .c extension. Then click on Add button. And then hit on Close.

add-file-to-project
Add file to project

Here you can see your file gets added in Files: window. Now click OK

STEP10

Now click on Options for Target tab

option-for-target
Option for Target

In Target window type clock frequency which we’re using for 8051 microcontroller. Throughout this tutorial series we are going to use 11.0592MHz crystal clock.

target
Target

Now in Output tab click on check box of Create HEX File. Then hit on OK

create-hex-file
Create hex file

STEP11

Now click on Build tab for building project file. Then click on Rebuild

rebuild-target-files
Rebuild target files

At this point, if there isn’t be any error then we’ll get HEX file into Objects folder with .HEX extension. This is how we’ll Create Keil project for 8051 Microcontroller using uVision5. We hope you will find this tutorial educational. Thanks and see you in next tutorial where we’ll explore different features of P89V51RD2-8051 Microcontroller with some cool example projects.

About Utkarsh Kothimbire

2 comments

  1. if we have to create new code file, can we do it under previous project we had created or we have to repeat all the steps again?

    • Hi Sahil,

      If you have previous project downloaded then you simply need to add source file to existing project. if in case you dont have project already created then only you need to repeat all steps.

      I hope this will answered your question

Leave a Reply

Your email address will not be published. Required fields are marked *

Login

Register | Lost your password?