yjamdfhqjs 发表于 2021-6-15 20:57:35

初学LCD,换更大的英文字体字符显示函数需要更改哪些地方

这两天在驱动HJR买的一个2.0的320*240的屏,需要更改一下字体,但是按照新的码表写进去显示的一直不对

8*8英文字体ascii码示例:

0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,// -+-
0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,

之前的8*8字体显示一个字符函数:
void SPILCD_ShowChar(unsigned short x,unsigned short y,unsigned char num, unsigned int fColor, unsigned int bColor,unsigned char flag)
{      
        unsigned char temp;
        unsigned int pos,i,j;

        num=num-' ';//µÃµ½Æ«ÒƺóµÄÖµ
        i=num*16;        
        for(pos=0;pos<16;pos++)
        {
                temp=nAsciiDot;        //µ÷ͨµ÷ÓÃASCII×ÖÌå
                for(j=0;j<8;j++)
                {               
                        if(temp&0x80)
                        DrawPixel(x+j,y,fColor);
                        else
                        if(flag) DrawPixel(x+j,y,bColor); //Èç¹û±³¾°É«±êÖ¾flagΪ1
                        temp<<=1;
                }
                y++;
        }               
}

24*40英文字体ascii码示例:
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// -+-
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,
0x20,0x00,0x00,0x20,0x00,0x00,0x20,0x00,
0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x20,
0x00,0x00,0x20,0x00,0x3F,0xFF,0xE0,0x00,
0x20,0x00,0x00,0x20,0x00,0x00,0x20,0x00,
0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x20,
0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,
0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
页: [1]
查看完整版本: 初学LCD,换更大的英文字体字符显示函数需要更改哪些地方