您好,原子哥,在用你的例程显示字体的时候没问题,但是我自己去摸显示0却有问题,取模软件为PC2LCD2002,设置按照你例程的要求设置的//PC2LCD2002取模方式设置:阴码+逐列式+顺向+C51格式,我只取了一个0的字母,点阵大小为32*32的,取得的数据如下:
const unsigned char asc2_3216[1][64]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x00,0x00,0x7F,0xFF,0x00,0x00,0xF0,0x07,0x80,0x01,0x80,0x00,0xC0,0x03,0x00,0x00,0x60,0x02,0x00,0x00,0x20,0x02,0x00,
0x00,0x20,0x02,0x00,0x00,0x20,0x03,0x00,0x00,0x60,0x01,0x80,0x00,0xC0,0x00,0xE0,0x03,0x80,0x00,0x7F,0xFF,0x00,0x00,0x0F,0xF8,0x00,0x00,0x00,0x00,0x00},/*"0",0*/};
显示的程序如下:LCD_ShowChar(60,300,0,32,0);(main函数调用的)
LCD_ShowChar的定义如下:
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode)
{
u8 temp,t1,t;
u16 y0=y;
u16 colortemp=POINT_COLOR;
u8 csize=(size/8+((size%8)?1:0))*(size/2); //得到字体一个字符对应点阵集所占的字节数
printf("\r\n The current size is %2d \r\n",size);
printf("\r\n The current size is %2d \r\n",csize);
//设置窗口
num=num-' ';//得到偏移后的值
if(!mode) //非叠加方式
{
for(t=0;t<csize;t++)
{
if(size==12)temp=asc2_1206[num][t]; //调用1206字体
else if(size==16)temp=asc2_1608[num][t]; //调用1608字体
else if(size==24)temp=asc2_2412[num][t]; //调用2412字体
else if(size==32)temp=asc2_3216[num][t]; //调用3216字体
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(x>=lcddev.width){POINT_COLOR=colortemp;return;}//超区域了
if((y-y0)==size)
{
y=y0;
x++;
if(x>=lcddev.width){POINT_COLOR=colortemp;return;}//超区域了
break;
}
}
}
}
请原子哥解惑,谢谢 |