Here I discuss on simple project of led blinking by 8051 microcontroller using mikro c pro for 8051. As we know 8051 microcontroller has four ports Port0, Port1, Port2 and Port3. Please go through my previous post Ports in 8051 microcontroller  first and get complete knowledge on how different ports are work. So complete our project led blinking by 8051 microcontroller using mikro c pro for 8051, we have to connect LEDs at any of those ports.

Project Description:

In this project we connect three LEDs at three different pin (Port2_0, Port_1, Port_2) of Port 2.And it will blink after certain delay. For doing that we have to send different bit pattern with fixed delay to on-off LED. To glow the LED connected on Port2_0 bit pattern will be “00000001”, for Port2_1 bit pattern will be “00000010” and for Port2_2 bit pattern will be “00000100”.In bellow we will see the circuit diagram in Proteus simulation of our project  “LED blinking by 8051 microcontroller using mikro c pro for 8051”.

LED blinking by 8051 microcontroller using mikro c pro for 8051

Here you will find the embedded C program written in Mikro c pro for 8051.

Embedded C Code
// Name : LED blinking by 8051 microcontroller using mikro c pro for 8051

// Author : Subham Dutta
// Date : 26-07-14
// Website : www.nbcafe.in
void main() {
while(1)
{P2 = 0b00000001; // Turn ON diodes on PORT2_0 bit
delay_ms(200);
P2 =0B00000010;
delay_ms(200);
P2 =0B00000100;
delay_ms(200);
}
}