8x8点阵显示26个英文字母.docx
《8x8点阵显示26个英文字母.docx》由会员分享,可在线阅读,更多相关《8x8点阵显示26个英文字母.docx(8页珍藏版)》请在冰豆网上搜索。
8x8点阵显示26个英文字母
#include
#defineucharunsignedchar
#defineuintunsignedint
sbitdiola=P2^5;
sbitdula=P2^6;
sbitwela=P2^7;
unsignedintcount,m=50,i=0;
ucharcodetable[26][8]={{0xff,0xe7,0xe7,0xdb,0x81,0xbd,0x7e,0xff},//A
{0xff,0xc1,0xbd,0xc1,0xbd,0x7d,0x81,0xff},//B
{0xff,0xc3,0xbd,0xfd,0xfd,0x79,0x83,0xff},//C
{0xff,0xc1,0x9d,0xbd,0xbd,0x9d,0xc1,0xff},//D
{0xff,0x81,0xfd,0x81,0xfd,0xfd,0x81,0xff},//E
{0xff,0x81,0xfd,0x81,0xfd,0xfd,0xfd,0xff},//F
{0xff,0xc3,0xb9,0xfd,0x8d,0xb9,0x83,0xff},//G
{0xff,0xbd,0xbd,0x81,0xbd,0xbd,0xbd,0xff},//H
{0xff,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xff},//I
{0xff,0xbf,0xbf,0xbf,0xbf,0xbd,0xc3,0xff},//J
{0xff,0x9d,0xed,0xf5,0xe9,0xdd,0xbd,0xff},//k
{0xff,0xfd,0xfd,0xfd,0xfd,0xfd,0x81,0xff},//L
{0xff,0x99,0x99,0x99,0xa5,0xa5,0xa5,0xff},//M
{0xff,0xb9,0xb9,0xb5,0xad,0x9d,0x9d,0xff},//N
{0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff},//O
{0xff,0xc1,0xbd,0xbd,0xc1,0xfd,0xfd,0xff},//P
{0xff,0xc3,0x99,0xbd,0xbd,0xa9,0xc3,0xbf},//Q
{0xff,0xc1,0xbd,0x81,0xbd,0xbd,0xbd,0xff},//R
{0xff,0xc3,0xbd,0xc3,0x3f,0x7d,0x83,0xff},//S
{0xff,0x80,0xf7,0xf7,0xf7,0xf7,0xf7,0xff},//T
{0xff,0xbd,0xbd,0xbd,0xbd,0xbd,0xc3,0xff},//U
{0xff,0x7e,0xbd,0xdd,0xdb,0xe3,0xf7,0xff},//V
{0xff,0xff,0xff,0x66,0xa6,0x99,0x99,0xff},//W
{0xff,0xdd,0xeb,0xf7,0xe3,0xd9,0xbc,0xff},//X
{0xff,0xbc,0xd9,0xe3,0xf7,0xf7,0xf7,0xff},//Y
{0xff,0x80,0xdf,0xe7,0xfb,0xfd,0x80,0xff}//Z
};
voiddelay(unsignedinta)
{
while(a--);
}
voiddelay_1()
{
inti,j;
for(i=1000;i>0;i--)
for(j=159;j>0;j--);
}
voidinit()
{
TMOD=0x01;
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
EA=1;
ET0=1;
TR0=1;
}
voidmain()
{unsignedchari=0;
init();
wela=1;
P0=0xff;
wela=0;
delay(50);
while
(1)
{
m=50;
if(count==20)
{
count=0;
while(m--)
{
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(50);
dula=1;
P0=table[i][0];
dula=0;
delay(50);
diola=1;
P0=0x01;
diola=0;
delay(50);
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(50);
dula=1;
P0=table[i][1];
dula=0;
delay(50);
diola=1;
P0=0x02;
diola=0;
delay(50);
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(50);
dula=1;
P0=table[i][2];
dula=0;
delay(50);
diola=1;
P0=0x04;
diola=0;
delay(50);
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(50);
dula=1;
P0=table[i][3];
dula=0;
delay(50);
diola=1;
P0=0x08;
diola=0;
delay(50);
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(50);
dula=1;
P0=table[i][4];
dula=0;
delay(50);
diola=1;
P0=0x10;
diola=0;
delay(50);
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(5);
dula=1;
P0=table[i][5];
dula=0;
delay(50);
diola=1;
P0=0x20;
diola=0;
delay(50);
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(50);
dula=1;
P0=table[i][6];
dula=0;
delay(50);
diola=1;
P0=0x40;
diola=0;
delay(50);
diola=1;
dula=1;
P0=0x00;
diola=0;
dula=0;
delay(50);
dula=1;
P0=table[i][7];
dula=0;
delay(50);
diola=1;
P0=0x80;
diola=0;
delay(50);
}
i++;
i=i%26;
}
}
}
voidtime0()interrupt1
{
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
count++;
}