缘由proteus流水灯-嵌入式-CSDN问答 仿真51单片机流水灯代码-编程语言-CSDN问答 protues仿真单片机控制led流水灯-嵌入式-CSDN问答
#include<reg52.h>//头文件
void main() //主函数
{
unsigned char y2=3;
unsigned int ys=0;
while(1)
{
if(!++ys)
{
P0=y2;
if(!(y2*=4))y2=3;
}
}
}
#include<reg52.h>//头文件
void main() //主函数
{
unsigned char b=0;
unsigned int ys=0;
P0=255;
while(1)
{
if(!++ys)
{
switch(++b)
{
case 1:P0 = ~0x03; break;
case 2:P0 = ~0x0c; break;
case 3:P0 = ~0x30; break;
default: P0 = ~0xc0;break;
}
if(b>3)b=0;
}
}
}
#include<reg52.h>//头文件
void main() //主函数
{
unsigned char y2=0x03;
unsigned int ys=0x00;
while(1)
{
if(!++ys)
{
P0=~y2;
if(!(y2*=0x04))y2=0x03;
}
}
}