Embedded Code and Circuit for Blinking 8 LEDs

Here I am using 8 LEDs which are connected to Port 1 of microcontroller.

I am using 8051 microcontroller - AT89C52 with crystal frequency of 11.0592 MHz.

We design our circuit in Proteus ISIS first and then write the code in Keil uvision.

Code:

#include<reg51.h>

void delay(int a);  // function declaration

// main function

void main(){

while(1){

P1=0x01;

delay(30000);

while(P1){

P1 = P1<<1;  // bitwise operation left shift along 1-bits

delay(30000);

}

}

}

void delay(int a){

int i;

for(i=0; i<a; i++);

}

Circuit:


Comments

Popular posts from this blog

A Simple LED Blinking using Keil uvision and Proteus