標(biāo)題:
單片機(jī)循環(huán)點(diǎn)亮流水燈源程序
[打印本頁]
作者:
戒驕戒躁
時(shí)間:
2020-3-18 16:46
標(biāo)題:
單片機(jī)循環(huán)點(diǎn)亮流水燈源程序
#include<reg52.h>//52系列單片機(jī)頭文件
#include<instrins.h>//循環(huán)左移的頭文件
#define uint unsigned int//宏定義
#define uchar unsigned char//宏定義
void delayms(uint);//聲明子函數(shù)
uchar aa;//定義一個(gè)變量為aa,
void main()//主函數(shù)
{
aa=0xfe;//aa的初值1111 1110
while(1)
{
P1=aa;
delayms(500);
aa=_crol_(aa,1)//循環(huán)左移,即aa往左移一次1111 1101,再移一次1111 1011
}
}//一直是主函數(shù)
void delayms(uint xms)//延時(shí)函數(shù)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--)
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1