12864lcd不带字库显示汉字问题请教???????

慢就是快o 2011-12-12 04:42:53
请教一下就是本来想在一块12864不带字库的lcd上显示汉字,想把汉字包括的常用字和生用字 使用的所用汉字问题都加入内存使用。在使用的时候再从字库之中找读出来,这个过程怎么来实现啊??一点头绪都没得。。。哪位指点下怎么加字库到内存,要显示汉字的时候又要怎么来操作。。能直接给个关键代码或者字库使用的demo吗?????头疼都一周了,这方面的资料不好找啊!!!
...全文
519 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
AnYidan 2011-12-14
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 wshjldaxiong 的回复:]
楼主走错区了,去单片机那边问问,一般液晶屏会提供一块很小的自定义库的,你看看能不能利用上,不然就只能像操作点阵一样自己用程序动态扫描了。
[/Quote]

++
小默 2011-12-14
  • 打赏
  • 举报
回复
楼主走错区了,去单片机那边问问,一般液晶屏会提供一块很小的自定义库的,你看看能不能利用上,不然就只能像操作点阵一样自己用程序动态扫描了。
慢就是快o 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zhao4zhong1 的回复:]

C/C++ code
#include <mem.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
const unsigned char bit[8]={128,64,32,16,8,4,2,1};
//-------------------------------------……
[/Quote]


愚钝啊
认识上进步了一点点。还是不懂啊。。。。。还去找找资料去。。。。。。
LST175 2011-12-12
  • 打赏
  • 举报
回复
很好,代码不错!
赵4老师 2011-12-12
  • 打赏
  • 举报
回复
#include <mem.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
const unsigned char bit[8]={128,64,32,16,8,4,2,1};
//--------------------------------------------------------
void dis(xoff,code)
unsigned int xoff,code;
{
unsigned char *buffer;
FILE *hzk;
unsigned long offset;
unsigned int q,w;
int x,y,width;

buffer=calloc(32,1);
if ((code&0xFF00)!=0) {
w=(code&0x00FF)-0xA1;
q=((code>>8)&0x00FF)-0xA1;
offset=q*0x5E+w;
offset*=32;
if ((hzk=fopen("HZK16","rb"))==NULL) {
closegraph();
printf("Can not open HZK16\r\n");
exit(1);
}
fseek(hzk,offset,SEEK_SET);
fread(buffer,1,32,hzk);
fclose(hzk);
width=2;
}
else {
if ((hzk=fopen("ASC16","rb"))==NULL) {
closegraph();
printf("Can not open ASC16\r\n");
exit(1);
}
offset=code*16;
fseek(hzk,offset,SEEK_SET);
fread(buffer,1,16,hzk);
fclose(hzk);
width=1;
}
for (y=0;y<16;y++) for (x=0;x<8*width;x++) {
if (buffer[y*width+x/8]&bit[x%8]) putpixel(xoff+x,y,15);
}
free(buffer);
}
//--------------------------------------------------------
void display(p)
unsigned char *p;
{

int i;
unsigned int qw;

i=0;
while (1) {
if (p[i]==0x0D||p[i]==0x1A) break;
if (p[i]>0xA0) {
qw=((unsigned int)p[i]<<8)|((unsigned int)p[i+1]&0x00FF);
dis(8*i,qw);
i+=2;
}
else {
qw=(unsigned int)p[i]&0x00FF;
dis(8*i,qw);
i++;
}
}

}
//--------------------------------------------------------
void main()
{
int gdriver = DETECT, gmode, errorcode;
long fl;
FILE *hz;
unsigned char *p;

initgraph(&gdriver, &gmode, "c:\\borlandc\\bgi");
errorcode = graphresult();
if (errorcode != grOk) {
printf("Graphics error: %s\n", grapherrormsg(errorcode));
exit(1);
}
hz=fopen("hz","rb");
fseek(hz,0,SEEK_END);
fl=ftell(hz);
p=calloc((int)fl,sizeof(unsigned char));
rewind(hz);
fread(p,1,(int)fl,hz);
fclose(hz);
display(p);
free(p);
getch();
closegraph();
}

其中HZK16和ASC16文件在UCDOS里面找。

69,381

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