Transformer Designer

Winding Calculator

Wire Gauge Calculator Pro


8051 Basic Led Flasher


It’s an 8051 based basic LED flasher that is very useful for beginners. It describes parts, connections between them and programming environment for 8051 micro-controller.



It provides foundation for microcontroller based application development for students, hobbies and beginners. It provides basics of 8051, minimum parts required, connection between them and programming environment for 8051 microcontroller.
Pin 20, 40 are power pins of microcontroller. Pin 40 is connected to 5V and pin 20 to ground. Pin EA (External Access) is connected to 5V. If we connect EA to 5V(logic 1) then it means code burnt inside microcontroller chip will be executed and if we connect it to ground(logic 0) then code inside an external RAM connected to microcontroller will be executed. Now we examine this circuit in parts.


Click to Enlarge

When we power up our circuit then power and oscillator parts take some time to be stabilized. During this time we have to wait before starting program execution. If we does not wait and start program execution immediately then then there may be undesirable results. Suppose we have performed time calculation for some purposes then microcontroller may calculate wrong time value. Microcontroller manufacturers provide a reset pin that is used to accomplish this task with some extra components. To introduce delay we use circuit given in above figure. It is an RC oscillator that provides some delay according resistor-capacitor values used. In standard 8051 microcontroller pin 9 is used for reset. Capacitor C1 takes some time to charge up through R1 to a certain level. Before reaching this level pin 9 remains in reset state (logic 0) and program execution is not started. When this capacitor is charged to logic 1 level then program execution starts.


Click to Enlarge

Usually microcontroller oscillator frequency selection option is given by the manufacturer to the circuit designer. Designer can select different frequencies. In ATmel’s 8051 microcontroller we can use this option as shown in above figure. This circuit uses crystal XT and 2 capacitors Cx1, Cx2 with internal oscillator of microcontroller to complete it. Different microcontrollers use different operating frequency range. Please consult datasheet of specific microcontroller for this purpose. ATmel’s AT89C51, AT89C52, AT89C2051 use maximum 24 Mhz, AT89S51, AT89S52, AT89C55 use maximum 33 MHz.


// Start of code.

// Header file for AT89x051 microcontrollers.
#include <AT89x051.h>

// Delay routine.
void delay(unsigned int del)
	while(del --);

// Main routine.
void main()
		P1_0 = 0;	// Turn off pin 0 of port 1.
		delay(30000);	// Give some delay.
		P1_0 = 1;	// Turn on pin 0 of port 1.
		delay(30000);	// Give some delay.

// End of code.

This code can also be executed on AT89C2051 microcontroller a small brother of AT89C51.

Related Projects

Electronic Dice using 8051

2-Way Traffic Signal Controller

8051 To Seven Segment Display Interfacing

More Projects

Our Efforts

Get Visibile

Bluetooth Device Control

Resistor Color Codes App

Wire Gauge Calculator App