文档库 最新最全的文档下载
当前位置:文档库 › 51单片机流水灯程序

51单片机流水灯程序

#include

void Delay(unsigned int t);

void main(){

while(1)

{
P1=0x7f;
Delay(200); P1=0xbf;
Delay(200);

P1=0xdf;
Delay(200);

P1=0xef;
Delay(200);

P1=0xf7;
Delay(200);

P1=0xfb;
Delay(200); P1=0xfd;
Delay(200);

P1=0xfe;
Delay(200);
P1=0xfe;
Delay(200);
P1=0xfd;
Delay(200);
P1=0xfb;
Delay(200);
P1=0xf7;
Delay(200);
P1=0xef;
Delay(200);
P1=0xdf;
Delay(200);
P1=0xbf;
Delay(200);
P1=0x7f;
Delay(200);
P1=0xe7;
Delay(200);
P1=0xdb;
Delay(200);
P1=0xbd;
Delay(200);
P1=0x7e;
Delay(200);
P1=0x7e;
Delay(200);
P1=0xbd;
Delay(200);
P1=0xdb;
Delay(200);
P1=0xe7;
Delay(200);
P1=0xf0;
Delay(500);
P1=0x0f;
Delay(200);
P1=0xf0;
Delay(200);
P1=0x0f;
Delay(200);
P1=0xf0;
Delay(200);
P1=0x0f;
Delay(200);
P1=0x18;
Delay(200);
P1=0xe7;
Delay(200);
P1=0x18;
Delay(200);
P1=0xe7;
Delay(200);
P1=0x18;
Delay(200);
P1=0xe7;
Delay(200);
P1=0x00;
Delay(200);
P1=0xff;
Delay(200);
P1=0x00;
Delay(200);
P1=0xff;
Delay(200);
P1=0x00;
Delay(200);
P1=0xff;
Delay(200);
P1=0x3c;
Delay(200);
P1=0xc3;
Delay(200);
P1=0x3c;
Delay(200);
P1=0xc3;
Delay(200);
P1=0x3c;
Delay(200);
P1=0xc3;
Delay(200);
P1=0x3f;
Delay(200);
P1=0xcf;
Delay(200);
P1=0xf3;
Delay(200);
P1=0xfc;
Delay(200);
P1=0xfc;
Delay(200);
P1=0xf3;
Delay(200);
P1=0xcf;
Delay(200);
P1=0x3f;
Delay(200);
P1=0xaa;
Delay(200);
P1=0x55;
Delay(200);
P1=0xaa;
Delay(200);
P1=0x55;
Delay(200);
P1=0xaa;
Delay(200);
P1=0x55;
Delay(200);
}

}
void Delay(unsigned int t)
{
unsigned int i,j;

for(i=0;ifor(j=0;j<112;j++);
}

相关文档
相关文档 最新文档