|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区
您需要 登录 才可以下载或查看,没有账号?立即注册
×
#include <reg51.h>
sbit P0_1=P0^1;
sbit P0_2=P0^2;
delay_once()
{
long count;
count =250*1000;
for(;count>0;count--)
{
}
}
delay(int i)
{
int m;
m=i;
while(i--)
{
delay_once();
}
}
main()
{
P0_1 = 1;
P0_2 = 1;
while(1)
{
//1 活化
P0_1 = 0;
P0_2 = 1;
delay(3);
P0_1 = 1;
P0_2 = 1;
delay(5);
P0_1 = 1;
P0_2 = 1;
delay(4);
//2 活化
P0_1 = 1;
P0_2 = 0;
delay(3);
P0_1 = 1;
P0_2 = 1;
delay(5);
P0_1 = 1;
P0_2 = 1;
delay(4);
}
} |
|