登录注册
论坛
一粒金砂(中级)
24
0
求助大佬,为什么加入的代码显示12、16的字体正常,但是显示24和32的字体时候,显示不全,只显示一半,这问题出在那一部分,求大佬解惑
代码如下:参照网上的改写的,加入24和32,字符只能显示出一半来,24和32字库完整。
//字符显示 void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint8_t size,uint8_t mode) { char temp,t1,t; uint16_t y0=y; uint16_t colortemp=POINT_COLOR; num=num-' '; if(!mode) { for(t=0;t<size;t++) { if(size==12) { temp=asc2_1206[num][t]; } else if(size==16) { temp=asc2_1608[num][t]; } else if(size==24) { temp=asc2_2412[num][t]; //调用2412字体 } else if(size==32) { temp=asc2_3216[num][t]; } // else return; //没有的字库 for(t1=0;t1<8;t1++) { if(temp&0x80) { POINT_COLOR=colortemp; } else { POINT_COLOR=BACK_COLOR; } LCD_DrawPoint(x,y); temp<<=1; y++; if(y>=lcddev.height) { POINT_COLOR=colortemp; return; } if((y-y0)==size) { y=y0; x++; if(x>=lcddev.width) { POINT_COLOR=colortemp; return; } break; } } } } else { for(t=0;t<size;t++) { if(size==12) { temp=asc2_1206[num][t]; } else if(size==16) { temp=asc2_1608[num][t]; } else if(size==24) { temp=asc2_2412[num][t]; //调用2412字体 } else if(size==32) { temp=asc2_3216[num][t]; } for(t1=0;t1<8;t1++) { if(temp&0x80) { LCD_DrawPoint(x,y); } temp<<=1; y++; if(y>=lcddev.height) { POINT_COLOR=colortemp; return; } if((y-y0)==size) { y=y0; x++; if(x>=lcddev.width) { POINT_COLOR=colortemp; return; } break; } } } } POINT_COLOR=colortemp; }
扫一扫,分享给好友
版主
7541
2
什么型号的屏幕?
纯净的硅(高级)
1088
我也遇到了,是Y方向的起点不对,调整以下初始化中Y的起始初值。同样的驱动芯片有的LCD不同,我2.5元淘了一个就发现这个问题。
纯净的硅(中级)
932
3
1206和1608点阵字体横向只有6点和8点,一个字节就可以覆盖,因此t1只要循环8次就能完整显示。而2412和3216点阵字体横向分别有12点和16点,需要的2个字节才能覆盖,你的程序只循环了前8个点,剩余的点阵并未写到屏幕上,当然只有左半个字了。
hujj 发表于 2024-6-8 09:51 1206和1608点阵字体横向只有6点和8点,一个字节就可以覆盖,因此t1只要循环8次就能完整显示。而2412和3216 ...
感谢大佬
发表回复 回帖后跳转到最后一页
EEWorld Datasheet 技术支持
查看 »