OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4253|回复: 2

[战舰F103] 分享:战舰V3&精英板LCD字体显示增加调用1407字体

[复制链接]

57

主题

1680

帖子

3

精华

资深版主

Rank: 8Rank: 8

积分
4306
金钱
4306
注册时间
2018-6-30
在线时间
808 小时
发表于 2018-8-7 11:49:43 | 显示全部楼层 |阅读模式
本帖最后由 1208 于 2019-2-16 11:28 编辑

在原先字体大小 12/16/24上添加14的字体,
后面增加别的字体,也是用这种类似的方法就行了

[mw_shl_code=c,true]      

                LCD_ShowString(30,40,210,24,24,"Elite STM32F1 ^_^");
                LCD_ShowString(30,70,200,16,16,"TFTLCD TEST");
                LCD_ShowString(30,90,200,14,14,"ATOM@ALIENTEK");       //14的字体
                LCD_ShowString(30,110,200,16,16,lcd_id);                //显示LCD ID                                                      
                LCD_ShowString(30,130,200,12,12,"2015/1/14");        [/mw_shl_code][mw_shl_code=applescript,true]//在指定位置显示一个字符
//x,y:起始坐标
//num:要显示的字符:" "--->"~"
//size:字体大小 12/16/24
//mode:叠加方式(1)还是非叠加方式(0)
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode)
{                                                            
        u8 temp,t1,t;
        u16 y0=y;
        u8 csize=(size/8+((size%8)?1:0))    *   (size/2);                //得到字体一个字符对应点阵集所占的字节数        
         num=num-' ';//得到偏移后的值(ASCII字库是从空格开始取模,所以-' '就是对应字符的字库)
        for(t=0;t<csize;t++)
        {   
                if(size==12)temp=asc2_1206[num][t];                  //调用1206字体
                else if(size==14)temp=asc2_1407[num][t];        //调用1407字体
                else if(size==16)temp=asc2_1608[num][t];        //调用1608字体
                else if(size==24)temp=asc2_2412[num][t];        //调用2412字体
                else return;                                                                //没有的字库
                for(t1=0;t1<8;t1++)
                {                           
                        if(temp&0x80)LCD_Fast_DrawPoint(x,y,POINT_COLOR);
                        else if(mode==0)LCD_Fast_DrawPoint(x,y,BACK_COLOR);
                        temp<<=1;
                        y++;
                        if(y>=lcddev.height)return;                //超区域了
                        if((y-y0)==size)
                        {
                                y=y0;
                                x++;
                                if(x>=lcddev.width)return;        //超区域了
                                break;
                        }
                }           
        }                                            
}   

[/mw_shl_code]
在font.h添加1407字体ASCII,用的是PCtoLCD2002完美版软件

