How to program for 8051 microcontroller

Tools you need for writing 8051 micro controller:

Here are the some of tools used for 8051 microcontroller programming and simulation

  • A51-Assembler
  • Code editor -Syntax highlighting Notepad.
  • Simulator-windows based Smart n Small Simulator.
  • Baud -Timer value calculators for various baud rates.
  • C compiler for 8051.
  • RIDE software – simulation Click here
  • Keil uVision – 8051/ARM simulation Click here (most preferred)
  • Proteus – Fully embedded simulation software  Click here


Here we will work on Keil Uvison4 simulation software to make our simulation before burning program into 8051 chip.

  • Install sofware on your system
  • Click Project -> New Uvision Project
  • Save your project
  • Select Target Device (8051 – AT89s51)
  • File -> New

New text-editior will be opened. Here you need to write your code:

In this tutorial we will see blink LED program as beginners

#include<reg52.h>
sbit en=P0^0;
void delay();
void delay()
{
    int i,j;
    for(i=0;i<1000;i++)
	for(j=0;j<500;j++);
}

main(){
    while(1){
        delay();
        en = 0;
        delay();
        en = 1;
    }
}


LED will get ON/OFF depending on delay function as specified in the about program

After typing this program save this file (with file extension *.c).
Right click source Group add files to source group. Choose your saved file wit extension “.c”.
After adding your code file to source group.
Go to “project” menu click “Build Target”
You should get zero errors after compile it.
Once you done with your compilation click “Debug” Menu click “Run”

Now your simulation will run where you can see the port0 which will be blinked depending on delay specified in your code.

Thats it!! You’re done with your simulation. In next article article will teach you how to burn code into the 8051 microcontroller chip. Please make your doubts in the comments section.

Social tagging: > > > > > > > >

25 Responses to How to program for 8051 microcontroller

  1. Sanket says:

    How to burn the hex file in the microcontroller. Any circuit diagram For programmer for AT89C51 microcontroller please tell me……..

    • Jagan says:

      HI Sanket, You will be having mircocontroller AT89C series burning kit for to burn the hex file to your microcontroller. You can burn using the kit.. If you need to design own means kit you should go for AT89S series microcontroller, kit can be designed in home itself using Parallel port connection.

  2. Rishav says:

    i have an 8051 kit which comes with atmega16 , a serial rs232 port with max 232 ic and necessary connections for Vcc , gnd and oscillator . How do i burn hex code into mCU using this rs232 port , i use keil uVision4 for simulation and creating hex files . Do i need other softwares for dumping the code ?

  3. patel manoj j says:

    IC IS ONE OF THE DANGEROUS ITEM

  4. Gudul says:

    Where can i find the next article ? Please send or post a link ! i need it urgently ! Thank you !

  5. mani says:

    can u pls specify me a software name to dump a program in 8051.i have the kit but i dint get the cd along with it

  6. Jim says:

    I have a AT168 development board (Arduino Uno). I want to program a AT89C2051 micro-controller using that board. And burn the code using Keil into it. Is this possible?

  7. abhishek says:

    i am a student ,abhishek.i am working on project rf remote controle robote car using ic at89c2051how to burn the hex code on ic if i dont have any kit ………..what would i require to do so……i need to know is there any module using that i can burn an ic .is there if it is please tell me ……..and send me your email id so i can contact u for guidence as i am new family member of micro family

  8. Shubham says:

    Hi, I am a student doing a project using AT89C2051. Please tell me which programmer (software + hardware kit) is required for burning the hex files in the AT89C2051.. Please tell about AT89C2051 only..

    • Jagan says:

      Hi Shubham, Get it touch with the electronics shop where you bought the AT89C2051 microcontroller chip. They will be able to provide the hardware burning kit and software in the package.

  9. NITISH says:

    sir, i m b.tech student & working on 8051 project. i want to known that how can i loaded microcontroller with my program. which type of hardware & software need for this

    • Jagan says:

      What your microcontroller series? Its AT89CXX or AT89SXX series? If AT89CXX series you need to buy programmer of AT89CXX series. If you want built own kit then you can go AT89SXX series controllers.

      • harold macaranas says:

        how can i used the alexan atmel 89cx051 programmer?can i need a software to used that prommer sir please help…..

        • Jagan says:

          Yes You need the software which is compatible for your 89cx051 programmer. Once the software you need to find your controller and select the HEX file. Once the HEX file selected click burn/write button and wait to get it completed. Then you’re done. After burning controller test it with your kit.

      • NITISH says:

        Is there need of any type of software to burn program in AT89SXX or AT89CXX. Which circuit is capable for my own kit

  10. harold macaranas says:

    hi i have alexan 89cx051 programmer but i dont have any idea how to use it to burn an hex file into atmel 89c2051 please help me..

  11. Rakesh says:

    Hi Jagan! Good explanation. I would like to get an idea about the coding for various projects. So, I am expecting few more this kind of posts from you.

  12. Mayur says:

    Hi….I m using BASCOM for programming ….how i can burn the program to the micro-controller…….

  13. pragyan says:

    hi jagan sir,
    I have hex file for AT89C2051. How can I check that my program will run on microcontroller.

Trackbacks/Pingbacks

Leave a Reply


*