KEIL uVision is the name of a software dedicated to the development and testing of a family of microcontrollers based on 8051 technology,  which we are going to use along this tutorial. You can can download an evaluation version of KEIL at their website: Most versions share merely the same interface, this tutorial uses KEIL C51 uVision 4 with the C51 compiler .

To create project,write and test the source code and also create hex file,follow the following steps:

Open Keil and Start a new project:


You will prompted to chose a name for your new project,chose  a name and click save.The following window will appear,where you will be asked to select a device for Target ‘Target 1’:

From the list ,select ATMEL and chose your microcntroller .The AT89s52 will be called your ‘Target device’ ,which is the final destination of your source code.You will be asked whether to copy standard 8051 startup code click No.

Click File,New and similar to the following window should appear.The blank space where your code should be written.

Now,You have to click ‘File ‘,Save as and chose a file name for code ending with the extension ‘.c’ and click save.Then you have to add this file to your project work space as shown in the following screen:

After right-clicking on ‘source group 1‘, click on ‘Add files to group…‘, then you will be prompted to browse the file to add to ‘source group 1’, chose the file that you just saved  and add it to the source group. You will notice that the file is added to the project tree at the left.

In some versions of this software you have to turn ON manually the option to generate HEX files. make sure it is turned ON, by right-clicking on target 1, Options for target ‘target 1’, then under the ‘output‘ tab, by checking the box ‘generate HEX file‘. This step is very important as the HEX file is the compiled output of your project that is going to be transferred to the microcontroller.

You can then start to write the source code in the window ‘ then before testing your source code, you have to compile your source code, and correct eventual syntax errors. In KEIL IDE, this step is called ‘rebuild all targets’ .

You can use the output window to track eventual syntax errors, but also to check the FLASH memory occupied by the program (code = 49) as well as the registers occupied in the RAM (data = 9). If after rebuilding the targets, the ‘output window’ shows that there is 0 error, then you are ready to test the performance of your code.

There are many other features to discover in the KEIL IDE. You will easily discover them in first couple hours of practice.


Comments on: "Micrcontroller Programming Using C With Keil IDE" (16)

  1. Mohamad .M said:

    Sorry for asking this crazy question but i’d like to know how do u burn the codes from keil to the microcontroller….Still new to this field…

    • its not silly question but its very important to know…
      There are many dumping kits for transfering code in to the microcontroller.Firstly we have to convert any program to a hexfile format(when program is done in keil ) and then the dumping of code to microcontroller is done by the Top win kit ……isn’t it simple

    • Taher Ujjainwala said: Go through the video you will get your answers…

  2. deepu jacob said:

    good ur webpage have very nice looks
    i’am a 3rd year btech student.i have to do a mini project using 8051 uc’s preferably at89c51.if u have any good topics kindly mail ur project ideas so that i can think of it
    my mail:

  3. i have followed these steps, but it shows “the file.axf could not load” while debugging
    and my keil vision 4 does not shows the library of 8051 for ATMEL, it shows only series starts by 91so what to do now ???
    plz help…..

  4. azmat ali said:

    All LEDs would be OFF. One LED will run from LSB to MSB and at MSB position keep MSB ON. Then will run from MSB to LSB and will keep LSB ON. At this stage, both MSB and LSB would be in ON position. Now one LED will again run from LSB to MSB and at position Bit6, it will turn Bit6 ON and again run backward to LSB, and at position Bit1, it will turn Bit1 ON. This process will keep on going until all LEDs are ON

  5. whoah this blog is wonderful i like studying your articles.
    Stay up the great work! You realize, many persons are looking around for this information, you can help
    them greatly.

  6. It’s remarkable to go to see this web page and reading the
    views of all friends concerning this post, while I am also zealous of getting familiarity.
    facebook likes, choose the package deal which best fits your
    buy facebook likes in facebook Secure and from The major facebook likes service provider.

  7. Please send c code for scrolling display using 16segmennt display…its urgent..thanx

  8. I’m not that much of a internet reader to be honest but yoour blogs really
    nice, keep it up! I’ll go ahead and bookmark your site tto come back ater on. All
    the best

  9. […] Micrcontroller Programming Using C With Keil IDE | – Mar 25, 2011 · KEIL uVision is the name of a software dedicated to the development and testing of a family of microcontrollers based on 8051 technology, which we are …… […]

  10. Hi
    I need help. I bought a mkll development board for AVR family mcu, which supports 8051 derivatives from atmel. However the studio 4 of atmel doesn’t contain a compiler of 8051, thus the need for keil IDE. My question is, after I finish compiling my program in keil, how do I load it in the mcu using studio 4? It’s actually a hustle for me, plz help.

  11. how to transfer the program into microcontroller

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: