赞
踩
OLED显示16*16汉字
16*16点阵
- void Draw_16x16(unsigned char x,unsigned char y,unsigned char N)//显示16*16汉字
- {
-
- unsigned int Num =N*32;
- unsigned int i = 0;
- OLED_SetCursor(y,x);
- for ( i = 0; i < 16; i++)
- {
- OLED_WriteData(Tab16_16[Num]);
- Num+=1;
- }
-
- OLED_SetCursor(y+1,x);
- for (i = 0; i < 16; i++)
- {
- OLED_WriteData(Tab16_16[Num]);
- Num+=1;
- }
- }
OLED由128*64个像素组成
有8行,18行8个像素
显示32*64灵感:
OLED_SetCursor(y,x);
for ( i = 0; i < 16; i++)
{
OLED_WriteData(Tab16_16[Num]);
Num+=1;
}
32*64字模一行有32个像素,有8行
"好"
编写程序
- void Point_32x64(unsigned char x,unsigned char y,unsigned char N)//显示32*64汉字
- {
-
- unsigned int Num =N*256; //定义一个汉字256像素
- int i = 0;
- OLED_SetCursor(y,x); //显示第一行
- for ( i = 0; i < 32; i++)
- {
- OLED_WriteData(Tab_32x64[Num]);
- Num+=1;
- }
-
- }
烧录后显示:
汉字宽度32,高度64,程序只写了1行,符合预期,使用for循环编写完整程序
- void Point_32x64(unsigned char x,unsigned char y,unsigned char N)//显示32*64汉字
- {
-
- unsigned int Num =N*256;
- int i ,j;
-
- for( j=0;j<8;j++)
- {
- OLED_SetCursor(y+j,x);
- for (i = 0; i < 32; i++)
- {
- OLED_WriteData(Tab_32x64[Num]);
- Num+=1;
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。