新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > 51单片机C编程(一、跑马灯)

51单片机C编程(一、跑马灯)

作者: 时间:2016-11-27 来源:网络 收藏
//这是一个51单片机跑马灯C程序,已经在PROTEUS软件上仿真通过

#include
void delay(int);
void main()
{
int i;
P0=0x01;
delay(500);
while(1)
{
for(i=0;i<7;i++)
{
P0<<=1;
delay(500);
}
P0=0x01;
delay(500);
}
}
void delay(int x)
{
int i,j;
for(i=x;i>0l;i--)
for(j=110;j>0;j--);
}

本文引用地址:https://www.eepw.com.cn/article/201611/322164.htm


评论


技术专区

关闭