首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

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

2012-02-25 
12864lcd不带字库显示汉字问题请教???????请教一下就是本来想在一块12864不带字库的lcd上显示汉字,想把汉

12864lcd不带字库显示汉字问题请教???????
请教一下就是本来想在一块12864不带字库的lcd上显示汉字,想把汉字包括的常用字和生用字 使用的所用汉字问题都加入内存使用。在使用的时候再从字库之中找读出来,这个过程怎么来实现啊??一点头绪都没得。。。哪位指点下怎么加字库到内存,要显示汉字的时候又要怎么来操作。。能直接给个关键代码或者字库使用的demo吗?????头疼都一周了,这方面的资料不好找啊!!!

[解决办法]

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};//--------------------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();}
[解决办法]
楼主走错区了,去单片机那边问问,一般液晶屏会提供一块很小的自定义库的,你看看能不能利用上,不然就只能像操作点阵一样自己用程序动态扫描了。
[解决办法]
探讨
楼主走错区了,去单片机那边问问,一般液晶屏会提供一块很小的自定义库的,你看看能不能利用上,不然就只能像操作点阵一样自己用程序动态扫描了。

热点排行