当前位置:网站首页>OLED displays how to understand the character sizes of 12*6, 16*8, 24*12, etc
OLED displays how to understand the character sizes of 12*6, 16*8, 24*12, etc
2022-07-19 09:19:00 【Xiaofeixia 123!】

The mold taking method set in the figure above , In the mold taking instructions in the upper right corner, there are .
namely : Start from the first column and take down every 8 Points as a byte , If there is not enough in the end 8 Fill it up at one point 8 position .( a key !!!)
The mold order is from high to low , That is, the first point is the highest .
Such as *------- Take 10000000. In fact, it is as shown in the figure 17.3.3 In the way shown :
From top to bottom , From left to right , High in the former . We take the mold in this way , And then put ASCII Character set press 12x6 size 、 16x8 and 24x12 Take the size mold out ( The corresponding Chinese character size is 12x12、 16x16 and 24x24, The of characters is only half the size of Chinese characters !), Save in oledfont.h Inside , Every 12x6 Character occupation of 12 Bytes ( Be careful , Because they are written in bytes , In all column directions 12 Point by point 16 A little bit 2 Byte processing , therefore 12x6 Character usage 2x6=12 Bytes ), Every 16x8 Character occupation of 16 Bytes , Every 24x12 Character occupation of 36 Bytes .
Let's analyze a piece of code :
// Display a character at the specified position , Including some characters
//x:0~127
//y:0~63
//mode:0, On the contrary ;1, Normal display
//size: Select the font 12/16/24
void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 size,u8 mode)
{
u8 temp,t,t1;
u8 y0=y;
u8 csize=(size/8+((size%8)?1:0))*(size/2); // Get the number of bytes of a font character corresponding to the lattice set
chr=chr-' ';// Get the offset value
for(t=0;t<csize;t++)
{
if(size==12)
temp=asc2_1206[chr][t]; // call 1206 typeface
else
if(size==16)
temp=asc2_1608[chr][t]; // call 1608 typeface
else
if(size==24)
temp=asc2_2412[chr][t]; // call 2412 typeface
else
return; // No word bank
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)==size)
{
y=y0;
x++;
break;
}
}
}
}
Suppose you print 12*6 The characters of , When size=12 when ,csize = 12.
if((y-y0)==size)
{
y=y0;
x++;
break;
}
Although the height of characters takes 2 Bytes 16 A little bit , But this code limits the display height to size, That is, the height displayed is 12.
The same can be said for others .
边栏推荐
猜你喜欢

LabVIEW32位与64位的兼容性

LabVIEW用了多线程,程序是不是会跑的更快些

shell-笔记

Etcd database source code analysis - initialize etcdserver structure

Yanrong technology was selected as Beijing's "specialized and innovative" in 2022 to lead hybrid cloud file storage

Simple case of wechat applet calling API
![[untitled]](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[untitled]

LDA classifier

Two structures ifconf and ifreq

Express
随机推荐
Programming in the novel [serial 15] the moon bends in the yuan universe
Two structures ifconf and ifreq
MySql数据是如何存储在磁盘上存储的?
MySQL initialization and password modification
软件工程师视角的项目合同分析
SDL图像显示
sql server建表时设置ID字段自增 (navicat 演示)
shell-笔记
静态路由!!静态路由!!静态路由!!
【性能优化方法论系列】六、总结
OpenCV模板
代码庆端午--粽你心意
日志脱敏-参考
LDA classifier
目标检测模型大小计算,模型复杂度(参数换算公式)
Project contract analysis from the perspective of Software Engineer
QT serial communication
在Pycharm里面如何避免全局索引?如何取消对于某个文件夹的索引?
实用工具系列 - Xshell安装下载与使用
电脑拨号上网