微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 51单片机程序——点阵显示汉字

51单片机程序——点阵显示汉字

时间:11-23 来源:互联网 点击:
#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;

}

}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top