標(biāo)題:
單片機(jī)循環(huán)數(shù)碼管顯示程序
[打印本頁(yè)]
作者:
kkkkkkkk111
時(shí)間:
2020-12-23 17:37
標(biāo)題:
單片機(jī)循環(huán)數(shù)碼管顯示程序
循環(huán)顯示數(shù)碼管數(shù)字依次增加,像外面的電子屏樣的。用的是STCC52的開發(fā)板
#include<reg52.h>
#define uchar unsigned char
sbit s1=P2^6;
sbit s2=P2^7;
uchar con[]={0x7f,0xfe,0xfd, 0xfb,0xf7,0xef,0xdf,0xbf};
uchar date[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x06, 0x5b, 0x4f, 0x66,0x6d,0x7d, 0x07, 0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00} ;
int i,j,k;
void delay(int i){
while(i--);
}
void main(){
while(1)
for(i=0;i<15;i++)
{
k=1000;
while(k--) {
s1=0; s2=1;
P0=0xff;
for(j=0;j<8;j++) {
s1=0; s2=1;
P0=con[j];
delay(50);
s1=1; s2=0;
P0=date[i+j];
}
}
delay(100000);
}
}
復(fù)制代碼
作者:
admin
時(shí)間:
2020-12-23 23:26
本帖需要重新編輯補(bǔ)全電路原理圖,源碼,詳細(xì)說(shuō)明與圖片即可獲得100+黑幣(帖子下方有編輯按鈕)
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1