【分享】OLED显示图片 程序,显示 汉字

2019-07-20 22:10发布

本帖最后由 zhouxufeng1996 于 2017-10-14 20:43 编辑

来论坛挺长时间了,分享一下刚研究出来的OLED显示图片的程序楼主用的战舰板子
OLED使用的四线SPI通信

77255A0942B15BB1A1A0E55474E0B197.jpg

取模是根据OLED那节教程里的软件取得。


程序里的oled.c也有显示24号和16号汉字的函数。


[mw_shl_code=c,true]//图片的OLED点阵,点阵库,是利用PCtoLCD2002生产的,
//软件设置的取模方式同OLED实验ASCII的取模方式一模一样,采用128*64大小,一个汉字点阵占用1KB。
const u8 OLED_HZK_TBLBMP[1][1024]=
{
       
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
        0x01,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0xFC,0x00,
        0x00,0x00,0x00,0x00,0x00,0xE1,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC2,0x00,0x00,0x00,0x00,
        0x00,0x01,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x06,
        0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x0D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2F,0xB8,0x00,0x00,0x00,0x00,0x00,0x01,0xEF,0xBB,0x80,
        0x00,0x00,0x04,0x00,0x03,0xF7,0x37,0x9F,0x80,0x00,0x04,0x00,0x07,0xF5,0x77,0xBF,0xFF,0xE0,0x04,
        0x00,0x1E,0xF5,0xEF,0x60,0x00,0x00,0x04,0x00,0x3D,0xF5,0xEF,0x7F,0xFF,0xF8,0x06,0x00,0x6F,0xF5,
        0xDE,0xFF,0xFF,0xF8,0x06,0x00,0x5F,0x7D,0xBD,0xFF,0xC0,0x00,0x03,0x00,0xD2,0xFF,0xFB,0xF0,0x07,
        0xE0,0x07,0x01,0xEB,0xFF,0xF7,0xBF,0xF8,0x00,0x0F,0x07,0xED,0x3F,0xEF,0xFE,0x00,0x00,0x0F,0x8E,
        0xED,0xFF,0xDF,0xC0,0x00,0x00,0x1F,0xDE,0xDD,0xFB,0xFE,0x00,0x00,0x00,0x1B,0xCA,0xDE,0x7B,0xF8,
        0x00,0x00,0x00,0x19,0xFE,0xE3,0xFB,0xF8,0x00,0x00,0x00,0x1D,0xFF,0xFC,0xEF,0xF8,0x00,0x00,0x00,
        0x19,0xFB,0x7F,0x9F,0xF0,0x00,0x00,0x00,0x1F,0xFF,0x3E,0x7F,0xE0,0x00,0x00,0x00,0x1F,0xFB,0x81,
        0xFD,0xE0,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFD,0xC0,0x00,0x00,0x00,0x0F,0xFB,0xFF,0xF3,0x80,0x00,
        0x00,0x00,0x0F,0xFF,0xFF,0xED,0x80,0x00,0x00,0x00,0x07,0xF3,0xFF,0xFB,0x00,0x00,0x00,0x00,0x07,
        0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x03,0xF7,0xFF,0xFA,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xF0,
        0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xE2,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xCC,0x00,0x00,0x00,
        0x00,0x00,0x01,0xFE,0x78,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0xF8,0x00,0x00,0x00,0x00,0x00,0x07,
        0xFF,0x8C,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}

};
//在指定位置,显示一个图片
//x,y :汉字的坐标
//fnum:汉字编号(在字库数组里面的编号)
//mode:0,反白显示;1,正常显示       
void OLED_ShowFontBMP(u8 x,u8 y,u8 fno,u8 mode)
{                  
    u16 temp,t,t1;
    u8 y0=y;                  
    for(t=0;t<1024;t++)
    {   
        temp=OLED_HZK_TBLBMP[fno][t];                                 
        for(t1=0;t1<8;t1++)
        {
            if(temp&0x80)OLED_DrawPoint(x,y,mode);
            else OLED_DrawPoint(x,y,!mode);
            temp<<=1;
            y++;
            if((y-y0)==64)
            {
                y=y0;
                x++;
                break;
            }
        }   
    }         
}

[/mw_shl_code]


OLED显示图片.zip (2.79 MB, 下载次数: 2271) 2017-10-14 20:39 上传 点击文件名下载附件
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
7条回答
cgy639
1楼-- · 2019-07-20 22:20
STM32VCT6使用FSMC驱动3.5寸TFT全视角IPS液晶屏
http://www.openedv.com/forum.php ... 9&fromuid=95471
(出处: OpenEdv-开源电子网)
八度空间
2楼-- · 2019-07-20 23:27
牛逼哄哄的
peng1554
3楼-- · 2019-07-21 02:03
 精彩回答 2  元偷偷看……
山峡
4楼-- · 2019-07-21 02:19
谢谢分享!
zhh912
5楼-- · 2019-07-21 03:46
这鸟真漂亮
zhouxufeng1996
6楼-- · 2019-07-21 09:02
cgy639 发表于 2018-6-6 10:13
STM32VCT6使用FSMC驱动3.5寸TFT全视角IPS液晶屏
http://www.openedv.com/forum.php?mod=viewthread&tid ...

贼6啊。

一周热门 更多>