#include"reg51.h"
void
main(void)
{
unsigned
int i;
while(1)
{
P1=0x01;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
P1=0x02;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
P1=0x04;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
P1=0x08;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
P1=0x10;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
P1=0x20;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
P1=0x40;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
P1=0x80;
for(i=0;i<30000;i++);
P1=0x00;
for(i=0;i<30000;i++);
}}
Another Simple Code For LED Blinking From Right To Left In PORT 1
Another Simple Code For LED Blinking From Right To Left In PORT 1
#include <AT89x52.H>
void delay(int time)
//This function produces a delay in msec.
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void main (void)
{
unsigned char j; /* LED var */
while (1)
{ /* Loop forever */
for (j=0x01; j<
0x80; j<<=1)
{ /* Blink LED 0, 1, 2, 3, 4, 5, 6 */
P1 = j;
delay(500);
}
for (j=0x80; j>
0x01; j>>=1)
{ /*
Blink LED 6, 5, 4, 3, 2, 1 */
P1 = j; /* Output to LED Port
*/
delay(500);
}
}
}
thank you for your explanation.internship is very important for engineering students.codebind technologies provide the free and best internship in chennai for eee students.visit-https://internshipinchennai.org.in/internship-in-chennai-for-eee.html
ReplyDelete