新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 51單片機程序——點陣顯示漢字

51單片機程序——點陣顯示漢字

作者: 時間:2016-11-23 來源:網(wǎng)絡(luò) 收藏
#include
#define uint unsigned int
unsigned char code tab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
unsigned char code digittab[]={0x14,0x18,0xff,0x18,0x14,0x18,0xff,0x18}; //
unsigned char code digittab1[]={0x54,0xff,0x54,0x3f,0x55,0xfd,0x55,0x1d}; //
unsigned char code digittab2[]={0x54,0x10,0x5a,0xf6,0x5f,0xf6,0x5a,0x12}; //
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main()
{
int i,t=50;
while(1)
{
while(t--)
{
for(i=0;i<8;i++)
{
P0=tab[i];
P1=digittab[i];
delay(5);
}
}
P0=0xff;
delay(100);
t=50;
while(t--)
{
for(i=0;i<8;i++)
{
P0=tab[i];
P1=digittab1[i];
delay(5);
}
}
P0=0xff;
delay(100);
t=50;
while(t--)
{
for(i=0;i<8;i++)
{
P0=tab[i];
P1=digittab2[i];
delay(5);
}
}
P0=0xff;
delay(100);
t=50;
}
}


評論


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

關(guān)閉