标题: 求大神帮忙,这是一个汉字的显示程序,怎么能显示多个汉字? [打印本页]

作者: 尛╄→_峰    时间: 2013-10-18 10:54
标题: 求大神帮忙,这是一个汉字的显示程序,怎么能显示多个汉字?
/********************************************************************
* 名称 : PutGB1616()
* 功能 : 在x,y位置写16*16点阵的汉字
* 输入 : unsigned short x, unsigned short  y, unsigned char c[2], unsigned int fColor,unsigned int bColor
*             x列             y行               汉字字符                前景色            背景色
* 输出 : 无
***********************************************************************/
void LCD_PutGB1616(unsigned short x, unsigned short  y, unsigned char c[2], unsigned int fColor,unsigned int bColor)
{
    unsigned int i,j,k;
    LCD_SetArea(x,  x+16-1,y, y+16-1);
    for (k=0;k<110;k++)
    { //110表示自建汉字库中的个数,循环查询内码
        if ((codeGB_16[k].Index[0]==c[0])&&(codeGB_16[k].Index[1]==c[1]))
        {
            for(i=0;i<32;i++)
            {
                unsigned short m=codeGB_16[k].Msk[i];
                for(j=0;j<8;j++)
                {
                    if((m&0x80)==0x80)
                    {
                        LCD_Write_Data_U16(fColor);
                    }
                    else
                    {
                        LCD_Write_Data_U16(bColor);
                    }
                    m<<=1;
                }
            }
        }  
    }
}

以上是显示一个汉字的程序,可是我想显示多个汉字(如 LCD_PutGB1616_data(x,y,"多个汉字",fColor,bColor)),该怎么写这个LCD_PutGB1616_data()函数?

作者: admin    时间: 2013-10-18 13:13
什么屏幕?

作者: 尛╄→_峰    时间: 2013-10-18 15:43
admin 发表于 2013-10-18 13:13
什么屏幕?

宇顺lcd 220*176 ,单个汉字已经可以显示了,就是想写一个能显示多个汉字的函数,好方便调用。
作者: 尛╄→_峰    时间: 2013-10-22 15:09
自己已解决!!!!!
void LCD_PutGB1616_data(unsigned short x, unsigned short  y, unsigned char *hz, unsigned int fColor,unsigned int bColor)
{
        unsigned char c[2];
        unsigned char *p = hz;

        while(*p)
        {       
                memcpy(c,p,2);       
                LCD_PutGB1616(x,y,c,fColor,bColor);
                p = p+2;
                x = x+16;
        }         
}




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1