1、选一个带汉字库的LED,直接写汉字内码就可以显示汉字了,应该最方便。
2、将国标汉字库转换成LED的汉子库,转换软件可以从供应商求取,也可以自己编一个小程序自己生成。从网上找也可以,很多很多。
#include"at89x51h"
unsigned char code led[]={0x10,0x04,0x10,0x03,0xD0,
0x00,0xFF,0xFF,0x90,0x00,
0x18,0x1D,0xF7,0x13,0x14,
0x11,0x54,0x15,0x94,0x19,
0x14,0x51,0x14,0x91,0xF6,
0x7F,0x04,0x11,0x00,0x01,
0x00,0x00,
0x04,0x04,0x04,0x02,0x04,
0x01,0xC4,0xFF,0x3F,0x00,
0x04,0x20,0x04,0x10,0x04,
0x08,0xE4,0x3F,0x04,0x42,
0x1F,0x41,0x84,0x40,0xC4,
0x40,0x06,0x40,0x04,0x70,
0x00,0x00};
unsigned char i=0,j=0,time_50ms=0;
delay();
main()
{
TMOD=0X01;
TH0=0X3C;
TL0=0XB0;
TR0=1;
ET0=1;
EA=1;
while(1)
{
P1=i;
P2=led[32j+2i];
P3=led[32j+2i+1];
delay();
i++;
if(i==16)
i=0;
if(time_50ms==20)
{
time_50ms=0;
j++;
if(j==2)
j=0;
}
}
}
int_T0() interrupt 1
{
TH0=0X3C;
TL0=0XB0;
time_50ms++;
}
delay()
{
unsigned char t1;
for(t1=0;t1<100;t1++);
}
你好!!
改了你的程序,还有一个警告,是来自你程序的嵌套了,你在优化一下吧;
代码发给你,主要是修改了fun函数的声明部分:
#include<reg52h>#define char unsigned char
#define int unsigned int
sbit f0=P1^0;
sbit f1=P1^1;
sbit f2=P1^2;
sbit f3=P1^3;
sbit f4=P1^4;
char key,keytmp();
char code distaba[]=
{0xfd,0xae,0xff,0xae,0xfd,0x06,0xff,0x40,
0xf5,0xb5,0xbf,0xb5,0xf5,0x8a,0x7f,0x2a,
0x20,0xe9,0x8e,0x8e,0xe9,0x22,0x7f,0xa0,
0x10,0x10,0xff,0x10,0x10,0x02,0x7f,0xa0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
char code scan_cona [8]=
{0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//列扫描控制字
void fun();
//按键扫描函数//
void keyscan()
{
if(f0==0)
{
while(1)
{
fun();
}
} }
//1ms延时子程序
void delay1ms(int t)
{
int i,j;
for(i=0;i<t;i++)
for(j=0;j<120;j++);
keyscan();
}
//向右滚动显示
void fun()
{
int m,n,h;
for(h=0;h<32;h++)//控制显示字数(32/8=4个)
{for(n=0;n<25;n++)//控制帧移动速度
{for(m=0;m<8;m++)//显示1帧扫描(分8行,每行亮1ms)
{P2=scan_cona[7-m];P0=distaba[m+h];delay1ms(1);}
}
}
}
//主程序
main()
{
P0=0XFF;
P1=0XFF;
P2=0XFF;
P3=0XFF;
while(1)
{ fun();}
}
我也不怎么会,还在学习中
下面有一个1616的C程序
参考一下。。。
字模软件你要的话我可以给你
共同学习。。。
#include<reg51h>
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]<<a);
while(TI==0);
TI=0;
SBUF=~(text[e+c+1]>>(8-a)|text[e+c]<<a);
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]<<a);
while(TI==0);
TI=0;
SBUF=~(text[e+c+32]>>(8-a)|text[e+c+1]<<a);
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;
}
}
}
}
}
以上就是关于本人想做一个51单片机的LED点阵显示,怎么从单片机调用所有汉字全部的内容,包括:本人想做一个51单片机的LED点阵显示,怎么从单片机调用所有汉字、用keil51单片机C语言编写程序,使液晶显示器显示16*16点阵汉字,请问怎么编写,谢谢!、8*8点阵LED显示汉字“课程设计”,程序出现三个警告,找不到问题所在,下面是我的程序,请指教,谢谢等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)