代碼如下:
#include"AT89x52.h"
#include"intrins.h"
#define uint unsigned int
#define uchar unsigned char
sbit WEI=P2^7; //74HC573的LE端 LED的位選端
sbit SJ=P1^4; //LED的使能端
void delay(uint z) //延時(shí)函數(shù)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
main() //主函數(shù)
{
uchar temp=0xfe;
WEI=1;
P0=0xff;
WEI=0; //上面三行代碼讓所有數(shù)碼管不顯示任何數(shù)值
SJ=0; //開(kāi)LED發(fā)光管總使能
while(1) //循環(huán)執(zhí)行下面3行代碼
{
P0=temp;
temp=_crol_(temp,1); //移位
delay(200); //延時(shí)
}
}
只需要修改最后一行的 延時(shí)就行了
delay(200); //延時(shí)
你把200改為別的數(shù)看看.
在0-65535之間改
| 歡迎光臨 (http://m.raoushi.com/bbs/) | Powered by Discuz! X3.1 |