求大神帮忙研究一下这个(32x16点阵移动显示文字)
前段时候在论坛下载的,感觉很不错想研究一下,但是本人基础不好。希望大神帮忙解释一下
#include<reg51.h>
unsigned char code P2H[]={ 0x10,0x20,0x40,0x80 };
unsigned char code P2L[]={ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 };
int a,b,n,i,j,k,t;
unsigned char code ziku[]={ //字符码的存放格式为:从左到右共16列,并按列的上下部分依次存放
//一组即为一列
/* EL */
0x08,0x20, 0xF8,0x3F, 0x88,0x20, 0x88,0x20, 0xE8,0x23, 0x08,0x20, 0x10,0x18, 0x00,0x00,
0x08,0x20, 0xF8,0x3F, 0x08,0x20, 0x00,0x20, 0x00,0x20, 0x00,0x20, 0x00,0x30, 0x00,0x00,
/* Va */
0x08,0x00, 0x78,0x00, 0x88,0x07, 0x00,0x38, 0x00,0x0E, 0xC8,0x01, 0x38,0x00, 0x08,0x00,
0x00,0x00, 0x00,0x18, 0x80,0x24, 0x80,0x22, 0x80,0x22, 0x80,0x22, 0x00,0x3F, 0x00,0x20,
/* 秦 */
0x20,0x82, 0x20,0x82, 0x2A,0x45, 0x2A,0x45, 0xAA,0x25, 0x6A,0x15, 0x3E,0x0D, 0x2B,0xFF,
0xAA,0x04, 0xAA,0x0C, 0xEA,0x14, 0xAA,0x24, 0x2A,0x65, 0x22,0xC2, 0x20,0x42, 0x00,0x00,
};
void delay(int t)
{
for(t;t>0;t--);
}
void show()
{
for(n=0;n<384;n+=2) //共六个字
{
for(k=0;k<10;k++) //每个字显示的时间
{
for(i=0;i<4;i++) //4个字符区
{
for(j=0;j<8;j++) //8列
{
a=j+i*8+n;
b=j+i*8+n+32;
P2=P2H[i]+P2L[j]; //位选端
if(a>383)
P0=ziku[a-384];
else
P0=ziku[a];
if(b>383)
P1=ziku[b-384];
else
P1=ziku[b];
delay(10); //80~110
}
}
}
}
}
void main()
{
while(1)
{
show();
}
}