標題:
51單片機最簡單8燈流水燈程序
[打印本頁]
作者:
1849241397
時間:
2017-10-20 09:31
標題:
51單片機最簡單8燈流水燈程序
#include<reg51.h>//包含文件
void delayms(unsigned int t)
{
unsigned int j,i;
for(i=0;i<t;i++)
{
for(j=0;j<120;j++);
}//延時程序大概是1ms
}
void main ()
{
unsigned int a;
unsigned char A;
A=0x1;
for(a=0;a<8;a++)
{
P0=~A;
A=(A<<1);
delayms(100);//位移
}
}
作者:
pxh316
時間:
2019-1-16 15:11
謝謝樓主分享!
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1