Gavin_GC 发表于 2011-12-2 15:32:26

少量点阵字模采用结构体存储,读取方式

取模软件采用这种方式定义,
// ------------------汉字字模的数据结构定义 ------------------------ //
struct typFNT_GB16               // 汉字字模数据结构
{
       int8_t Index;               // 汉字内码索引
       uint8_t Msk;                     // 点阵码数据
};
存取我们要显示的汉字字模
struct typFNT_GB16 code GB_16[] =          // 数据表
{
"汉", 0x00,0x00,0x40,0x08,0x37,0xFC,0x10,0x08,
      0x82,0x08,0x62,0x08,0x22,0x10,0x09,0x10,
      0x11,0x20,0x20,0xA0,0xE0,0x40,0x20,0xA0,
      0x21,0x10,0x22,0x08,0x24,0x0E,0x08,0x04,

"字", 0x02,0x00,0x01,0x00,0x3F,0xFC,0x20,0x04,
      0x40,0x08,0x1F,0xE0,0x00,0x40,0x00,0x80,
      0x01,0x04,0xFF,0xFE,0x01,0x00,0x01,0x00,
      0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00,

"取", 0x01,0x00,0xFF,0x80,0x22,0x00,0x23,0xFC,
      0x3E,0x04,0x22,0x84,0x22,0x88,0x3E,0x88,
      0x22,0x48,0x22,0x50,0x22,0x20,0x3E,0x50,
      0xE2,0x48,0x42,0x8E,0x03,0x04,0x02,0x00,

"模", 0x11,0x10,0x11,0x14,0x1F,0xFE,0x11,0x10,
      0xFD,0x18,0x13,0xFC,0x32,0x08,0x3B,0xF8,
      0x56,0x08,0x53,0xF8,0x90,0x40,0x1F,0xFE,
      0x10,0x40,0x10,0xB0,0x11,0x0E,0x16,0x04
};
//存取ascii码值
uint8_t const AsciiDot[] =            // ASCII
{
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// - -0
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

        0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,// -!- 1
        0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,

        0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,// -"- 2
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

        0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,// -#- 3
        0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00,

        0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,// -$-4
        0x86,0xC6,0x7C,0x18,0x18,0x00,0x00,0x00,
}这里省略其他的。
建立一个字符串存储我们要显示的内容 char pString="汉字取模ABCD";
void ReadZiku(char *pData)
{
        int8_t temp1=0,temp2=0;
        uint8_t i=0,j=0,jj=0,wordnum=0;
        while(*pData!='\0')       
        {
                temp1=*pData++;
                if(temp1&0x80) //中文
                {
                        temp2=*pData++;
                       for(i=0;i<ZIMO_SIZE;i++)
                       {
                               if((temp1==GB_16.Index)&&(temp2==GB_16.Index))
                                {
                                        for(j=0;j<32;j++)
                                        {
                                                DisplayZimo=GB_16.Msk;       
                                        }
                                        wordnum++;
                                }       
                       }
                }
                else //英文
                {
                        temp2=*pData++;
                        temp1=temp1-32;
                        temp2=temp2-32;
                        for(j=0;j<16;j++)
                        {
                                jj=j<<1;
                                DisplayZimo=AsciiDot;
                                DisplayZimo=AsciiDot;       
                        }
                        wordnum++;               
                }
        }
}
然后调用读取字模函数进行相应字模的读取。要更新显示内容就对pString进行更新;strcpy(pString,“新的显示内容12345”);

aaa8001 发表于 2012-11-12 23:12:27

mark         

javabean 发表于 2012-11-13 08:36:57

mark~~
板凳~

sunplus 发表于 2013-3-8 12:11:18

标记下标记下

bbglx 发表于 2013-10-7 14:44:43

mark 或许有用

信果 发表于 2014-3-2 23:28:15

mark,标记一下
页: [1]
查看完整版本: 少量点阵字模采用结构体存储,读取方式