8051 = Led Blinking in Current Sinking Mode

 

LED Blinking in current sinking mode




 C language Code



#include<reg51.h> // header file for 8051

void delay (int t); // declaration of a function

sbit led = P1^0; // serial bit

void main()

{

led = 1; // led off initially

while (1)

{

led = 0;

delay (2);

led = 1;

delay (2);

}

}

void delay (int t) // delay subroutine program

{

int i,j;

for (i=0;i<100*t;i++)

{

for (j=0;j<=1275;j++);

}

}






Comments