標(biāo)題:
如何用keil和proteus點(diǎn)亮流水燈 求幫助
[打印本頁(yè)]
作者:
哈哈HH
時(shí)間:
2018-1-22 14:48
標(biāo)題:
如何用keil和proteus點(diǎn)亮流水燈 求幫助
代碼:
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar temp[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff};
void delay(uint z)
{
uint x,y;
for(x=100;x>0;x--)
for(y=z;y>0;y--);
}
void main()
{
uchar i;
while(1)
{
for(i=0;i<9;i++)
{
P0=temp[i];
delay(400);
}
for(i=0;i<9;i++)
{
P1=temp[i];
delay(400);
}
}
}
復(fù)制代碼
proteus中電路圖
[img][/img]
點(diǎn)亮流水燈有4種方法
1、最基礎(chǔ)的方法,分條列舉出來(lái)
2、先左移,后或
3、調(diào)用左移函數(shù)_crol_()
4、使用數(shù)組{0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1