8051 is a CISC (Complex Instruction Set Computer) type microcontroller. CISC type architecture means the instruction sizes are not same but they are different. Instruction sizes are of either 1-Byte or 2-Bytes or 3-Bytes. To execute the program stored in PROM of 8051 microcontroller, we need to do some connections with some small circuits is called the basic circuit of 8051 microcontroller. The basic circuit consists of 4 sections:
- Reset Circuit
In this circuit, Simple RC circuit is implemented as shown in the above diagram. The RST pin is active high pin. The Reset condition for 8051 Microcontroller is if the Logic ‘1’ will be applied on this pin for 2 machine cycles (24 clocks of the Crystal Oscillator) continuously then the 8051 microcontroller will be reset and will maintain in the Reset state as long as Logic ‘1’ is available on the RST pin. Once Logic ‘0’ is applied, the 8051 microcontroller starts the program execution.
- Crystal Oscillator Circuit
Crystal Oscillator Circuit is the Heartbeats of the whole system. Any oscillator circuit generates Sinusoidal Waveform due to the LC or RC or RL feedback circuit which is negative feedback. The 8051 microcontroller consists of positive feedback circuit internally. Due to that, the sinusoidal oscillations get converted into square wave which is used as a clock signal to drive the whole architecture of 8051 microcontroller.
- Connect EA’/VPP pin to +5V.
The 8051 microcontroller can access internal as well as external PROM and RAM memories. To use the internal PROM and RAM memory, this pin should be connected to +5V. If we want to interface external memories then we must connect this pin to Ground (GND).
- Connect 4.7KΩ or 10KΩ pull-up resistors to each pin of Port0.
All the Port0 pins of 8051 microcontroller are open drain internally. That means, to complete the internal FET circuits; one must connect external pull-up resistors to each pin of Port0. If we will not connect pull-up resistors then the internal FET circuit will not be completed and whatever load is connected to any pin of Port0 will not be driven by the program.
We need the following list of components to design the basic circuit of 8051 microcontroller:
|3||R1||10K Resistor SIP||1|
|5||SW1||6mm Tactile Switch||1|
|8||—||5V, 1A DC Adapter/SMPS||1|
|11||—||Single Stand Connecting Wires||1 meter|
- LED(s) Interfacing with AT89C51
LED stands for Light Emitting Diode. LED is semiconductor device which has wide number of applications such as Indicators, Lightning System and Advertising Displays etc. To turn LED ON we need to apply forward voltage of ≥1.7V. Typically LEDs drag current from 1mA to 20mA. So one may design the resistor value to control the current passing through the LED using Ohm’s Law R=V/I. LEDs are not only used for ON/OFF applications but for controlling light intensity in home applications also using PWM (Pulse Width Modulation).
8051 Microcontroller has the capacity to sink/source the maximum current of 10mA on single I/O Port Pin. If we want to interface an LED to any port pin then we must think of in which way it would be better for interfacing so that LED will work properly for lifetime.
LEDs can be interfaced either in Common Cathode fashion (As shown in the above diagram) and Common Anode fashion.
Common Cathode fashion: The Cathode terminals of all the LEDs should be combined together and connected to Ground potential and the Anode terminals of all the LEDs should be connected to separate port pins. In this case, we need to send Logic ‘1’ on the corresponding port pin to turn the LED(s) ON and Logic ‘0’ to turn LED(s) OFF. This kind of interfacing is quite easy in programming point of view.
Common Anode fashion: The Anode terminals of all the LEDs should be combined together through current limiting resistors and connected to Positive terminal of the power supply and the Cathode terminals of all the LEDs should be connected to separate port pins. In this case, we need to send Logic ‘0’ on the corresponding port pin to turn the LED(s) ON and Logic ‘1’ to turn LED(s) OFF. This kind of interfacing is quite confusing in programming point of view.