How to Program the 8051 Using Arduino

This site contains affiliate links to products. We may receive a commission for purchases made through these links.

First & Foremost…

On this instruction or any instruction, we provide on different how to articles or make connection guides, there are no warranties implied or granted.

We are not liable for any damage done to your computer or other electronic systems. The instructions are supplied for educational purposes only.

How to Program the 8051 Using Arduino

The 8051 Is A Great Teaching Tool

This microcontroller is used to teach students many different electronic techniques. The reason it is so good is because it is a basic system that is easy to understand. Plus, it is an inexpensive microcontroller that is readily available.

Programming your 8051 microcontroller is just as simple and easy to do. It just takes a few moments of your time to get it done. You just need an Arduino uno system to help you.

Programming Your 8051 System

The first step is to download the correct program from the internet to your Arduino system. That is easily found through an internet search and make sure your Arduino system is connected to your computer before you start the download.

The second step is to connect the right pins together. Here is the correct order to line up the pins:

StepArduino Uno to the8051
Step onePin 2 Pin 9
Step twoPin 3Pin 8
Step threePin4Pin 7
Step fourPin 5Pin 6

The third step is to connect your crystal. This is done through the following steps:

  • Attach pin 18 & 19 to the crystal
  • Attach 2 33pf capacitators from the pins 18 & 19 to the ground of the Atmel

The fourth step is to attach the 5 V pin on the Arduino system to the 40th pin of Atmel. Then you attach the GND pinto the 20th pin of the same unit.

When that is done, step 5 is to attach the LED interface to make sure the system works. Finally, use the 8051 SPI programmer to burn the Hex file to the 89S51/52. Once this is done your 8051 system should be ready.

How To Build Your Own 8051 System

The way costs keep rising it may ne beneficial to learn how to build your own 8051 system. If you are skilled at electronics, the following steps should not be a problem for you. Just make sure to be patient and work carefully.

#1. Keep It Simple…

There is no point in over-complicating your work or your system. Make sure the design is simple yet effective. Use basic components that use simple logic to get the microcontroller working like it should

#2. Use Breadboard Or A Vero Board

Draw your design on one of these two devices, then select the components you need and assemble them on a PCB or Zero board

#3. Prepare The Right Hardware And Software Platforms

Since your new controller does not have any data code make sure it can accept the following items and do the special tasks assigned to it:

  • Is compatible with your PC OS
  • You can install the Keil software
  • Your PC and microcontroller burner hardware can transfer the code to the microcontroller

#4. Write The Program

  • Open the Keil software on your computer and select version 2
  • A drop down menu will come up and select the one saying ‘new project’
  • Then select either the Atmel 8051 or the 89c51 option
  • Once that is done go the word ‘file’ and click on it. Then select the new file option
  • Now write the code in a blank section using the C language. Save the file in a .C extension file

The code will look a lot like the one written at this link. Once this is done you can move on to the next step

#5. Compile, Debug and Correct

This is a step you cannot avoid as nothing is perfect in this world and you always need to double check your work. When you go to compile your work, click on ‘project menu’ and select ‘build target’.

Next, for debugging, you go to the debug menu and start checking your program for any errors. When you find them make the necessary corrections until all of the mistakes are gone. Also remove any bugs etc.

#6. Create The Hex File

This is done to make sure you have the right file on your microcontroller and make sure to save it so you do not have to do this work again.

  • Go to the project menu and select Options for Target
  • Press the button that says Target 1
  • Next, a dialogue box will appear, and you push the ‘output menu’ button
  • After that, select the create Hex file option
  • Finally, hit the project menu button and when the new options appear select the build target

#7. Run A Test

What a test does is double check your circuit and make sure all the connections are in place and working like they should. This is done after you load the Hex file.

  1. Open the microcontroller by double-clicking
  2. Browse the hex file
  3. Then use the ‘run’ control at the bottom left hand corner. There is a little symbol that will shortcut to the operation

#8. Transfer The Code

After the rest is successful, you can transfer the code to your 8051 through the following steps:

  1. Connect a USB cable to both the computer and your hardware burner
  2. Now place the microcontroller in the hardware burner and press the lock button
  3. Open the burner software & click the library menu
  4. Click the file menu and select the load file option
  5. Click the auto button so the transfer is made

Some Final Words

Programming your 8051 does not take a lot of skill to get done. It just takes understanding which wire goes to which pin and which file you need to download. With a little practice that will become easy and you should be able to have your microcontroller up and running in no time.

Once it is done you have a nice system to help you with your other projects. Pat yourself on the back.

About The Author