8051 Microcontroller Programming setup


Programming 8051 microcontroller is quite easy. I have programmed two types of 8051 microcntroller. One is from Philips p89v51rD2 and other one is At89s51 from ATmel. Both are very similar and there are very less difference in both of them.

Without wasting time, lets move to programming.

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

Personally, I used Keil Uvison4 simulation software to make my simulation before burning program into 8051 chip.

Following are the steps:

  • Install sofware on your system
  • Click Project -> New Uvision Project
  • Save your project
  • Select Target Device (8051 – AT89s51) or you can choose any other depending upon, what you are using.
  • 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

sbit en=P0^0;
void delay();
void delay()
    int i,j;
        en = 0;
        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.

Burning the Hex file into 8051

NOW, to burn your hex file into 8051 RAM which you have generated by compiling your code.

There comes a software FLASHMAGIC

This is all in one software for burning hex files into huge list of 8051 microcontrollers. Beside this, it has also nice serial monitor which can be used for general level serial debugging. One thing which you should rememvber is that you have to connect your 8051 microcontroller board by serial cable in this software. 

After connecting the device through serial port to PC.

1. Select the Com port number. (usually you will find this from device manager ) AND in case, if you are using usb to serial convertor, then its much higher number.

2. You have to set the baud rate according to the device model you are using.

3. select the device itself from the list

4. Click on start

5. Now REST the microcontroller board

Please note that, sometimes reset could not trigger the start of flashing process, In that case, just replug the power adapter cable into board. It will at once start burning your hex into controller.

For programming 8051 microcontroller with USB is also possible,  which i will talk sometimes in future. But i personally have flashed my 8051 microcontroller with serial cable. But yes! you can use a good USB to serial convertor, if you are using your laptop or some other netbooks.

I have uploaded several codes, which you can use to learn and even use to make big projects using those as modules. You find them on my git code repository (Link).

ALSO, If you want to learn the 8051 Microcontroller based C programming, then i have a long tutorial of around 45 minutes.