取模软件采用这种方式定义,
// ------------------ 汉字字模的数据结构定义 ------------------------ //
struct typFNT_GB16 // 汉字字模数据结构
{
int8_t Index[2]; // 汉字内码索引
uint8_t Msk[32]; // 点阵码数据
};
存取我们要显示的汉字字模
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[][16] = // 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[100]="汉字取模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[0])&&(temp2==GB_16.Index[1]))
{
for(j=0;j<32;j++)
{
DisplayZimo[wordnum][j]=GB_16.Msk[j];
}
wordnum++;
}
}
}
else //英文
{
temp2=*pData++;
temp1=temp1-32;
temp2=temp2-32;
for(j=0;j<16;j++)
{
jj=j<<1;
DisplayZimo[wordnum][jj]=AsciiDot[temp1][j];
DisplayZimo[wordnum][jj+1]=AsciiDot[temp2][j];
}
wordnum++;
}
}
}
然后调用读取字模函数进行相应字模的读取。要更新显示内容就对pString[100]进行更新;strcpy(pString,“新的显示内容12345”);
|