/*************************************************************************************
另一个方法实现两个8×8点阵字符显示
8x8点阵循环显示I A T 8 9 C 5 1
****************************************************************************************/
#include"reg51.h"
#define uint unsigned int
#define uchar unsigned char
code uchar tab1[]={// 显示的字符代码
0x00,0x04,0x00,0x3C,0x03,0xC4,0x1C,0x40,//"A"
0x07,0x40,0x00,0xE4,0x00,0x1C,0x00,0x04,
0x18,0x00,0x10,0x00,0x10,0x04,0x1F,0xFC,//"T"
0x10,0x04,0x10,0x00,0x18,0x00,0x00,0x00,
0x00,0x00,0x0E,0x38,0x11,0x44,0x10,0x84,//"8"
0x10,0x84,0x11,0x44,0x0E,0x38,0x00,0x00,
0x00,0x00,0x07,0x00,0x08,0x8C,0x10,0x44,//"9"
0x10,0x44,0x08,0x88,0x07,0xF0,0x00,0x00,
0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,//"C"
0x10,0x04,0x10,0x08,0x1C,0x10,0x00,0x00,
0x00,0x00,0x1F,0x98,0x10,0x84,0x11,0x04,//"5"
0x11,0x04,0x10,0x88,0x10,0x70,0x00,0x00,
0x00,0x00,0x08,0x04,0x08,0x04,0x1F,0xFC,//"1"
0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00};
const uchar tab2[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};// 扫描代码
void delay(uint n) //延时函数
{ uint i;
for(i=0;i }
void main(void)
{
char j=0,r,q=0,t=0;
while(1)
{ for(r=0;r for(j=q;j {
if(t%2==0)
{
P1=tab2[t];
P2=tab1[j];
delay(225);
}
else
{ P1=tab2[t];
P3=tab1[j];
delay(225);
}
t++;
if(t==16)
t=0;
}
q=q+16; // 显示下一个字符
if(q==112)
q=0;
}
}