******悬赏,谁能给我编制一个最简单的12864液晶屏显示两个汉字的程序,多谢了******

 我来答
呆猫一号
2008-08-21 · TA获得超过325个赞
知道小有建树答主
回答量:85
采纳率:0%
帮助的人:117万
展开全部
刚才回答了“12864液晶屏不同型号有什么区别”你也看看吧,会有用的
你问题没问清楚12864从编程上分有两种一是有字库二是没字库

给你个通用的的你自己改吧,用的是51,我仿真过绝对能用,用点阵模块改个数组就可以变成自己的了。兄弟只用5分你赚大了,你编译的时候用有能显示注释的keil,否则注释混在里面会出错

#include<reg51.h>

#define uint unsigned int
#define uchar unsigned char
#define LCDP P0

sbit E=P2^0;
sbit RW=P2^1;
sbit RS=P2^2;
sbit CS2=P2^3;
sbit CS1=P2^4;
sbit RESET=P2^5;
sbit busy=P0^7;

uchar start_line =0xc0;
//**********************************************************************************

uchar code zw[][32]={
/*-- 文字: ★ --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x40,0xC0,0xC0,0xC0,0xE0,0xFC,0xFF,0xFC,0xE0,0xC0,0xC0,0xC0,0x40,0x40,0x00,
0x00,0x00,0x40,0x39,0x3F,0x1F,0x1F,0x0F,0x1F,0x1F,0x3F,0x39,0x40,0x00,0x00,0x00,

/*-- 文字: 刘 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x08,0x28,0x49,0x8A,0x0C,0xC8,0x38,0x08,0x00,0xF8,0x00,0x00,0xFF,0x00,0x00,
0x40,0x20,0x10,0x08,0x04,0x03,0x06,0x38,0x10,0x00,0x07,0x20,0x40,0x3F,0x00,0x00,

/*-- 文字: 紫 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x20,0x3E,0x20,0x1F,0x94,0x54,0x24,0x80,0x9F,0x24,0x24,0x22,0x22,0x30,0x00,
0x00,0x40,0x24,0x1D,0x05,0x47,0x85,0x7D,0x04,0x04,0x14,0x26,0x4C,0x00,0x00,0x00,

/*-- 文字: 华 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x20,0x10,0x08,0xFC,0x03,0x02,0x10,0x10,0x7F,0x88,0x88,0x84,0x86,0xE4,0x00,0x00,
0x00,0x04,0x04,0x05,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,

/*-- 文字: ★ --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x40,0xC0,0xC0,0xC0,0xE0,0xFC,0xFF,0xFC,0xE0,0xC0,0xC0,0xC0,0x40,0x40,0x00,
0x00,0x00,0x40,0x39,0x3F,0x1F,0x1F,0x0F,0x1F,0x1F,0x3F,0x39,0x40,0x00,0x00,0x00,

/*-- 文字: 华 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x20,0x10,0x08,0xFC,0x03,0x02,0x10,0x10,0x7F,0x88,0x88,0x84,0x86,0xE4,0x00,0x00,
0x00,0x04,0x04,0x05,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,

/*-- 文字: 仔 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x40,0x30,0xFC,0x43,0x40,0x42,0x42,0x42,0xE2,0x52,0x4A,0x46,0x40,0x40,0x00,
0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,

/*-- 文字: ★ --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x40,0xC0,0xC0,0xC0,0xE0,0xFC,0xFF,0xFC,0xE0,0xC0,0xC0,0xC0,0x40,0x40,0x00,
0x00,0x00,0x40,0x39,0x3F,0x1F,0x1F,0x0F,0x1F,0x1F,0x3F,0x39,0x40,0x00,0x00,0x00
};

//*************************************882222222222222&****************************
/*-- 文字: 测 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
uchar code ce[][32]={0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00,
0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00,

/*-- 文字: 试 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,
0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00,

/*-- 文字: 成 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0xF8,0x48,0x48,0x48,0xC8,0x08,0xFF,0x08,0x09,0x0A,0xC8,0x88,0x08,0x00,
0x40,0x30,0x0F,0x00,0x08,0x50,0x4F,0x20,0x10,0x0B,0x0C,0x12,0x21,0x40,0xF0,0x00,

/*-- 文字: 功 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x04,0x04,0x04,0xFC,0x04,0x14,0x14,0x10,0x90,0x7F,0x10,0x10,0xF0,0x00,0x00,
0x04,0x0C,0x04,0x04,0x03,0x42,0x22,0x11,0x0C,0x23,0x20,0x60,0x20,0x1F,0x00,0x00,

/*-- 文字: 欢 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x14,0x24,0x44,0x84,0x64,0x1C,0x20,0x18,0x0F,0xE8,0x08,0x08,0x28,0x18,0x08,0x00,
0x20,0x10,0x4C,0x43,0x43,0x2C,0x20,0x10,0x0C,0x03,0x06,0x18,0x30,0x60,0x20,0x00,

/*-- 文字: 迎 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x41,0xCE,0x04,0x00,0xFC,0x04,0x02,0x02,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
0x40,0x20,0x1F,0x20,0x40,0x47,0x42,0x41,0x40,0x5F,0x40,0x42,0x44,0x43,0x40,0x00,

/*-- 文字: 使 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x20,0xF0,0x1C,0x07,0xF2,0x94,0x94,0x94,0xFF,0x94,0x94,0x94,0xF4,0x04,0x00,
0x00,0x00,0x7F,0x00,0x40,0x41,0x22,0x14,0x0C,0x13,0x10,0x30,0x20,0x61,0x20,0x00,

/*-- 文字: 用 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x00,0xFE,0x22,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,
0x80,0x40,0x30,0x0F,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x42,0x82,0x7F,0x00,0x00};

/*-- 调入了一幅图像:F:\我的文档\刘紫华的资料\资料\字模软件\液晶字模提取软件\图例\qian.psd.bmp --*/
/*-- 宽度x高度=128x32 --*/
uchar code img[]={
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,0x00,0x00,0xFC,0xFC,0xFC,0xF8,0xF8,0x78,0x78,0x78,0x78,0x78,0xF8,0xF8,0x78,
0x78,0x78,0x78,0x78,0x7C,0x7C,0x78,0x78,0x78,0x78,0xF8,0xF8,0x78,0x70,0x70,0x78,
0xF8,0xF8,0xF8,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0x78,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,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,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,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x3F,0x3F,0x3F,0x3F,0x1F,0x1F,0x1F,0x1F,0x1F,0x07,0x07,0x07,0x07,0x03,0x03,
0x03,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x03,0x03,
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,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,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 delay1ms(uint Xms)
{
uint i,j;
for(i=0;i<Xms;i++)
{for(j=0;j<120;j++);}
}

void check_BF()
{
RS=0; RW=1;
E=1;
LCDP=0xff;
while(!busy);
}

void write_cmd(uchar cmd)
{
check_BF();
E=1;
RS=0; RW=0;
LCDP=cmd;
E=1;
E=0;
}

void write_data(uchar dat)
{
check_BF();
E=1;
RS=1; RW=0;
LCDP=dat;
E=1;
E=0;
}

void lcdinit()
{
write_cmd(0x3f);
write_cmd(0xc0);
//write_cmd(0xb8);
//write_cmd(0x40);
}
*/
//************************************************
//测试段
//************************************************
void delay1ms(unsigned int Xms)
{
unsigned int i,j;
for(i=0;i<Xms;i++)
for(j=0;j<120;j++);
}

void check_BF()
{
E=1;
RS=0;RW=1;
P0=0xff;
while(!busy);
}

void write_cmd(unsigned char cmd)
{
check_BF();
E=1;
RS=0;RW=0;
P0=cmd;
E=1;
E=0;
}

void write_data(unsigned char dat)
{
check_BF();
E=1;
RS=1;RW=0;
P0=dat;
E=1;
E=0;
}

void lcdinit()
{
write_cmd(0xc0);
write_cmd(0x3f);
}
//************************************************
void display(uchar X,uchar Y, //uchar *P)
uchar (*P)[32])
{
uchar i,j;
CS2=0;CS1=1;
for(i=0;i<8;i++)
{if(i>=4)
{CS2=1;CS1=0;}
if(Y==0x80)
{Y=0x40;}
//write_cmd(0xC0);
write_cmd(X);
write_cmd(Y);
Y+=0x10;
for(j=0;j<16;j++)
{//write_data(P[i*32+j]);
write_data(*(*(P+i)+j));
}
}
CS2=0;CS1=1;Y=0x40;//X=0xb8;
for(i=0;i<8;i++)
{if(i>=4)
{CS2=1;CS1=0;}
if(Y==0x80)
{Y=0x40;}
//write_cmd(0xC0);
write_cmd(X+1);
write_cmd(Y);
Y+=0x10;
for(j=16;j<32;j++)
{//write_data(P[i*32+j]);
write_data(*(*(P+i)+j));
}
}
}
void display_img(uchar X, uchar Y,uchar code *P)
{
uchar i,j;
for(i=0;i<4;i++)
{CS2=0;CS1=1;
//write_cmd(0xc0);
write_cmd(X+i);
write_cmd(Y);
for(j=0;j<64;j++)
{write_data(P[i*128+j]);}
CS2=1;CS1=0;
//write_cmd(0xc0);
write_cmd(X+i);
write_cmd(Y);
for(j=64;j<128;j++)
{write_data(P[i*128+j]);}
}
}
void main()
{
RESET=0;
delay1ms(3);
RESET=1;
lcdinit();
while(1)
{
display(0xb8,0x40,zw);
write_cmd(0xC0);
delay1ms(2000);
display(0xba,0x40,ce);
delay1ms(2000);
display_img(0xbc,0x40,img);
delay1ms(5000);
}
}

5分我势在必得,有问题在找我吧我必定回答。

参考资料: 我自己原创,就连pdf都是自己做的

本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
丨Sart丨灬Me
2008-08-15
知道答主
回答量:43
采纳率:0%
帮助的人:0
展开全部
你那也叫“悬赏”?谁会帮你编?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式