#include<reg52.h> //52單片機(jī)頭文件
#include <intrins.h> //包含有左右循環(huán)移位子函數(shù)的庫
sbit sj=P1^4;
sbit duan=P2^6;
sbit wei=P2^7;
#define uint unsigned int //宏定義
#define uchar unsigned char //宏定義
void delay(uint z) //延時(shí)函數(shù),z的取值為這個(gè)函數(shù)的延時(shí)ms數(shù),如delay(200);大約延時(shí)200ms.
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main() //主函數(shù)
{
uchar a , temp=0xfe;
sj=0;
while(1) //大循環(huán)
{ wei=0;
//P0=temp;
a++ ;
P0=~a;
delay(500);
a=_crol_(a,1);
}
}
另外 如果想要LED數(shù)碼管也是滾動(dòng)顯示,應(yīng)該怎樣編程呢??
請(qǐng)懂的朋友指導(dǎo)一下小弟,感激不盡~~~~
幫你搞定了,你下載到板子上看看,是不是你想要的效果,
思路是送入段碼后,也就是送你想要滾動(dòng)顯示的字符,然后鎖存負(fù)責(zé)段選的那個(gè)74hc573,以維持段碼不變,再按你的程序原來的方式來滾動(dòng)控制位選,實(shí)現(xiàn)滾動(dòng)顯示。我只改了一點(diǎn)點(diǎn).你點(diǎn)下面的鏈接下載源代碼.
http://m.zg4o1577.cn/ziliao/file/liusd.rar
歡迎光臨 (http://m.zg4o1577.cn/bbs/) | Powered by Discuz! X3.1 |