Simulating your prototype, an essential part of development, is still not the ultimate thing. You have to utilize your hardware skills to finalize your design. It gives you an edge and authority to claim that your prototype actually works. The challenge is quite understandable – stuff gets pretty hectic when you try to build something in hardware. Trust me, it may look and sound hard but it gets pretty easy as you practice and learn hardware tricks and shortcuts along the way (yes, shortcuts to success). In this article, I will explain the minimum steps required to use the 8051 microcontroller practically (not simulate) in minimum time.
Let’s assume that you have burned your code successfully into the microcontroller.
If that’s what you’re asking, you’re just in the right place to move forward so let’s get straight to it.
USING 8051 MICROCONTROLLER
You need to mount and use your microcontroller on bread-board, vero-board or Printed Circuit Board (PCB). But how do you do it? Let me make things super easy for you.
Things to forget
- Forget about the code.
- Forget about all external components required for your code.
- Forget everything else that I forgot to mention.
Now, things to remember
- Microcontroller is an Integrated Circuit (IC) so it needs power source like any other IC.
- A clock source for internal operations.
- A Reset Circuit for proper start-up.
Don’t get confused, let me explain. In simple words, you need the above minimum circuitry to power-up the microcontroller properly. Let me repeat so you can get used to it.
You will actually need
- A Power Source.
- A Clock Source.
- A Reset Circuit.
I will now attempt to explain each requirement with a little bit of technical details and hope that you grasp the basic idea. It’s always good to gain some insight on how things actually work but if you’re not interested (like me), you can skip straight to the final circuitry that’s essential for any project.
The Power Source can be a battery or DC adapter but it must be capable of supplying sufficient current and voltage for normal operation of the circuit. If you’re using AT89C51 (most common variant of 8051) then the supply voltage must be 5V. Simply connect the positive terminal to the Vcc (PIN-40) and negative terminal to the Ground (PIN-20). Refer to the datasheet of your microcontroller for supply voltage and pin numbers (Vcc and GND).
Also note that you have to SET the External Access Pin (PIN-31) i-e connect it with Vcc. This step is important as we are not using external memory at this stage. Don’t forget to SET this pin or else your circuit won’t work properly.
Every microcontroller needs a clock source (pulses with specified frequency) for executing the code. All the internal operations are based on these clock pulses. Most of the modern microcontrollers have built-in clock sources. You can either use the built-in (if available) or connect an external according to your requirements. The most common type is the crystal oscillator that acts as a reliable clock source.
The AT89C51 variant comes equipped with an on-chip oscillator but it still requires an external clock to operate it so you’ll have to provide one. X1 (PIN-19) and X2 (PIN-18) are dedicated for this purpose. These pins are consecutive and a crystal oscillator has two legs so you can easily place it right away. You just need two small, cute, non-polar capacitors as shown in the diagram. I say non-polar because the direction doesn’t matter in this particular type of capacitor. You can insert it both ways.
You can select any frequency of your choice i-e 6MHz, 10MHz, 12MHz etc. All are supposed to work just fine but refer to the datasheet for the maximum frequency supported by your microcontroller. The only difference among these available frequencies is timing. A 12MHz system will complete an operation twice as fast as the 6MHz system. Same goes for the processors installed on your desktop PCs or laptops. Why do you prefer a 2.53GHz processor over a 1.2GHz? Because it’s faster.
There is one little trick though.
If you’re using serial communication (to be discussed later) then you need a standard baud-rate for it. In that case, you need to attach a very specific oscillator – the 11.0592MHz. The 8051 architecture is designed such that it can give you standard baud rates only if you connect this exact frequency crystal. To make things easier, why don’t you just connect 11.0592MHz every time and forget about all the frequency requirement stuff?
Reset means to start over, execute from the beginning, restart, or whatever else you call it. The Reset Circuit is supposed to do just that and it’s actually simpler than it sounds. It essentially serves two purposes
- Reset the microcontroller at start-up for proper execution of the code.
- Reset the microcontroller manually whenever desired.
See? It gets easier in that context. The capacitor acts as a short-circuit when DC is applied across it – that’s basic stuff. During charging, the RST pin is connected to the 5V supply and hence in HIGH state – the microcontroller automatically resets at start-up this way. Once the capacitor is fully charged, it acts as an open-circuit and the RST pin is driven LOW through the attached resistor. You’ve to take care of polarity in this case. The positive terminal of the capacitor should be connected to voltage source.
The button, on the other hand, works exactly the same way but manually. When pressed, it will SET the RST pin and microcontroller will reset. You can clearly see that it’s optional. Your circuit will work fine even without this button. It’s there for your convenience because every now and then, you’ll need to reset your microcontroller when you’re testing your code so using a wire to do the job will become hectic and unprofessional. Simply place that button and reset with style.
Now that you know all the basic requirements, let’s sum it up.
This is exactly what you must provide before starting any project. Nothing less, nothing more. It’s like the pre-requisite for all applications because the 8051 microcontroller simply can’t work without it. If you’re working on 8051, you need to have these components at your disposal all the time and you need to know what to do with them. This circuit is easily remembered once you try and implement it few times. Just do it right the first time and I promise you’ll never forget it.
Oh and by the way, if you’re facing all these components for the very first time then here is what they actually look like in the real world. Have a closer look so you would know what to look for when you enter that electronics store for these components.