在学习使用ssd1306OLED屏时,需要在上面显示英文字符或汉字,这就需要使用到字库。对照原子的库一一对应,最终搞明白了PCtoLCD2002完美版如何使用,以及字库生成的方法。
说明:
1. 因为我们的目的是在OLED上显示字符,所以生成的字符只是打印字符,即ASCII码表里从第32个“ ”(空格)开始,到“~”结束,共95个。
2. 生成的字符库和对应的ASCII码表相差32个位置,如“!”在ASCII中对应的十位数是33,而在生成的库对应的是1。
3. 如上,在调用生成的字符库时,需要偏移32个位置,一般用“所需显示的字符”-“ ”(注意是空格)表示生成库中的位置。如“!”-“ ”=33-32=1。
4. 原子的库是按照如下方式生成的(使用PCtoLCD2002):
取模方向:低位在前,高位在后,
取模方式:逐列式
取模说明:从第一列开始向下每取8个点作为一个字节,如果最后不足8个点就补满8位。取模顺序是从高到低,即第一个点作为最高位。如*-------取为10000000。 写点时,从上到下,从左到右的顺序。每列用8的整数倍的点数(如1列有12个点,则需要用2个字节,第一个字节从上到下依次点,第二个字节只需要前4位,其余位舍弃)。
下面举三个例子说明:
ASCII字符两个库:6*8和12*12,
中文字符库一个:12*12
ASCII:6*8:
如原子的库如下:
//常用ASCII表
//偏移量32
//ASCII字符集
//中文大小:12*8
//英文大小:6*8,需要6*8/8=6个字节
//字体:隶书
const unsigned char oled_asc2_0608[95][6]=
{
{0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x7A,0x00,0x00,0x00},/*"!",1*/
{0x00,0x20,0x40,0x20,0x40,0x00},/*""",2*/
{0x14,0x1E,0x3C,0x1E,0x34,0x14},/*"#",3*/
{0x36,0x2A,0x7F,0x2A,0x26,0x00},/*"$",4*/
{0x10,0x2A,0x14,0x1C,0x2A,0x04},/*"%",5*/
{0x06,0x3A,0x2E,0x34,0x1A,0x02},/*"&",6*/
{0x20,0x40,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x1C,0x22,0x41},/*"(",8*/
{0x00,0x41,0x22,0x1C,0x00,0x00},/*")",9*/
{0x18,0x18,0x3C,0x18,0x18,0x00},/*"*",10*/
{0x10,0x10,0x7C,0x10,0x10,0x00},/*"+",11*/
{0x01,0x02,0x00,0x00,0x00,0x00},/*",",12*/
{0x10,0x10,0x10,0x10,0x10,0x00},/*"-",13*/
{0x00,0x02,0x00,0x00,0x00,0x00},/*".",14*/
{0x01,0x06,0x08,0x30,0x40,0x00},/*"/",15*/
{0x1C,0x22,0x22,0x22,0x1C,0x00},/*"0",16*/
{0x00,0x12,0x3E,0x02,0x00,0x00},/*"1",17*/
{0x12,0x26,0x26,0x2A,0x32,0x00},/*"2",18*/
{0x14,0x22,0x2A,0x3A,0x24,0x00},/*"3",19*/
{0x08,0x14,0x24,0x3E,0x04,0x00},/*"4",20*/
{0x38,0x2A,0x2A,0x2A,0x2C,0x00},/*"5",21*/
{0x1C,0x2A,0x2A,0x2A,0x0C,0x00},/*"6",22*/
{0x30,0x20,0x2E,0x30,0x20,0x00},/*"7",23*/
{0x34,0x2A,0x2A,0x2A,0x36,0x00},/*"8",24*/
{0x18,0x2A,0x2A,0x2A,0x1C,0x00},/*"9",25*/
{0x00,0x00,0x12,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x13,0x00,0x00,0x00},/*";",27*/
{0x00,0x08,0x08,0x14,0x22,0x00},/*"<",28*/
{0x14,0x14,0x14,0x14,0x14,0x00},/*"=",29*/
{0x00,0x22,0x12,0x14,0x08,0x08},/*">",30*/
{0x20,0x40,0x4A,0x50,0x20,0x00},/*"?",31*/
{0x1C,0x22,0x2E,0x36,0x1C,0x00},/*"@",32*/
{0x02,0x0E,0x34,0x1C,0x06,0x02},/*"A",33*/
{0x22,0x3E,0x32,0x32,0x2C,0x00},/*"B",34*/
{0x1C,0x22,0x22,0x22,0x24,0x00},/*"C",35*/
{0x22,0x3E,0x22,0x22,0x1C,0x00},/*"D",36*/
{0x22,0x3E,0x32,0x3A,0x22,0x00},/*"E",37*/
{0x22,0x3E,0x32,0x38,0x20,0x00},/*"F",38*/
{0x1C,0x22,0x22,0x26,0x24,0x04},/*"G",39*/
{0x22,0x3E,0x08,0x08,0x3E,0x22},/*"H",40*/
{0x22,0x22,0x3E,0x22,0x22,0x00},/*"I",41*/
{0x01,0x21,0x21,0x3F,0x20,0x20},/*"J",42*/
{0x22,0x3E,0x3A,0x1E,0x26,0x22},/*"K",43*/
{0x22,0x3E,0x22,0x02,0x02,0x02},/*"L",44*/
{0x3E,0x38,0x0E,0x30,0x3E,0x00},/*"M",45*/
{0x22,0x3E,0x1A,0x24,0x3E,0x20},/*"N",46*/
{0x1C,0x22,0x22,0x22,0x1C,0x00},/*"O",47*/
{0x22,0x3E,0x2A,0x28,0x38,0x00},/*"P",48*/
{0x1C,0x26,0x26,0x23,0x1D,0x00},/*"Q",49*/
{0x22,0x3E,0x32,0x38,0x36,0x02},/*"R",50*/
{0x36,0x2A,0x2A,0x2A,0x26,0x00},/*"S",51*/
{0x20,0x22,0x3E,0x22,0x20,0x00},/*"T",52*/
{0x20,0x3E,0x02,0x02,0x3E,0x20},/*"U",53*/
{0x20,0x38,0x06,0x2C,0x30,0x20},/*"V",54*/
{0x30,0x0E,0x30,0x0E,0x30,0x00},/*"W",55*/
{0x36,0x2A,0x2A,0x2A,0x26,0x00},/*"S",56*/
{0x20,0x32,0x2E,0x32,0x20,0x00},/*"Y",57*/
{0x22,0x26,0x2E,0x32,0x22,0x00},/*"Z",58*/
{0x00,0x00,0x7F,0x41,0x41,0x00},/*"[",59*/
{0x00,0x60,0x18,0x04,0x02,0x00},/*"\",60*/
{0x00,0x41,0x41,0x7F,0x00,0x00},/*"]",61*/
{0x00,0x20,0x40,0x20,0x00,0x00},/*"^",62*/
{0x01,0x01,0x01,0x01,0x01,0x01},/*"_",63*/
{0x00,0x00,0x40,0x00,0x00,0x00},/*"`",64*/
{0x00,0x16,0x1A,0x1A,0x1E,0x02},/*"a",65*/
{0x20,0x3E,0x12,0x12,0x0C,0x00},/*"b",66*/
{0x00,0x0C,0x12,0x12,0x12,0x00},/*"c",67*/
{0x00,0x0C,0x12,0x32,0x3E,0x02},/*"d",68*/
{0x00,0x0C,0x1A,0x1A,0x0A,0x00},/*"e",69*/
{0x00,0x12,0x3E,0x32,0x32,0x20},/*"f",70*/
{0x00,0x1F,0x1B,0x1B,0x1B,0x13},/*"g",71*/
{0x22,0x3E,0x12,0x10,0x1E,0x02},/*"h",72*/
{0x00,0x12,0x3E,0x02,0x00,0x00},/*"i",73*/
{0x01,0x01,0x11,0x3E,0x00,0x00},/*"j",74*/
{0x22,0x3E,0x06,0x1C,0x12,0x12},/*"k",75*/
{0x22,0x22,0x7E,0x02,0x02,0x00},/*"l",76*/
{0x1E,0x10,0x1E,0x10,0x1E,0x00},/*"m",77*/
{0x12,0x1E,0x12,0x10,0x1E,0x02},/*"n",78*/
{0x00,0x0C,0x12,0x12,0x0C,0x00},/*"o",79*/
{0x11,0x1F,0x13,0x12,0x1C,0x00},/*"p",80*/
{0x00,0x0C,0x12,0x13,0x1F,0x01},/*"q",81*/
{0x12,0x1E,0x0A,0x10,0x10,0x00},/*"r",82*/
{0x00,0x1A,0x16,0x16,0x16,0x00},/*"s",83*/
{0x00,0x10,0x3E,0x12,0x02,0x00},/*"t",84*/
{0x10,0x1E,0x02,0x12,0x1E,0x02},/*"u",85*/
{0x10,0x18,0x16,0x04,0x18,0x10},/*"v",86*/
{0x18,0x06,0x18,0x0E,0x18,0x00},/*"w",87*/
{0x12,0x1E,0x0C,0x1E,0x12,0x00},/*"x",88*/
{0x11,0x19,0x16,0x0C,0x18,0x10},/*"y",89*/
{0x00,0x12,0x16,0x1A,0x12,0x00},/*"z",90*/
{0x00,0x00,0x08,0x7F,0x41,0x00},/*"{",91*/
{0x00,0x00,0x00,0xFF,0x00,0x00},/*"|",92*/
{0x00,0x41,0x7F,0x08,0x00,0x00},/*"}",93*/
{0x40,0x80,0x80,0x40,0x40,0x80},/*"~",94*/
};
每个字符的大小为6*8,6为列数,8为行数;如果按照逐列写点的方式,则每个字节可以表示1列的8位,可以用6个字节表示一个字符。
在PCtoLCD2002生成字库设置:
要生成6*8,隶书的ascii码,需要设置字体为隶书,设置字宽为12,高为8,这样设置对应到英文的大小才是6*8。
字模选项设置:
如图所示:按图中款选的几个参数设置
在下图中红色框填入需要生成字的字符,点击右侧的“生成字模”即可生成OLED显示对应的字符库。(可以一次性输入95个字符或者以文件的形式导入再生成)
验证:
如输入小写xyz,生成如下内容:
x(0) y(1) z(2)
{0x12,0x1E,0x0C,0x1E,0x12,0x00},/*"x",0*/
{0x11,0x19,0x16,0x0C,0x18,0x10},/*"y",1*/
{0x00,0x12,0x16,0x1A,0x12,0x00},/*"z",2*/
与下述原子的库作对比,结果一模一样。0,1,2和88,89,90指该字符在生成库的位置,如果按照95个ASCII的顺序生成,就可以生成和原子一样的。
ASCII:12*12:
疑问:如果按照6*8的数组取名0608,12*12应该取名1212才对,不知为何原子取名2412?
12*12生成方式与6*8的一致,下面说明为何每个字符需要24个字节表示。
上述6*8正好是6列8行,所以每列可以用一个字节,8位来表示,但是12列12行,每行不是8个整数倍,这里就需要多用一个字节的4位来表示,即每列需要两个字节,第一个字节8位+第二个字节4位,第二个字节的剩下4位舍弃。所以12*12需要24个字节表示一个字符。
原子库:
//24x12字体
//隶书
//中文大小:24*12
//英文大小:12*12,需要12*12/8=24(12不能被8整除,所以12需要两个字节,所以需要12*2=24个字节)
const unsigned char oled_asc2_2412[95][24]=
{
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x3F,0x40,0x38,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"!",1*/
{0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x60,0x00,0x50,0x00,0x10,0x00,0x20,0x00,0x60,0x00,0x40,0x00,0x00,0x00},/*""",2*/
{0x00,0x00,0x09,0x00,0x0B,0xC0,0x3D,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x0B,0xC0,0x3D,0x00,0x09,0x00,0x00,0x00},/*"#",3*/
{0x00,0x00,0x00,0x00,0x18,0x80,0x38,0xC0,0x24,0x40,0x24,0x40,0x7F,0xE0,0x22,0x40,0x33,0xC0,0x11,0x80,0x00,0x00,0x00,0x00},/*"$",4*/
{0x18,0x00,0x24,0x00,0x24,0x40,0x24,0x80,0x19,0x00,0x02,0x00,0x05,0x80,0x1A,0x40,0x32,0x40,0x02,0x40,0x01,0x80,0x00,0x00},/*"%",5*/
{0x01,0x80,0x03,0xC0,0x1A,0x40,0x26,0x40,0x27,0x40,0x39,0xC0,0x10,0x80,0x05,0x40,0x06,0x40,0x04,0x40,0x00,0x40,0x00,0x00},/*"&",6*/
{0x00,0x00,0x00,0x00,0x50,0x00,0x50,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x1F,0x80,0x10,0xC0,0x20,0x40,0x40,0x20,0x00,0x00,0x00,0x00},/*"(",8*/
{0x00,0x00,0x00,0x00,0x40,0x20,0x20,0x40,0x30,0xC0,0x1F,0x80,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*")",9*/
{0x00,0x00,0x09,0x00,0x09,0x00,0x06,0x00,0x06,0x00,0x02,0x80,0x1F,0x80,0x12,0x00,0x06,0x00,0x06,0x00,0x09,0x00,0x09,0x00},/*"*",10*/
{0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x50,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*",",12*/
{0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"-",13*/
{0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*".",14*/
{0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x00,0x00},/*"/",15*/
{0x00,0x00,0x0F,0x00,0x1F,0x80,0x30,0xC0,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0xC0,0x1F,0x80,0x0F,0x00,0x00,0x00},/*"0",16*/
{0x00,0x00,0x00,0x00,0x10,0x40,0x10,0x40,0x10,0x40,0x1F,0xC0,0x3F,0xC0,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00},/*"1",17*/
{0x00,0x00,0x18,0x40,0x18,0xC0,0x20,0xC0,0x21,0x40,0x21,0x40,0x22,0x40,0x34,0x40,0x3C,0x40,0x18,0xC0,0x00,0x00,0x00,0x00},/*"2",18*/
{0x00,0x00,0x10,0x80,0x30,0xC0,0x20,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x3A,0xC0,0x1B,0x80,0x01,0x80,0x00,0x00,0x00,0x00},/*"3",19*/
{0x00,0x00,0x02,0x00,0x02,0x00,0x05,0x00,0x09,0x00,0x11,0x00,0x11,0x40,0x3F,0xC0,0x3F,0xC0,0x01,0x40,0x00,0x00,0x00,0x00},/*"4",20*/
{0x00,0x00,0x00,0x80,0x3C,0xC0,0x22,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x24,0xC0,0x27,0x80,0x23,0x80,0x00,0x00,0x00,0x00},/*"5",21*/
{0x00,0x00,0x0F,0x00,0x1F,0x80,0x12,0xC0,0x24,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x34,0x40,0x17,0x80,0x03,0x80,0x00,0x00},/*"6",22*/
{0x00,0x00,0x00,0x00,0x30,0x00,0x20,0x00,0x20,0x00,0x20,0xC0,0x23,0xC0,0x24,0x00,0x28,0x00,0x30,0x00,0x20,0x00,0x00,0x00},/*"7",23*/
{0x00,0x00,0x19,0x80,0x3B,0x80,0x26,0xC0,0x24,0x40,0x24,0x40,0x24,0x40,0x26,0x40,0x36,0x40,0x3B,0x80,0x19,0x80,0x00,0x00},/*"8",24*/
{0x00,0x00,0x1C,0x00,0x1E,0x80,0x36,0xC0,0x22,0x40,0x22,0x40,0x22,0x40,0x22,0xC0,0x35,0x80,0x1F,0x80,0x0F,0x00,0x00,0x00},/*"9",25*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x08,0x40,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*":",26*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x60,0x04,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*";",27*/
{0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x0A,0x00,0x09,0x00,0x11,0x00,0x10,0x80,0x20,0x80,0x40,0x40,0x40,0x40,0x00,0x00},/*"<",28*/
{0x00,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x00,0x00},/*"=",29*/
{0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x20,0x80,0x10,0x80,0x11,0x00,0x09,0x00,0x0A,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*">",30*/
{0x00,0x00,0x18,0x00,0x18,0x00,0x20,0x00,0x20,0x40,0x23,0x40,0x22,0x40,0x22,0x00,0x34,0x00,0x1C,0x00,0x18,0x00,0x00,0x00},/*"?",31*/
{0x00,0x00,0x0F,0x00,0x1F,0x80,0x10,0x80,0x33,0xC0,0x25,0x40,0x29,0x40,0x2B,0x40,0x2F,0x40,0x29,0x40,0x11,0x40,0x0E,0x00},/*"@",32*/
{0x00,0x40,0x00,0xC0,0x01,0xC0,0x07,0x40,0x19,0x00,0x31,0x00,0x39,0x00,0x1F,0x40,0x07,0xC0,0x01,0xC0,0x00,0x40,0x00,0x40},/*"A",33*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x24,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x3A,0xC0,0x1B,0x80,0x01,0x80,0x00,0x00},/*"B",34*/
{0x00,0x00,0x0F,0x00,0x1F,0x80,0x10,0xC0,0x30,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0x80,0x00,0x00},/*"C",35*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x10,0x80,0x1F,0x80,0x0F,0x00,0x00,0x00},/*"D",36*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x24,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x2E,0x40,0x20,0x40,0x20,0x40,0x10,0x80,0x00,0x00},/*"E",37*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x24,0x40,0x24,0x00,0x24,0x00,0x24,0x00,0x2E,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x00,0x00},/*"F",38*/
{0x00,0x00,0x0F,0x00,0x1F,0x80,0x10,0x80,0x10,0x40,0x20,0x40,0x22,0x40,0x22,0x40,0x23,0x80,0x33,0x80,0x02,0x00,0x02,0x00},/*"G",39*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x24,0x40,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x24,0x40,0x3F,0xC0,0x3F,0xC0,0x20,0x40},/*"H",40*/
{0x00,0x00,0x00,0x00,0x20,0x40,0x20,0x40,0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x20,0x40,0x20,0x40,0x20,0x40,0x00,0x00,0x00,0x00},/*"I",41*/
{0x00,0x00,0x00,0x40,0x00,0x60,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x3F,0xC0,0x20,0x00,0x20,0x00,0x20,0x00},/*"J",42*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x24,0x40,0x04,0x00,0x0C,0x00,0x0A,0x00,0x29,0x00,0x30,0xC0,0x20,0xC0,0x20,0x40,0x00,0x40},/*"K",43*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x20,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x80,0x00,0x00},/*"L",44*/
{0x20,0x40,0x3F,0xC0,0x38,0x40,0x3E,0x00,0x0F,0x80,0x03,0xC0,0x03,0x00,0x0C,0x00,0x30,0x40,0x3F,0xC0,0x3F,0xC0,0x20,0x40},/*"M",45*/
{0x20,0x40,0x3F,0xC0,0x30,0x40,0x18,0x00,0x08,0x00,0x04,0x00,0x06,0x00,0x03,0x00,0x01,0x00,0x21,0x80,0x3F,0xC0,0x20,0x00},/*"N",46*/
{0x00,0x00,0x0F,0x00,0x1F,0x80,0x30,0xC0,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0xC0,0x1F,0x80,0x0F,0x00,0x00,0x00},/*"O",47*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x24,0x40,0x24,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x3C,0x00,0x18,0x00,0x00,0x00},/*"P",48*/
{0x00,0x00,0x0F,0x00,0x1F,0x80,0x30,0xC0,0x21,0x40,0x21,0x40,0x21,0x40,0x20,0xC0,0x30,0xA0,0x1F,0xA0,0x0F,0x20,0x00,0x00},/*"Q",49*/
{0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x24,0x40,0x24,0x00,0x24,0x00,0x26,0x00,0x27,0x00,0x25,0x80,0x38,0xC0,0x18,0x40,0x00,0x40},/*"R",50*/
{0x00,0x00,0x18,0xC0,0x18,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x24,0x40,0x26,0x40,0x22,0xC0,0x23,0x80,0x31,0x80,0x00,0x00},/*"S",51*/
{0x10,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x20,0x40,0x20,0x00,0x20,0x00,0x20,0x00,0x10,0x00},/*"T",52*/
{0x20,0x00,0x3F,0x80,0x3F,0xC0,0x20,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x20,0xC0,0x3F,0x80,0x20,0x00},/*"U",53*/
{0x20,0x00,0x20,0x00,0x38,0x00,0x3E,0x00,0x27,0x80,0x01,0xC0,0x00,0xC0,0x01,0x80,0x26,0x00,0x38,0x00,0x20,0x00,0x20,0x00},/*"V",54*/
{0x20,0x00,0x38,0x00,0x3F,0x00,0x27,0xC0,0x01,0x80,0x33,0x00,0x3F,0x00,0x27,0xC0,0x03,0x80,0x2C,0x00,0x30,0x00,0x20,0x00},/*"W",55*/
{0x00,0x00,0x20,0x40,0x20,0x40,0x30,0xC0,0x39,0x40,0x0E,0x00,0x06,0x00,0x2B,0x00,0x31,0x40,0x20,0xC0,0x20,0x40,0x00,0x00},/*"X",56*/
{0x20,0x00,0x20,0x00,0x30,0x00,0x28,0x40,0x04,0x40,0x03,0xC0,0x03,0xC0,0x24,0x40,0x28,0x40,0x30,0x00,0x20,0x00,0x20,0x00},/*"Y",57*/
{0x00,0x00,0x10,0x00,0x30,0x40,0x20,0xC0,0x21,0x40,0x22,0x40,0x24,0x40,0x28,0x40,0x30,0x40,0x20,0x40,0x00,0x80,0x00,0x00},/*"Z",58*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xE0,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x00,0x00},/*"[",59*/
{0x00,0x00,0x00,0x00,0x40,0x00,0x20,0x00,0x18,0x00,0x04,0x00,0x02,0x00,0x01,0x00,0x00,0xC0,0x00,0x20,0x00,0x00,0x00,0x00},/*"\",60*/
{0x00,0x00,0x00,0x00,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x7F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"]",61*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
{0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10},/*"_",63*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
{0x00,0x00,0x00,0x80,0x02,0xC0,0x07,0x40,0x05,0x40,0x05,0x40,0x05,0x40,0x05,0x40,0x07,0xC0,0x03,0xC0,0x00,0x40,0x00,0x40},/*"a",65*/
{0x00,0x00,0x20,0x00,0x3F,0xC0,0x3F,0xC0,0x02,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x07,0x80,0x03,0x80,0x00,0x00},/*"b",66*/
{0x00,0x00,0x03,0x80,0x03,0x80,0x06,0xC0,0x04,0x40,0x04,0x40,0x04,0x40,0x06,0x40,0x02,0x40,0x00,0x80,0x00,0x00,0x00,0x00},/*"c",67*/
{0x00,0x00,0x03,0x80,0x03,0xC0,0x06,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x24,0x40,0x3F,0xC0,0x3F,0xC0,0x00,0x40,0x00,0x00},/*"d",68*/
{0x00,0x00,0x00,0x00,0x03,0x80,0x03,0x80,0x05,0x40,0x05,0x40,0x05,0x40,0x05,0x40,0x05,0x40,0x03,0x40,0x03,0x00,0x00,0x00},/*"e",69*/
{0x00,0x00,0x04,0x00,0x04,0x40,0x04,0x40,0x1F,0xC0,0x3F,0xC0,0x24,0x40,0x24,0x40,0x24,0x40,0x24,0x00,0x20,0x00,0x00,0x00},/*"f",70*/
{0x00,0x00,0x00,0x20,0x02,0xF0,0x03,0xD0,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x07,0x50,0x06,0x30,0x04,0x20,0x04,0x00},/*"g",71*/
{0x00,0x00,0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x02,0x40,0x04,0x00,0x04,0x00,0x04,0x40,0x07,0xC0,0x03,0xC0,0x00,0x40,0x00,0x00},/*"h",72*/
{0x00,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x27,0xC0,0x27,0xC0,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00},/*"i",73*/
{0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x27,0xF0,0x27,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},/*"j",74*/
{0x00,0x00,0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x01,0x40,0x01,0x00,0x07,0x00,0x06,0xC0,0x04,0x40,0x04,0x40,0x00,0x40,0x00,0x00},/*"k",75*/
{0x00,0x00,0x00,0x00,0x20,0x40,0x20,0x40,0x20,0x40,0x3F,0xC0,0x3F,0xC0,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00},/*"l",76*/
{0x04,0x40,0x07,0xC0,0x07,0xC0,0x04,0x40,0x04,0x00,0x07,0xC0,0x07,0xC0,0x04,0x40,0x04,0x00,0x07,0xC0,0x07,0xC0,0x00,0x40},/*"m",77*/
{0x00,0x00,0x04,0x40,0x07,0xC0,0x07,0xC0,0x02,0x40,0x04,0x00,0x04,0x00,0x04,0x40,0x03,0xC0,0x03,0xC0,0x00,0x40,0x00,0x00},/*"n",78*/
{0x00,0x00,0x03,0x80,0x03,0x80,0x06,0xC0,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x06,0xC0,0x03,0x80,0x03,0x80,0x00,0x00},/*"o",79*/
{0x00,0x00,0x04,0x10,0x07,0xF0,0x07,0xF0,0x02,0x50,0x04,0x50,0x04,0x40,0x04,0x40,0x04,0xC0,0x07,0x80,0x03,0x80,0x00,0x00},/*"p",80*/
{0x00,0x00,0x03,0x80,0x03,0xC0,0x06,0x40,0x04,0x40,0x04,0x40,0x04,0x50,0x04,0x50,0x07,0xF0,0x07,0xF0,0x00,0x10,0x00,0x00},/*"q",81*/
{0x04,0x40,0x04,0x40,0x04,0x40,0x07,0xC0,0x07,0xC0,0x02,0x40,0x02,0x40,0x04,0x40,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"r",82*/
{0x00,0x00,0x00,0x00,0x02,0xC0,0x06,0x40,0x05,0x40,0x05,0x40,0x05,0x40,0x05,0x40,0x05,0x40,0x04,0xC0,0x04,0x80,0x00,0x00},/*"s",83*/
{0x00,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x0F,0x80,0x1F,0x80,0x04,0x40,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x00,0x00,0x00},/*"t",84*/
{0x00,0x00,0x04,0x00,0x07,0x80,0x07,0xC0,0x00,0x40,0x00,0x40,0x00,0x40,0x04,0x40,0x07,0xC0,0x07,0xC0,0x00,0x40,0x00,0x00},/*"u",85*/
{0x00,0x00,0x04,0x00,0x04,0x00,0x06,0x00,0x05,0x00,0x00,0x80,0x00,0x40,0x00,0x80,0x05,0x00,0x06,0x00,0x04,0x00,0x04,0x00},/*"v",86*/
{0x04,0x00,0x06,0x00,0x07,0x80,0x05,0xC0,0x00,0xC0,0x05,0x80,0x07,0x00,0x07,0x80,0x05,0xC0,0x01,0x80,0x07,0x00,0x04,0x00},/*"w",87*/
{0x00,0x00,0x04,0x40,0x04,0x40,0x06,0xC0,0x06,0xC0,0x07,0x40,0x05,0x40,0x06,0xC0,0x06,0xC0,0x04,0x40,0x04,0x40,0x00,0x00},/*"x",88*/
{0x00,0x00,0x04,0x00,0x04,0x10,0x07,0x10,0x05,0x90,0x00,0xE0,0x00,0xC0,0x05,0x80,0x06,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"y",89*/
{0x00,0x00,0x00,0x00,0x06,0x40,0x04,0xC0,0x04,0xC0,0x05,0x40,0x07,0x40,0x06,0x40,0x04,0x40,0x04,0x40,0x00,0xC0,0x00,0x00},/*"z",90*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x7B,0xC0,0x40,0x20,0x40,0x20,0x00,0x00,0x00,0x00},/*"{",91*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"|",92*/
{0x00,0x00,0x00,0x00,0x40,0x20,0x40,0x20,0x7B,0xC0,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"}",93*/
{0x00,0x00,0x40,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xC0,0x00,0x40,0x00,0x60,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x40,0x00},/*"~",94*/
};
使用PCtoLCD生成如下:
x(0) y(1) z(2)
{0x00,0x00,0x04,0x40,0x04,0x40,0x06,0xC0},
{0x06,0xC0,0x07,0x40,0x05,0x40,0x06,0xC0},
{0x06,0xC0,0x04,0x40,0x04,0x40,0x00,0x00},/*"x",0*/
{0x00,0x00,0x04,0x00,0x04,0x10,0x07,0x10},
{0x05,0x90,0x00,0xE0,0x00,0xC0,0x05,0x80},
{0x06,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"y",1*/
{0x00,0x00,0x00,0x00,0x06,0x40,0x04,0xC0},
{0x04,0xC0,0x05,0x40,0x07,0x40,0x06,0x40},
{0x04,0x40,0x04,0x40,0x00,0xC0,0x00,0x00},/*"z",2*/
原子的库如下:
{0x00,0x00,0x04,0x40,0x04,0x40,0x06,0xC0,0x06,0xC0,0x07,0x40,0x05,0x40,0x06,0xC0,0x06,0xC0,0x04,0x40,0x04,0x40,0x00,0x00},/*"x",88*/
{0x00,0x00,0x04,0x00,0x04,0x10,0x07,0x10,0x05,0x90,0x00,0xE0,0x00,0xC0,0x05,0x80,0x06,0x00,0x04,0x00,0x04,0x00,0x00,0x00},/*"y",89*/
{0x00,0x00,0x00,0x00,0x06,0x40,0x04,0xC0,0x04,0xC0,0x05,0x40,0x07,0x40,0x06,0x40,0x04,0x40,0x04,0x40,0x00,0xC0,0x00,0x00},/*"z",90*/
中文:12*12
中文字符生设置成也基本一样,不同在于选择字宽时,不需要乘以2,字宽12,高12,宋体即可。
原子库(中文太多,指列前几个汉字0.0):
//宋体
//中文大小:12*12,需要12*12/8=24个字节
const unsigned char oled_hzlib1212[6763][24]={
{0x7F,0xC0,0x40,0x80,0x7F,0xC0,0x00,0x00,0x7F,0xF0,0x4C,0x40,0x73,0x80,0x1F,0x00,0x51,0x10,0x7F,0xF0,0x40,0x00,0x00,0x00},/*"啊",0*/
{0x7F,0xF0,0x40,0x40,0x4C,0x40,0x73,0x80,0x00,0x00,0x4F,0xC0,0x48,0x80,0x4F,0x90,0x40,0x10,0x7F,0xF0,0x40,0x00,0x00,0x00},/*"阿",1*/
{0x08,0x20,0x08,0x20,0xFF,0xC0,0x08,0x40,0x12,0x90,0x3C,0xA0,0x54,0xC0,0x97,0x80,0x14,0xC0,0x34,0xA0,0x18,0x90,0x00,0x00},/*"埃",2*/
{0x11,0x10,0xFF,0xF0,0x12,0x00,0x00,0x10,0x12,0x90,0x3C,0xA0,0x54,0xC0,0x97,0x80,0x14,0xC0,0x34,0xA0,0x18,0x90,0x00,0x00},/*"挨",3*/
{0x7F,0xC0,0x40,0x80,0x7F,0xD0,0x20,0x10,0xF6,0x20,0x21,0x40,0x20,0x80,0x21,0x40,0xF6,0x20,0x20,0x10,0x20,0x10,0x00,0x00},/*"哎",4*/
{0x7F,0xC0,0x40,0x80,0x7F,0xC0,0x00,0x10,0x12,0x90,0x3C,0xA0,0x54,0xC0,0x97,0x80,0x14,0xC0,0x34,0xA0,0x18,0x90,0x00,0x00},/*"唉",5*/
{0x20,0x20,0x2E,0x20,0x2A,0x40,0x2A,0xF0,0xAB,0x10,0x6B,0x20,0x2A,0x80,0x2A,0x40,0x2A,0x20,0x2E,0x50,0x20,0x90,0x00,0x00},/*"哀",6*/
{0x3F,0xF0,0x62,0x20,0xA2,0x20,0x3F,0xF0,0x00,0x00,0x74,0xE0,0x14,0x90,0xF4,0x90,0x14,0x90,0x77,0x90,0x00,0x30,0x00,0x00},/*"皑",7*/
{0x10,0x90,0x09,0x20,0x7F,0xC0,0x40,0x00,0x43,0xB0,0x5E,0x90,0xD7,0x90,0x54,0x70,0x57,0x90,0x5E,0x90,0x43,0xB0,0x00,0x00},/*"癌",8*/
{0x42,0x00,0x53,0xF0,0x48,0x20,0xE0,0x80,0x5F,0x60,0x55,0x20,0x55,0x60,0xF5,0xA0,0x55,0x60,0x5F,0x10,0x41,0xF0,0x00,0x00},/*"蔼",9*/
{0x12,0x10,0xE2,0x60,0x3F,0x80,0x22,0x60,0x15,0x10,0x59,0x50,0x51,0xD0,0x7F,0x20,0x91,0x20,0x99,0xD0,0x15,0x10,0x00,0x00},/*"矮",10*/
{0x20,0x10,0x20,0x10,0x20,0x20,0xF6,0x20,0x21,0x40,0x20,0x80,0x21,0x40,0xF6,0x20,0x20,0x20,0x20,0x10,0x20,0x10,0x00,0x00},/*"艾",11*/
{0x42,0x00,0x4F,0xE0,0x74,0x40,0x47,0xE0,0x00,0x80,0xFA,0xC0,0xAA,0xA0,0xAA,0x80,0xAA,0x90,0xAB,0xF0,0xFA,0x80,0x00,0x00},/*"碍",12*/
}
PCtoLCE生成:
啊(0) 阿(1)
{0x7F,0xC0,0x40,0x80,0x7F,0xC0,0x00,0x00},
{0x7F,0xF0,0x4C,0x40,0x73,0x80,0x1F,0x00},
{0x51,0x10,0x7F,0xF0,0x40,0x00,0x00,0x00},/*"啊",0*/
{0x7F,0xF0,0x40,0x40,0x4C,0x40,0x73,0x80},
{0x00,0x00,0x4F,0xC0,0x48,0x80,0x4F,0x90},
{0x40,0x10,0x7F,0xF0,0x40,0x00,0x00,0x00},/*"阿",1*/
原子库如下:
{0x7F,0xC0,0x40,0x80,0x7F,0xC0,0x00,0x00,0x7F,0xF0,0x4C,0x40,0x73,0x80,0x1F,0x00,0x51,0x10,0x7F,0xF0,0x40,0x00,0x00,0x00},/*"啊",0*/
{0x7F,0xF0,0x40,0x40,0x4C,0x40,0x73,0x80,0x00,0x00,0x4F,0xC0,0x48,0x80,0x4F,0x90,0x40,0x10,0x7F,0xF0,0x40,0x00,0x00,0x00},/*"阿",1*/