8051-Programming-Using-Keil-uVision

PAUL SABU
4 min readApr 18, 2021

--

We are going to see to how to program 8051 MicroController using Keil uVision5

Creating a Project in Keil uVision

When we open Keil uVision For first time we will be able to see ide as shown in figure below.

To create a new 8051 project using Keil IDE, Click on the ‘ Project ‘ item on the IDE Menu bar and select ‘ New uVision Project… ‘ as shown in the above image.

Now create a Folder to store your project and give a name to your Project files (*.uvproj), for eg exp1 (exp1.uvproj) , then save it.

Selecting 8051 MicroController

  • After saving the project , a dialog box will appear to select a Device
  • Then type “at89c51” in search box
  • Click on AT89C51 and click on OK
  • You will get another dialog as shown below. Asking to copy STARTUP.A51, Click on No

Writing Code

Now inorder to write code we need a blank file , Click on File >> New... or can use keyboard shorcut Ctrl+ N

Write a code as shown in the figure below

Now “Save As” the file , Click on File >> Save As...

Give a file name to your code with extenstion *.asm, for eg code.asm , then save it.

In left corner you can see a ProjectBox , in that Project Box expand Target1 , then Right click on Source Group 1, Then click on Add Existing Files to Group 'Source Group 1'...

Select the Files of type : Asm Source file (*.s*;*.src*;*.a*) , Select the file with extenstion *.asm , here in my case it is "code1.asm" , Click on Add and click on Close

Project Build

To Bulid Project , Click on Project >> Build Target or press on F7 key

If the Build is successful there will not be any error or any warning as shown in the figure below , else verify the code and rebuild it.

Debug and Run Code

Next step is to debug the code , For that click on Debug >> Start/StopDebugSession or press on Ctrl+ F5

After Entering to debug , you will have a similar screen as shown in the figure below

Next step is to Run the code , For that click on Debug >> Run or press on F5 or click "Run" button highlighted in green color

After a few seconds we need to Stop running the code , For that click on Debug >> Stop or click "Stop" button highlighted in red color

Before Closing the Keil uVision We need to stop Debugging , For that click on Debug >> Start/Stop Debug Session or press on Ctrl+ F5, Then close it

For programs of 8051 Microcontroller , you can visit my github link given below

GitHub Link : https://github.com/pscretn/8051-Programming-Using-Keil-uVision

--

--

PAUL SABU
PAUL SABU

Written by PAUL SABU

Loves To Play with MicroControllers , Hardware Enthusiast

No responses yet