求16*16LED点阵显示汉字程序

2024-12-16 03:56:07
推荐回答(1个)
回答1:

我也不怎么会,还在学习中
下面有一个16*16的C程序
参考一下。。。
字模软件你要的话我可以给你
共同学习。。。

#include
sbit P20=P2^0;

sbit P22=P2^2;

unsigned char code text[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x80,0x00,0x80,0xFC,0x80,0x05,0xFE,0x85,0x04,0x4A,0x48,0x28,0x40,0x10,0x40,
0x18,0x40,0x18,0x60,0x24,0xA0,0x24,0x90,0x41,0x18,0x86,0x0E,0x38,0x04,0x00,0x00,/*"欢",0*/

0x40,0x00,0x21,0x80,0x36,0x7C,0x24,0x44,0x04,0x44,0x04,0x44,0xE4,0x44,0x24,0x44,
0x25,0x44,0x26,0x54,0x24,0x48,0x20,0x40,0x20,0x40,0x50,0x00,0x8F,0xFE,0x00,0x00,/*"迎",1*/

0x01,0x00,0x21,0x10,0x19,0x18,0x0D,0x10,0x09,0x20,0x01,0x04,0x7F,0xFE,0x04,0x40,
0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x42,0x08,0x42,0x10,0x42,0x20,0x3E,0x40,0x00,/*"光",2*/

0x01,0x00,0x09,0x80,0x09,0x00,0x49,0xFE,0x4A,0x20,0x4A,0x10,0x4C,0x10,0x49,0x04,
0x49,0xFE,0x49,0x24,0x49,0x24,0x49,0x24,0x49,0x24,0x09,0xFC,0x09,0x04,0x00,0x00,/*"临",3*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

};
void Delay(unsigned char i)
{
unsigned char j;
for(;i>0;i--)
for(j=0;j<80;j++)
{;}
}

void main()
{
unsigned int a,e;
unsigned char b,c,d=0;
SCON=0;

while(1)
{
for(e=0;e<160;e=e+32)
{
for(a=0;a<8;a++)
{
for(b=0;b<8;b++)
{
for(c=0;c<32;c++)
{

SBUF=~(text[e+c+32]>>(8-a)|text[e+c+1]<
while(TI==0);
TI=0;
SBUF=~(text[e+c+1]>>(8-a)|text[e+c]<while(TI==0);
TI=0;
c++;
P20=1;
P1=d;
P22=0;
Delay(3);
P20=0;
P22=1;
d++;
if(d==16)d=0;
}
}
}
for(a=0;a<8;a++)
{
for(b=0;b<8;b++)
{
for(c=0;c<32;c++)
{

SBUF=~(text[e+c+1+32]>>(8-a)|text[e+c+32]<while(TI==0);
TI=0;
SBUF=~(text[e+c+32]>>(8-a)|text[e+c+1]<while(TI==0);
TI=0;
c++;
P20=1;
P1=d;
P22=0;
Delay(3);
P20=0;
P22=1;
d++;
if(d==16)d=0;
}
}
}

}
for(a=0;a<160;a=a+2)
{
for(b=0;b<8;b++)
{
for(c=1;c<32;c++)
{

if(a+c<160){
SBUF=~text[a+c];
while(TI==0);
TI=0;

SBUF=~text[a+c-1];
while(TI==0);
TI=0;}
else {
SBUF=~text[a+c-160];
while(TI==0);
TI=0;

SBUF=~text[a+c-1-160];
while(TI==0);
TI=0;}
P1=c/2;
c++;
P20=1;

P22=0;
Delay(3);
P22=1;
P20=0;
}
}

}

}
}