How To Display Text On LED Using 8051 Microcontroller
How To Display Text On LED Using 8051 Microcontroller
Description
LEDs are by far the most widely used means of taking output. They find huge
application as indicators during experimentations to check the validity of results at
different stages. They are very cheap and easily available in a variety of shape, size
and colors.
The principle of operation of LEDs is simple. The commonly available LEDs have
a drop voltage of 1.7 V and need 10 mA to glow at full intensity. The following
circuit describes how to glow an led.
The value of resistance R can be calculated using the equation, R= (V-1.7)/10 mA.
Since most of the controllers work on 5V, so substituting V= 5V, the value of
resistance comes out to be 330 ohm. The resistance 220 ohm, 470 ohm is
commonly used substitute in case 330 ohm is not available.
AT89C51 is a 40 pin microcontroller which belongs to 8051 series of
microcontroller. It has four ports each of 8 bits P0, P1, P2 and P3.The AT89C51
has 4K bytes of programmable flash. The port P0 covers the pin 32 to pin 39, the
port P1 covers the pin 1 to pin 8, the port P2 covers the pin 21 to pin 28 and the
port P3 covers the pin 10 to pin 17. Pin 9 is the reset pin. The reset is active high.
Whenever the controller is given supply, the reset pin must be given a high signal
to reset the controller and bring the program counter to the starting address
0x0000. The controller can be reset by manually connecting a switch or by
connecting a combination of resistor and capacitor as shown in the circuit
diagram. A 12 MHz crystal is connected between pin 18 pin 19. Pin 40 is Vcc and
pin 20 is ground. Pin 31, is connected to Vcc as we are using the internal memory
of the controller.
LEDs are connected to the port P0. LEDs need approximately 10mA current to
flow through them in order to glow at maximum intensity. However the output of
the controller is not sufficient enough to drive the LEDs, so if the positive leg of
the LED is connected to the pin and the negative to ground as shown in the figure,
the LED will not glow at full illumination.
Circuit Diagram
Code
// Program to blink the LEDs. LEDs are connected to port 0.
#include<reg51.h>
void main()
{
while(1)
{
P0=0x00;
delay(50);
P0=0xff;
delay(50);
}
}
Components
LED
Light emitting diodes (LEDs) are semiconductor light
sources. The light emitted from LEDs varies from
visible to infrared and ultraviolet regions. They
operate on low voltage and power. LEDs are one of...
AT89C51 or 89C51 microcontroller
AT89C51 is an 8-bit microcontroller and belongs to
458-Reads
Atmel's 8051 family. AT89C51 has 4KB of...