8x8点阵显示26个英文字母
- 格式:doc
- 大小:25.50 KB
- 文档页数:12
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit diola=P2^5;
sbit dula=P2^6;
sbit wela=P2^7;
unsigned int count,m=50,i=0;
uchar code table[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
页脚内容1
{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 };
页脚内容2
void delay(unsigned int a)
{
while(a--);
}
void delay_1()
{
int i,j;
for(i=1000;i>0;i--)
for(j=159;j>0;j--);
}
void init()
{
TMOD=0x01;
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
EA=1;
页脚内容3
ET0=1;
TR0=1;
}
void main()
{ unsigned char i=0;
init();
wela=1;
P0=0xff;
wela=0;
delay(50);
while(1)
{
m=50;
if(count==20)
{
count=0;
页脚内容4
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);
页脚内容5
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;
页脚内容6
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;
页脚内容7
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);
页脚内容8
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];
页脚内容9
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);
页脚内容10
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;
页脚内容11
diola=0;
delay(50);
}
i++;
i=i%26;
}
}
}
void time0() interrupt 1
{
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
count++;
}
页脚内容12。