[mw_shl_code=applescript,true]const unsigned char asc2_1407[95][14]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xB0,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x10,0x00,0x20,0x00,0x50,0x00,0x20,0x00,0x40,0x00,0x00,0x00},/*""",2*/
{0x08,0x80,0x0B,0xF0,0x3C,0x80,0x08,0x80,0x0B,0xF0,0x3C,0x80,0x00,0x00},/*"#",3*/
{0x00,0x00,0x1C,0x60,0x22,0x10,0x7F,0xF8,0x21,0x10,0x18,0xE0,0x00,0x00},/*"$",4*/
{0x1E,0x00,0x21,0x30,0x1E,0xC0,0x0D,0xE0,0x32,0x10,0x01,0xE0,0x00,0x00},/*"%",5*/
{0x01,0xE0,0x1E,0x10,0x23,0x90,0x1C,0x60,0x03,0xD0,0x02,0x10,0x00,0x20},/*"&",6*/
{0x00,0x00,0x48,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xC0,0x30,0x30,0x40,0x08,0x00,0x00},/*"(",8*/
{0x00,0x00,0x40,0x08,0x30,0x30,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
{0x00,0x00,0x09,0x00,0x06,0x00,0x1F,0x80,0x06,0x00,0x09,0x00,0x00,0x00},/*"*",10*/
{0x01,0x00,0x01,0x00,0x01,0x00,0x0F,0xE0,0x01,0x00,0x01,0x00,0x01,0x00},/*"+",11*/
{0x00,0x00,0x00,0x24,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00},/*"-",13*/
{0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x00,0x00,0x08,0x00,0x70,0x01,0x80,0x06,0x00,0x38,0x00,0x40,0x00},/*"/",15*/
{0x0F,0xC0,0x10,0x20,0x20,0x10,0x20,0x10,0x10,0x20,0x0F,0xC0,0x00,0x00},/*"0",16*/
{0x00,0x00,0x10,0x10,0x10,0x10,0x3F,0xF0,0x00,0x10,0x00,0x10,0x00,0x00},/*"1",17*/
{0x00,0x00,0x18,0x30,0x20,0x50,0x20,0x90,0x23,0x10,0x1C,0x30,0x00,0x00},/*"2",18*/
{0x00,0x00,0x18,0x60,0x20,0x10,0x22,0x10,0x22,0x10,0x1D,0xE0,0x00,0x00},/*"3",19*/
{0x00,0x00,0x01,0x80,0x06,0x80,0x08,0x90,0x3F,0xF0,0x00,0x90,0x00,0x00},/*"4",20*/
{0x00,0x00,0x3E,0x60,0x24,0x10,0x24,0x10,0x24,0x10,0x23,0xE0,0x00,0x00},/*"5",21*/
{0x0F,0xC0,0x12,0x20,0x24,0x10,0x24,0x10,0x14,0x10,0x03,0xE0,0x00,0x00},/*"6",22*/
{0x00,0x00,0x30,0x00,0x20,0x00,0x21,0xF0,0x2E,0x00,0x30,0x00,0x00,0x00},/*"7",23*/
{0x1C,0xE0,0x23,0x10,0x22,0x10,0x22,0x10,0x23,0x10,0x1C,0xE0,0x00,0x00},/*"8",24*/
{0x1E,0x00,0x21,0x20,0x21,0x10,0x21,0x10,0x12,0x20,0x0F,0xC0,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x30,0x06,0x30,0x00,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x18,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x03,0x00,0x04,0x80,0x08,0x40,0x10,0x20,0x20,0x10,0x00,0x00},/*"<",28*/
{0x04,0x80,0x04,0x80,0x04,0x80,0x04,0x80,0x04,0x80,0x04,0x80,0x04,0x80},/*"=",29*/
{0x00,0x00,0x20,0x10,0x10,0x20,0x08,0x40,0x04,0x80,0x03,0x00,0x00,0x00},/*">",30*/
{0x00,0x00,0x0C,0x00,0x10,0x00,0x11,0xB0,0x12,0x30,0x0C,0x00,0x00,0x00},/*"?",31*/
{0x0F,0xC0,0x10,0x20,0x27,0x90,0x28,0x50,0x2F,0xD0,0x10,0x50,0x0F,0xA0},/*"@",32*/
{0x00,0x10,0x00,0x70,0x07,0x90,0x18,0x80,0x07,0x90,0x00,0x70,0x00,0x10},/*"A",33*/
{0x10,0x10,0x1F,0xF0,0x11,0x10,0x11,0x10,0x11,0x10,0x0E,0xE0,0x00,0x00},/*"B",34*/
{0x07,0xC0,0x08,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x1C,0x20,0x00,0x00},/*"C",35*/
{0x10,0x10,0x1F,0xF0,0x10,0x10,0x10,0x10,0x08,0x20,0x07,0xC0,0x00,0x00},/*"D",36*/
{0x10,0x10,0x1F,0xF0,0x11,0x10,0x11,0x10,0x13,0x90,0x18,0x30,0x00,0x00},/*"E",37*/
{0x10,0x10,0x1F,0xF0,0x11,0x10,0x11,0x00,0x13,0x80,0x10,0x00,0x08,0x00},/*"F",38*/
{0x07,0xC0,0x08,0x20,0x10,0x10,0x10,0x10,0x10,0x90,0x1C,0xE0,0x00,0x80},/*"G",39*/
{0x10,0x10,0x1F,0xF0,0x11,0x10,0x01,0x00,0x11,0x10,0x1F,0xF0,0x10,0x10},/*"H",40*/
{0x00,0x00,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,0x10,0x10,0x00,0x00},/*"I",41*/
{0x00,0x0C,0x10,0x04,0x10,0x04,0x1F,0xF8,0x10,0x00,0x10,0x00,0x00,0x00},/*"J",42*/
{0x10,0x10,0x1F,0xF0,0x11,0x10,0x03,0x00,0x14,0xD0,0x18,0x30,0x10,0x10},/*"K",43*/
{0x10,0x10,0x1F,0xF0,0x10,0x10,0x00,0x10,0x00,0x10,0x00,0x30,0x00,0x00},/*"L",44*/
{0x10,0x10,0x1F,0xF0,0x1E,0x00,0x01,0xF0,0x1E,0x00,0x1F,0xF0,0x10,0x10},/*"M",45*/
{0x10,0x10,0x1F,0xF0,0x1C,0x10,0x03,0x80,0x10,0x60,0x1F,0xF0,0x10,0x00},/*"N",46*/
{0x07,0xC0,0x08,0x20,0x10,0x10,0x10,0x10,0x08,0x20,0x07,0xC0,0x00,0x00},/*"O",47*/
{0x10,0x10,0x1F,0xF0,0x11,0x10,0x11,0x00,0x11,0x00,0x0E,0x00,0x00,0x00},/*"P",48*/
{0x07,0xC0,0x08,0x20,0x10,0x50,0x10,0x50,0x08,0x38,0x07,0xC8,0x00,0x00},/*"Q",49*/
{0x10,0x10,0x1F,0xF0,0x12,0x10,0x13,0x00,0x12,0xC0,0x0C,0x30,0x00,0x10},/*"R",50*/
{0x00,0x00,0x0C,0x30,0x12,0x10,0x11,0x10,0x11,0x10,0x18,0xE0,0x00,0x00},/*"S",51*/
{0x18,0x00,0x10,0x00,0x10,0x10,0x1F,0xF0,0x10,0x10,0x10,0x00,0x18,0x00},/*"T",52*/
{0x10,0x00,0x1F,0xE0,0x10,0x10,0x00,0x10,0x10,0x10,0x1F,0xE0,0x10,0x00},/*"U",53*/
{0x10,0x00,0x1C,0x00,0x13,0xC0,0x00,0x30,0x13,0xC0,0x1C,0x00,0x10,0x00},/*"V",54*/
{0x10,0x00,0x1F,0x80,0x00,0xF0,0x1F,0x00,0x00,0xF0,0x1F,0x80,0x10,0x00},/*"W",55*/
{0x10,0x10,0x18,0x30,0x16,0xD0,0x01,0x00,0x16,0xC0,0x18,0x30,0x10,0x10},/*"X",56*/
{0x10,0x00,0x18,0x00,0x16,0x10,0x01,0xF0,0x16,0x10,0x18,0x00,0x10,0x00},/*"Y",57*/
{0x08,0x10,0x10,0x70,0x11,0x90,0x12,0x10,0x1C,0x10,0x10,0x30,0x00,0x00},/*"Z",58*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xF8,0x40,0x08,0x40,0x08,0x00,0x00},/*"[",59*/
{0x00,0x00,0x20,0x00,0x1C,0x00,0x03,0x80,0x00,0x70,0x00,0x08,0x00,0x00},/*"\",60*/
{0x00,0x00,0x40,0x08,0x40,0x08,0x7F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x00,0x00,0x40,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x00,0x00},/*"^",62*/
{0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04},/*"_",63*/
{0x00,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x01,0x20,0x02,0x50,0x02,0x90,0x02,0x90,0x01,0xF0,0x00,0x10},/*"a",65*/
{0x20,0x00,0x3F,0xF0,0x02,0x10,0x02,0x10,0x02,0x10,0x01,0xE0,0x00,0x00},/*"b",66*/
{0x00,0x00,0x01,0xE0,0x02,0x10,0x02,0x10,0x02,0x10,0x03,0x20,0x00,0x00},/*"c",67*/
{0x00,0x00,0x01,0xE0,0x02,0x10,0x02,0x10,0x22,0x10,0x3F,0xF0,0x00,0x10},/*"d",68*/
{0x00,0x00,0x01,0xE0,0x02,0x90,0x02,0x90,0x02,0x90,0x01,0xA0,0x00,0x00},/*"e",69*/
{0x02,0x00,0x02,0x10,0x1F,0xF0,0x22,0x10,0x22,0x10,0x10,0x00,0x00,0x00},/*"f",70*/
{0x00,0x00,0x01,0xA8,0x02,0x54,0x02,0x54,0x03,0x94,0x02,0x08,0x00,0x00},/*"g",71*/
{0x20,0x10,0x3F,0xF0,0x01,0x10,0x02,0x00,0x02,0x10,0x01,0xF0,0x00,0x10},/*"h",72*/
{0x00,0x00,0x02,0x10,0x02,0x10,0x33,0xF0,0x00,0x10,0x00,0x10,0x00,0x00},/*"i",73*/
{0x00,0x00,0x00,0x04,0x02,0x04,0x02,0x04,0x33,0xF8,0x00,0x00,0x00,0x00},/*"j",74*/
{0x20,0x10,0x3F,0xF0,0x00,0x50,0x02,0xC0,0x03,0x30,0x02,0x10,0x00,0x00},/*"k",75*/
{0x00,0x00,0x20,0x10,0x20,0x10,0x3F,0xF0,0x00,0x10,0x00,0x10,0x00,0x00},/*"l",76*/
{0x02,0x10,0x03,0xF0,0x02,0x00,0x03,0xF0,0x02,0x00,0x01,0xF0,0x00,0x10},/*"m",77*/
{0x02,0x10,0x03,0xF0,0x01,0x10,0x02,0x00,0x02,0x10,0x01,0xF0,0x00,0x10},/*"n",78*/
{0x00,0x00,0x01,0xE0,0x02,0x10,0x02,0x10,0x02,0x10,0x01,0xE0,0x00,0x00},/*"o",79*/
{0x02,0x04,0x03,0xFC,0x02,0x14,0x02,0x10,0x02,0x10,0x01,0xE0,0x00,0x00},/*"p",80*/
{0x00,0x00,0x01,0xE0,0x02,0x10,0x02,0x10,0x02,0x14,0x03,0xFC,0x00,0x04},/*"q",81*/
{0x02,0x10,0x02,0x10,0x03,0xF0,0x01,0x10,0x02,0x10,0x02,0x00,0x00,0x00},/*"r",82*/
{0x00,0x00,0x01,0x30,0x02,0x90,0x02,0x90,0x02,0x50,0x03,0x20,0x00,0x00},/*"s",83*/
{0x00,0x00,0x02,0x00,0x02,0x00,0x0F,0xF0,0x02,0x10,0x02,0x10,0x00,0x00},/*"t",84*/
{0x02,0x00,0x03,0xE0,0x00,0x10,0x00,0x10,0x02,0x20,0x03,0xF0,0x00,0x10},/*"u",85*/
{0x02,0x00,0x03,0x00,0x02,0xC0,0x00,0x30,0x02,0xC0,0x03,0x00,0x02,0x00},/*"v",86*/
{0x02,0x00,0x03,0xC0,0x00,0x30,0x03,0xC0,0x00,0x30,0x03,0xC0,0x02,0x00},/*"w",87*/
{0x00,0x00,0x02,0x10,0x03,0x30,0x00,0xC0,0x03,0x30,0x02,0x10,0x00,0x00},/*"x",88*/
{0x02,0x04,0x03,0x04,0x02,0xC4,0x00,0x38,0x02,0xC0,0x03,0x00,0x02,0x00},/*"y",89*/
{0x00,0x00,0x03,0x10,0x02,0x30,0x02,0xD0,0x03,0x10,0x02,0x30,0x00,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x7E,0xF8,0x40,0x08,0x00,0x00},/*"{",91*/
{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
{0x00,0x00,0x40,0x08,0x7E,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x40,0x00,0x80,0x00,0x40,0x00,0x20,0x00,0x40,0x00,0x00,0x00},/*"~",94*/
};[/mw_shl_code]
取模.jpg
30.png

精英: TFTLCD显示实验增加1407的字体.zip

3.22 MB, 下载次数: 75

精英:TFTLCD显示1407字体实践.zip

3.22 MB, 下载次数: 47

业精于勤荒于嬉;行成于思毁于随!
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

1

主题

15

帖子

0

精华

新手上路

积分
46
金钱
46
注册时间
2015-2-7
在线时间
4 小时
发表于 2019-2-19 13:01:08 | 显示全部楼层
显示汉字的代码有没有?   要那种自已用软件生成,能显示的,不要那种把字库放在FALSH里的
回复 支持 反对

使用道具 举报

57

主题

1680

帖子

3

精华

资深版主

Rank: 8Rank: 8

积分
4306
金钱
4306
注册时间
2018-6-30
在线时间
808 小时
 楼主| 发表于 2019-2-19 17:52:22 | 显示全部楼层
mgfhappy 发表于 2019-2-19 13:01
显示汉字的代码有没有?   要那种自已用软件生成,能显示的,不要那种把字库放在FALSH里的

没有哈
业精于勤荒于嬉;行成于思毁于随!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-24 22:22

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表