- 6
- 0
- 约1.41千字
- 约 3页
- 2018-11-23 发布于河南
- 举报
终极流水灯单片机C语言程序
#includereg52.h
#includeintrins.h
#define uint unsigned int
sbit beep=P2^3;
void ji_ou();
void sx();
void shanshuo();
void two_out_in_out();
void four_out_in_out();
void delay(uint z)
{
uint x,y;
for(x=z;x0;x--)
for(y=110;y0;y--);
}
void main()
{
ji_ou();
sx();
two_out_in_out();
four_out_in_out();
shanshuo();
P1=0xff;
while(1);
}
void ji_ou()
{
uint t;
for(t=0;t3;t++)
{
P1=0xaa;
delay(300);
P1=0x55;
delay(300);
}
}
void sx()
{
uint a,i,j;
for(j=0;j3;j++)
{
a=0xfe;
for(i=0;i8;i++)
{
P1=a;
//delay(200);
beep=0;
delay(50);
beep=1;
delay(50);
a=_crol_(a,1);
}
a=0x7f;
for(i=0;i8;i++)
{
P1=a;
//delay(200);
beep=0;
delay(50);
beep=1;
delay(50);
a=_cror_(a,1);
}
}
}
void two_out_in_out()
{
uint i,j;
P1=0xff;
for(i=0;i3;i++)
{
P1=0x7e;
delay(300);
P1=0xbd;
delay(300);
P1=0xdb;
delay(300);
P1=0xe7;
delay(300);
}
P1=0xff;
for(j=0;j3;j++)
{
P1=0xe7;
delay(300);
P1=0xdb;
delay(300);
P1=0xbd;
delay(300);
P1=0x7e;
delay(300);
}
}
void four_out_in_out()
{
uint k;
P1=0xff;
for(k=0;k3;k++)
{
P1=0x3c;
delay(300);
P1=0xc3;
delay(300);
}
P1=0xff;
for(k=0;k3;k++)
{
P1=0xc3;
delay(300);
P1=0x3c;
delay(300);
}
}
void shanshuo()
{
uint k;
P1=0xff;
for(k=0;k6;k++)
{
P1=~P1;
delay(300);
beep=0;
delay(50);
beep=1;
delay(50);
}
}
您可能关注的文档
最近下载
- 地面拆除施工方案范文.docx VIP
- 部编版四年级下册道德与法治教案(全册) .docx
- 电梯维保合同终止协议书通用8篇.docx VIP
- JTP-12×1.2矿用提升绞车设计计算书.doc VIP
- 党员干部个人组织生活会个人对照(学习贯彻党的创新理论方面;加强党性锤炼方面;联系服务职工群众方面;发挥先锋模范作用方面;改作风树新风等方面)存在的问题清单及整改措施.docx VIP
- 渔业资源与渔场学全套教学课件.pptx VIP
- 六篇2025年度民主生活会对照检查(五个带头).docx VIP
- 公司检验员员工岗位矩阵图.doc VIP
- 监理教材精讲概论(完整)--在线版.pptx VIP
- TCACM001—2017中药品质评价方法指南.pdf VIP
原创力文档

文档评论(0)