LED Interfacing with 8051 Microcontroller with Circuit Diagram Tutorial
LED INTERFACING WITH 8051 MICROCONTROLLER:
INTRODUCTION:
LED is a light emitting diode.It is used for lighting purposes in many electronic devices.
8051 Development board:
EXPLANATION:
- Here on the development board we can see 8 LEDS meant for interfacing with the 8051 microcontroller family.
- The steps involved in this project are as follows:-
- Compiling source code on Keil using C language.
- Programming the microchip using debugger.
- Interfacing the chip with LED through 8051 development board.
- Creating the schematic capture simulation diagram using Proteus software.
- Verifying the simulation and thereby compiling the schematic after verification is done.
VIDEO OF LED TOGGLING:-
- Click this link to watch the video of LED Toggling
SOURCE CODE:
#include<reg51.h>
sbit LED=P1^0;
void toggle(void);
void delay(int a);
int main(void)
{
toggle();
while(1)
{
LED=0;
delay(50000);
LED=1;
delay(50000);
}
}
void toggle(void)
{
P2=0x00;
}
void delay(int b)
{
int i;
for(i=0;i<b;i++);
}
CIRCUIT WORKING:
- Here in this circuit I have toggled the second LED (left to right from port 0) by the interfacing the 8051 microcontroller using the PORT 1 of the microcontroller.
- Initially the Reset pin (9th pin of 8051 chip) is connected to the 5V pin before connecting the 9V Power supply.
- After 5V passes through circuit then the RESET pin is connected to ground.
- A wire connection is given from the P2.0 of port 2 (single bit) to the second LED .
- The LED starts to glow white.
- The value of 50,000 USING Keil generates around 1s between on and off time. This is for the crystal oscillator of frequency 11.0592 Mhz.
PROTEUS SCHEMATIC: