#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,
/* 波 */
0x10,0x04, 0x60,0x04, 0x01,0xFF, 0x16,0x40, 0x00,0x30, 0xF8,0x8F, 0x88,0x80, 0x88,0x41,
0x88,0x26, 0xFF,0x18, 0x88,0x18, 0x88,0x26, 0x88,0x61, 0x18,0xC0, 0x08,0x40, 0x00,0x00,
/* , */
0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x80,
0x00,0xB0, 0x00,0x70, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
/* 自 */
0x00,0x00, 0x00,0x00, 0x00,0x00, 0xF8,0x7F, 0x48,0x24, 0x4C,0x24, 0x4A,0x24, 0x48,0x24,
0x48,0x24, 0x48,0x24, 0x48,0x24, 0xF8,0x7F, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
/* 动 */
0x00,0x00, 0x40,0x08, 0x48,0x1C, 0x48,0x0A, 0xC8,0x09, 0x48,0x08, 0x48,0x4E, 0x40,0x28,
0x20,0x10, 0x20,0x0C, 0xFE,0x03, 0x20,0x20, 0x20,0x40, 0xF0,0x3F, 0x20,0x00, 0x00,0x00,
/* 化 */
0x00,0x00, 0x00,0x01, 0x80,0x00, 0x40,0x00, 0xF0,0x7F, 0x0E,0x00, 0x00,0x04, 0x00,0x04,
0x00,0x02, 0xFE,0x3F, 0x80,0x40, 0x40,0x40, 0x20,0x40, 0x10,0x40, 0x00,0x78, 0x00,0x00,
/* 04 */
0x00,0x00, 0xE0,0x0f, 0x10,0x10, 0x08,0x20, 0x08,0x20, 0x10,0x10, 0xE0,0x0F, 0x00,0x00,
0x00,0x00, 0x00,0x07, 0xC0,0x04, 0x20,0x24, 0x10,0x24, 0xF8,0x3F, 0x00,0x24, 0x00,0x00,
/* 1 */
0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x10,0x20, 0x10,0x20, 0xF8,0x3F,
0x00,0x20, 0x00,0x20, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
/* 班 */
0x42,0x10, 0x42,0x10, 0xFE,0x0F, 0x42,0x88, 0x42,0x48, 0xE0,0x20, 0x00,0x18, 0xFF,0x07,
0x00,0x20, 0x42,0x20, 0x42,0x20, 0xFE,0x3F, 0x42,0x20, 0x42,0x20, 0x42,0x20, 0x00,0x00,
/* . */
0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
0x00,0x30, 0x00,0x30, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 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();
}
}
我可以做的
我做单片机的