48x96 English font modulo description

来自LCD wiki
跳转至: 导航搜索
  • 48x96英文字体取模说明
尺寸设置如下图所示:
Module-022.png
取模数据如下(点击打开):
48x96英文ASCII取模数据
函数定义如下:
/*参数说明*/
//x:显示的坐标点位置X;
//y:显示的坐标点位置Y;
//fc:前景色;
//bc:背景色;
//num:想要显示的字符,格式如字符A则输入:'A';
//mode:参数值0代表非叠加显示方式,参数1代表叠加显示方式;
void LCD_Show_9648_char(u16 x,u16 y,u16 fc, u16 bc, u8 num,u8 mode)
{
    u32 temp;
    u8 pos,t,i;
    u16 colortemp=POINT_COLOR;      		   
    num=num-' ';//得到偏移后的值
    LCD_SetWindows(x,y,x+48-1,y+96-1);//设置单个文字显示窗口
    if(!mode) //非叠加方式:字体带有背景色,显示时会将原来显示的内容覆盖掉
    {		
	for(pos=0;pos<96;pos++)
	{
	     for(i=0;i<2;i++)
	     {
		 temp = (asc2_9648[num][pos*6+i*3]<<16)|(asc2_9648[num][pos*6+i*3+1]<<8)|asc2_9648[num][pos*6+i*3+2];//调用9648字体,需要自己取模定义
	        for(t=0;t<24;t++)
	        {                 
		   if(temp&0x800000)
		   {
		      Lcd_WriteData_16Bit(fc);
		   }
		   else 
		   {
		      Lcd_WriteData_16Bit(bc); 
		   }
		   temp<<=1;
	        }	
	    }	
	}
    }
    else//叠加方式:字体不带背景色,直接叠加显示到原来显示的内容上
    {
        for(pos=0;pos<96;pos++)
	{
	    for(i=0;i<2;i++)
	    {
	        temp = (asc2_9648[num][pos*6+i*3]<<16)|(asc2_9648[num][pos*6+i*3+1]<<8)|asc2_9648[num][pos*6+i*3+2];//调用9648字体,需要自己取模定义
	        for(t=0;t<24;t++)
	        {   
		    POINT_COLOR=fc;              
		    if(temp&0x800000)
		    {
		        LCD_DrawPoint(x+i*24+t,y+pos);//画一个点    
		    }
		    temp<<=1;
	        }
	    }
	}
    }
    POINT_COLOR=colortemp;	
    LCD_SetWindows(0,0,lcddev.width-1,lcddev.height-1);//恢复窗口为全屏  
}