最近在STM32F407开发板上需要显示大号的字体,用SD更新太麻烦,只需要显示几个汉字即可,就是对汉字的大小有要求,调用了原子的OLED显示汉字的程序,显示小号的字体可以,但是显示大号的字体就不行了,求助各位大神
取模软件用的PCtoLCD2002,
12号,24号,32号,36号均可以正常显示,我调到50号就显示错误了。
下面是代码
void LCD_ShowChinese(u16 x,u16 y,u8 size,u8 cnum) //x,y为坐标,cnum显示字在字库的位置
{
u8 temp,t,t1;
u16 y0=y;
u8 *dzk;
u8 csize=(size/4+((size%4)?1:0))*(size/2);
dzk=(u8*)OLED_HZK_TBL[cnum];
for(t=0;t<csize;t++)
{
temp=dzk[t];
for(t1=0;t1<8;t1++)
{
if(temp&0x80)LCD_Fast_DrawPoint(x,y,POINT_COLOR);
else LCD_Fast_DrawPoint(x,y,BACK_COLOR);
temp<<=1;
y++;
if((y-y0)==size)
{
y=y0;
x++;
break;
}
}
}
}
字库如下:
const unsigned int OLED_HZK_TBL[4][326]=
{
{0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x06,0x00,0x01,0x00,0x03,0x00,0x00,0x04, //这个是50字体 “开”
0x00,0x01,0x00,0x03,0x00,0x00,0x08,0x00,0x01,0x00,0x03,0x00,0x00,0x18,0x00,0x01,0x00,0x03,0x00,0x00,0x30,0x00,0x01,0x00,
0x03,0x00,0x00,0x60,0x00,0x01,0x00,0x03,0x00,0x01,0xC0,0x00,0x01,0x00,0x03,0x00,0x03,0x80,0x00,0x01,0x00,0x03,0x00,0x0F,
0x00,0x00,0x01,0x00,0x03,0x00,0x3E,0x00,0x00,0x01,0x00,0x03,0x03,0xFC,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x01,
0xFF,0xFF,0xFF,0x80,0x00,0x00,0x01,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,
0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,
0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,
0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,
0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x01,0x00,
0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x00,
0x00,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x07,0x00,0x03,0x00,0x00,0x00,0x00,0x0F,0x00,0x03,0x00,0x00,0x00,0x00,0x0F,
0x00,0x07,0x00,0x00,0x00,0x00,0x07,0x00,0x0F,0x00,0x00,0x00,0x00,0x03,0x00,0x1F,0x00,0x00,0x00,0x00,0x01,0x00,0x0F,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x01,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,0x02,0x08,0x08,0x02,0x08,0x08,0x04,0x08,0x08,0x08,0x08,0x08,0x10,0x08,0x08,0xE0, //24号字体 “开”
0x0F,0xFF,0x80,0x08,0x08,0x00,0x08,0x08,0x00,0x08,0x08,0x00,0x08,0x08,0x00,0x08,0x08,0x00,0x08,0x08,0x00,0x0F,0xFF,0xFE,
0x0F,0xFF,0xFE,0x08,0x08,0x00,0x08,0x08,0x00,0x10,0x08,0x00,0x10,0x10,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x04,0x01,0x80,0x08,0x0F,0x00,0x10,0x1C,0x80,0x60,0x00,0x81,0xC2,0x00,0x87,0x02,
0x00,0xFC,0x02,0x1F,0xF0,0x04,0x3C,0x9C,0x08,0x20,0x92,0x08,0x00,0x91,0x90,0x00,0x90,0x70,0x00,0x90,0x60,0x20,0x91,0x90,
0x10,0x93,0x18,0x1C,0x9C,0x08,0x0C,0x98,0x0C,0x00,0x80,0x04,0x01,0x00,0x06,0x01,0x00,0x04,0x00,0x00,0x04,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x01,0x00,0x01,0x0E,0x00,0x01,0xF8,0x00,0x3F,0xFF,0xFE,0x21,0x20,0x00,0x01,0x10,0x02,
0x02,0x0C,0x0E,0x00,0x00,0x12,0x00,0x07,0xE4,0x0F,0xFE,0x04,0x08,0x40,0x08,0x08,0x78,0x10,0x08,0x47,0x30,0x08,0x41,0xE0,
0x10,0x41,0xE0,0x10,0x47,0x30,0x30,0x7C,0x18,0x30,0xE0,0x0C,0x10,0x00,0x0C,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00},
};
一周热门 更多>