我的TFT汉字显示函数
/*-----------------------------------------------------------------------*/
/* LCD显示单个16X16中文汉字 */
/* (当前坐标处输出一个中文汉字,颜色为正文颜色) */
/*-----------------------------------------------------------------------*/
void LCD_PutChinese (unsigned char chinese_H, unsigned char chinese_L)
{
unsigned char i,j;
unsigned int chinese_Num,m,n;
chinese_Num = (unsigned int)(chinese_H - 0xA1)*94 + (unsigned int)(chinese_L - 0xA1); // 根据机内码计算汉字在字库中的序号
m = chinese_Num / 8; // 计算字模在字库中的扇区号(每扇区256字节)
n = ((chinese_Num % 8) << 5); // 计算字模在扇区中的开始位置
DF_MM_read_page(m,2); // 读取器件号为2的FALSH中的一扇区字模数据
for(i=0;i<32;i++) // 循环显示完1个中文字符32字节数据
{
for(j=8;j>0;j--)
{
if (buf[n+i] & BIT(j-1)) // 根据字模,是1的像素点用正文颜色填充
DrawPoint (Text_color_H,Text_color_L);
else
DrawPoint (Background_color_H,Background_color_L); // 根据字模,是0的像素点用背景颜色填充
}// for2 end
}// for1 end
}
|