今天捣鼓OLED显示,遇到一个奇怪的问题。
我想不通,请大佬解惑。
显示汉字程序为:
//显示汉字
void OLED_ShowCHinese(uint8_t x, uint8_t y, uint8_t no)
{
uint8_t t,adder=0;
OLED_Set_Pos(x,y);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
adder+=1;
}
OLED_Set_Pos(x,y+1);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
adder+=1;
}
}
x,y为横纵坐标,no为第几个汉字。
主程序调用代码为:
OLED_ShowCHinese(16,0,0);//
后面一个0表示显示字库里的第一个汉字。
如果字库这样写:
const uint8_t Hzk[][32]={
// 华(0) 大(1) 半(2) 导(3) 体(4)
0x00,0x20,0x30,0xFC,0xFE,0x04,0x20,0x20,0xFC,0xFC,0x90,0x98,0x9C,0xE8,0x80,0x00,
0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x1F,0x1F,0x02,0x02,0x02,0x02,0x03,0x02,0x00,/*"华",0*/
0x00,0x20,0x20,0x20,0x20,0xE0,0xFE,0xFE,0xEE,0xE0,0x20,0x20,0x20,0x30,0x20,0x00,
0x00,0x10,0x18,0x1C,0x0E,0x07,0x03,0x00,0x00,0x03,0x07,0x0E,0x1C,0x1C,0x08,0x08,/*"大",1*/
则显示如下:
上面是半个华,下面是半个大。
如果字库这样写:
const uint8_t Hzk[][32]={
// 华(0) 大(1) 半(2) 导(3) 体(4)
{0x00,0x20,0x30,0xFC,0xFE,0x04,0x20,0x20,0xFC,0xFC,0x90,0x98,0x9C,0xE8,0x80,0x00},
{0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x1F,0x1F,0x02,0x02,0x02,0x02,0x03,0x02,0x00},/*"华",0*/
{0x00,0x20,0x20,0x20,0x20,0xE0,0xFE,0xFE,0xEE,0xE0,0x20,0x20,0x20,0x30,0x20,0x00},
{0x00,0x10,0x18,0x1C,0x0E,0x07,0x03,0x00,0x00,0x03,0x07,0x0E,0x1C,0x1C,0x08,0x08},/*"大",1*/
则显示正常:
请高手解释,谢谢
|