|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区
您需要 登录 才可以下载或查看,没有账号?立即注册
×
#include<reg52.h>
sbit LED0=P1^0;
sbit LED1=P1^1;
sbit LED2=P1^2;
sbit LED3=P1^3;
sbit LED4=P1^4;
sbit LED5=P1^5;
sbit LED6=P1^6;
sbit LED7=P1^7;
void delay(float t)
{
unsigned int j,i;
j=t*100;
while(j--) // 150400-1
{
for(i=1505;i;i--); //1505-1=1504 1504-1=1503
}
}
void main()
{
while(1)
{
LED0=0;
delay(0.5);
LED0=1;
delay(0.5);
LED1=0;
delay(0.5);
LED1=1;
delay(0.5);
LED2=0;
delay(0.5);
LED2=1;
delay(0.5);
LED3=0;
delay(0.5);
LED3=1;
delay(0.5);
LED4=0;
delay(0.5);
LED4=1;
delay(0.5);
LED5=0;
delay(0.5);
LED5=1;
delay(0.5);
LED6=0;
delay(0.5);
LED6=1;
delay(0.5);
LED7=0;
delay(0.5);
LED7=1;
delay(0.5);
}
} |
|