<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 玩轉單片機之四-點(diǎn)亮4個(gè)數碼管

玩轉單片機之四-點(diǎn)亮4個(gè)數碼管

作者: 時(shí)間:2016-11-18 來(lái)源:網(wǎng)絡(luò ) 收藏
#include

#define uchar unsigned char //byte
#define uint unsigned int //word

本文引用地址:http://dyxdggzs.com/article/201611/315870.htm

sbit led1=P0^0;
sbit led2=P0^1;
sbit fir=P2^4; //fir=0;工作
sbit sec=P2^5; //sec=0;工作
sbit thi=P2^6; //thi=0;工作
sbit fot=P2^7; //fot=0;工作

uchar table[]={0x28,0xeb,0x32,0xa2,0xe1,0xa4,0x24,0xea,0x20,0xa0};
//P1=table[i]; 0 1 2 3 4 5 6 7 8 9

/**************************************************/
/* 延時(shí)模塊 聲明:void delay(int); */
/**************************************************/
void delay(int x) //如 delay(1000),延時(shí)1s
{
int i,j;
for(i=0;ifor(j=1;j<=125;j++); //延時(shí)約1ms
}
void main(void)
{/*初始化數據*/
uchar a;
a=0x08;
/*串口初始化,波特率為9600*/
TMOD=0x20;
PCON=0x00;
SCON=0x50;
TL1=0xfd;
TH1=0xfd;
TR1=1;

while(1)
{/*點(diǎn)亮4個(gè)數碼管,P2為選擇數碼管編號,P1為選擇數字,同時(shí)點(diǎn)亮led燈*/
delay(800);P2=0x0F;P1=table[0];led1=0; led2=1;
delay(800);P2=0x0F;P1=table[1];led1=1; led2=0;
delay(800);P2=0x0F;P1=table[2];led1=0; led2=1;
delay(800);P2=0x0F;P1=table[3];led1=1; led2=0;
delay(800);P2=0x0F;P1=table[4];led1=0; led2=1;
delay(800);P2=0x0F;P1=table[5];led1=1; led2=0;
delay(800);P2=0x0F;P1=table[6];led1=0; led2=1;
delay(800);P2=0x0F;P1=table[7];led1=1; led2=0;
delay(800);P2=0x0F;P1=table[8];led1=0; led2=1;
delay(800);P2=0x0F;P1=table[9];led1=1; led2=0;

/*發(fā)送字節數據*/
SBUF=a;
while(TI==0) ;
TI=0;
}
}



關(guān)鍵詞: 單片機數碼

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>