新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 51單片機程序——數(shù)碼管全部亮起來

51單片機程序——數(shù)碼管全部亮起來

作者: 時間:2016-11-23 來源:網(wǎng)絡(luò) 收藏
#include
unsigned char code table[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,};// 顯示數(shù)值表0-9
void Delay(unsigned int t);
void main (void)
{
unsigned char i;
P1 = 0xff;
while (1)
{
for(i=0;i<10;i++) //加入 for循環(huán),表明for循環(huán)大括號中的程序循環(huán)執(zhí)行10次
{
P0=table[i]; //循環(huán)調(diào)用表中的數(shù)值
Delay(60000); //延時,方便觀看數(shù)字變化
}
}
}
void Delay(unsigned int t)
{
while(--t);
}



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

評論


技術(shù)專區(qū)

關(guān)閉