When it comes to applications based on microcontrollers, you can’t just stop at simulating your model and gathering results. You have to implement it practically which is quite fun if you get used to it – a truly satisfying experience when something actually works. While it’s a known fact that hardware implementation is annoying and cumbersome as compared to simulation but it’s totally worth it. After all, we are engineers and getting your hands dirty in practical stuff always pays off. Before this discussion gets philosophical, let’s handle a simple practical task of how to load your code into the microcontroller.
A microcontroller is nothing without the code, that’s obvious. Code is like the soul of any system. Let me remind you (my sincerest apologies to the advanced users) that your microcontroller doesn’t have any code in itself. It’s blank and capable of doing nothing at all. It’s actually the software that makes it intelligent and gives some meaning to its life. You have to transfer your code (logic) to the microcontroller to make it work for you.
We’re familiar with the term installing software on our Windows based system but in 8051 microcontroller, we normally refer to this as burning (or programming) the device – which simply means installing some software on it. Let’s get used to this terminology.
But before heading that way, let’s take a look back and see if you know the basics.
Can you write in C or Assembly Language?
Can you compile your code in Keil uVision and generate HEX file?
Can you debug your code in Keil uVision to remove possible errors?
Can you simulate your code in Proteus for verification?
If you answered yes to all of the above, you’re not a beginner. You just earned yourself the next phase – burn it!
BASIC REQUIREMENTS FOR BURNING
- HEX file generated from your code.
- A burner (also known as programmer).
- And a computer of course.
The burning process is accomplished using a burner. When we program the 8051, the code is permanently stored in its ROM (Read-Only-Memory) and will stay there until erased or re-programmed.
The steps involved pretty much depend on the microcontroller you choose. For example each variant of 8051 microcontroller has a unique pin configuration and feature set. You can’t expect them to have same hardware requirements when it comes to burning code into them. You’ll have to deal with them accordingly.
The type of burner also plays an important role. If you’re using AT89C51 (a popular variant of 8051 microcontroller) then you must select a burner that supports this specific variant. Don’t worry, if you search, you’ll find that they are easily available. A quick search on Google landed me on a programmer offered at eBay and it supports popular variants like 89S51, 89S52, and 89S53. See? A single burner can handle most of them.
HOW TO BURN
You cannot program the 8051 with anything other than the file type known as HEX. You’d recognize them by the file extension “.hex”. They are actually the compiled output of your source files.
So here is the deal.
- Write some code for the 8051.
- Use a compiler to generate HEX file.
- Connect burner to your computer.
- Mount 8051 on the burner.
- Launch corresponding software for the burner.
- Follow instructions.
For example if you’re using EZ-Downloader.
- Wait for it to identify your device.
- Once connected, click SEND.
- Select the HEX file you generated earlier.
The software will take care of the rest. You will see the progress and get notified once it is completed and burning is verified.
It is obvious now that you can program the 8051 only if you have
- A burner.
- A burning software.
- HEX file compiled for your code.
If everything goes right, your HEX file will be successfully transferred to your microcontroller and you’re good to go. It’s time to put this microcontroller to some practical use and test your logic.