標(biāo)題: proteus仿真實(shí)現(xiàn)流水燈,有原理圖,有程序 [打印本頁(yè)]
作者: lifenlili 時(shí)間: 2018-4-11 09:12
標(biāo)題: proteus仿真實(shí)現(xiàn)流水燈,有原理圖,有程序
/* 名稱:從左到右的流水燈
說明:接在P0口的8個(gè)LED從左到右循環(huán)依次點(diǎn)亮,產(chǎn)生走馬燈效果
*/
#include<reg51.h>
#include<intrins.h>
#defineucharunsigned char
#defineuintunsigned int
//延時(shí)
void DelayMS(uint x)
{
uchar i;
while(x--)
{
for(i=0;i<120;i++);
}
}
//主程序
voidmain()
{
P0=0xfe;
while(1)
{
P0=_crol_(P0,1); //P0的值向左循環(huán)移動(dòng)
DelayMS(150);
}
}
-
圖片1.png
(58.39 KB, 下載次數(shù): 145)
下載附件
2018-4-11 09:11 上傳
proteus工程圖
歡迎光臨 (http://www.torrancerestoration.com/bbs/) |
Powered by Discuz! X3.1 |