stm32的I2C实验

Easter79
• 阅读 709

使用stm32工程模板,移植其他人使用0.96寸的Oled代码,在OLED上显示字符,使用的引脚是PB3和PB4,是用了重映射的引脚

这里使用的IC是stm32f103vet6,软件是keil5

百度网盘链接:https://pan.baidu.com/s/1xFrQsbjuPpt2DRcLkoDnjA
提取码:wzya

包含keil5工程和取字模工具

接线方法:

stm32                           oled

PB3 <-------------------> SCL

PB4 <-------------------> SDA

GND <-------------------> GND

VCC <-------------------> VCC

我们使用的屏幕是长128 * 宽64的OLED屏,可以将每个点想象成有个像素点

OLED_ShowString(0,0,“ABCDEFG”,8)

第一个参数0意思是从x方向的第1个像素开始,填1就是从第2个像素开始,范围是(0~127)

第二个参数0意思是从y方向的第1个像素开始,填1就是从第9个像素开始(这里y每次+1间隔的是8个像素),范围是(0~7)

第三个参数就是我们要显示的字符,要现在工程的"oled_font.h"中设置函数才能找到需要显示的字符,汉字也是如此

这里第四个参数8就是设置一个字符占了 8 * 8个像素,相当于一个64像素的正方形(只能填写8或者16)

下面贴出oled使用的.c和.h文件,还有在main.c的使用

(另外提一下,oled_bmp.c的第一幅图像bmp1被我换成了一个熊猫人,显示的很模糊我也没有去替换成其他的)

stm32的I2C实验 stm32的I2C实验

  1 #include "oled.h"
  2 #include "oled_bmp.h"
  3 #include "oled_font.h"
  4 
  5 //字符串
  6 u8 string[16];
  7 
  8 //如果是IIC接口
  9 
 10 /**********************************************
 11 //IIC Start
 12 **********************************************/
 13 void IIC_Start(void)
 14 {
 15    GPIO_SetBits(SCL_GPIO,SCL_GPIO_Pin);        
 16    GPIO_SetBits(SDA_GPIO,SDA_GPIO_Pin);
 17    GPIO_ResetBits(SDA_GPIO,SDA_GPIO_Pin);
 18    GPIO_ResetBits(SCL_GPIO,SCL_GPIO_Pin);
 19 }
 20 
 21 /**********************************************
 22 //IIC Stop
 23 **********************************************/
 24 void IIC_Stop(void)
 25 {  
 26    GPIO_ResetBits(SCL_GPIO,SCL_GPIO_Pin); 
 27    GPIO_ResetBits(SDA_GPIO,SDA_GPIO_Pin);
 28     GPIO_SetBits(SCL_GPIO,SCL_GPIO_Pin);
 29    GPIO_SetBits(SDA_GPIO,SDA_GPIO_Pin);
 30 }
 31 /**********************************************
 32 // IIC Write byte
 33 **********************************************/
 34 void Write_IIC_Byte(u8 IIC_Byte)
 35 {
 36     u8 i;
 37     for(i=0;i<8;i++)        
 38     {
 39         GPIO_ResetBits(SCL_GPIO,SCL_GPIO_Pin);
 40         if(IIC_Byte & 0x80)
 41             GPIO_SetBits(SDA_GPIO,SDA_GPIO_Pin);
 42         else
 43             GPIO_ResetBits(SDA_GPIO,SDA_GPIO_Pin);
 44         GPIO_SetBits(SCL_GPIO,SCL_GPIO_Pin);
 45         IIC_Byte<<=1;
 46     }
 47     GPIO_ResetBits(SCL_GPIO,SCL_GPIO_Pin);
 48     GPIO_SetBits(SDA_GPIO,SDA_GPIO_Pin);
 49     GPIO_SetBits(SCL_GPIO,SCL_GPIO_Pin);
 50     GPIO_ResetBits(SCL_GPIO,SCL_GPIO_Pin);
 51 }
 52 void OLED_WR_Byte(u8 dat,u8 cmd)
 53 {
 54     //写一个字节函数
 55     //dat 要写入的数据或命令
 56     //CMD 数据/命令标志位 0命令 1数据
 57     if(cmd==0)
 58     {
 59         IIC_Start();
 60         Write_IIC_Byte(0x78);         
 61         Write_IIC_Byte(0x00);        
 62         Write_IIC_Byte(dat); 
 63         IIC_Stop();
 64     }
 65     else
 66     {
 67         IIC_Start();
 68         Write_IIC_Byte(0x78);        
 69         Write_IIC_Byte(0x40);            
 70         Write_IIC_Byte(dat);
 71         IIC_Stop();        
 72     }
 73 } 
 74 
 75 
 76 void OLED_Set_Pos(u8 x,u8 y)
 77 {
 78     OLED_WR_Byte(0xb0+y,OLED_CMD);
 79     OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
 80     OLED_WR_Byte((x&0x0f),OLED_CMD);
 81 } 
 82 
 83 void OLED_Display_On(void)
 84 {
 85     //开启OLED显示
 86     OLED_WR_Byte(0x8d,OLED_CMD);
 87     OLED_WR_Byte(0x14,OLED_CMD);
 88     OLED_WR_Byte(0xaf,OLED_CMD);
 89 
 90 }
 91 void OLED_Display_Off(void)
 92 {
 93     //关闭OLED显示
 94     OLED_WR_Byte(0x8d,OLED_CMD);
 95     OLED_WR_Byte(0x10,OLED_CMD);
 96     OLED_WR_Byte(0xaf,OLED_CMD);    
 97 
 98 }
 99 void OLED_Clear(void)
100 {
101     //清屏
102     u8 i,n;
103     for(i=0;i<8;i++)
104     {
105         OLED_WR_Byte(0xb0+i,OLED_CMD);
106         OLED_WR_Byte(0x02,OLED_CMD);
107         OLED_WR_Byte(0x10,OLED_CMD);    
108         for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
109     }
110 }
111 
112 void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 size)
113 {
114     //在指定地方显示一个字符,包括部分字符
115     //x:0~127
116     //y:0~63
117     //size:选择字体16*16或8*6
118     u8 c=0,i=0;
119     c=chr-' ';
120     if(x>127)
121     {
122         x=0;
123         y=y+2;
124     }
125     if(size == 16)
126     {
127         OLED_Set_Pos(x,y);
128         for(i=0;i<8;i++)
129         {
130             OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);            
131         } 
132         OLED_Set_Pos(x,y+1);
133         for(i=0;i<8;i++)
134         {
135             OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
136         }
137         
138     } 
139     else
140     {
141         OLED_Set_Pos(x,y);
142         for(i=0;i<6;i++)
143         {
144             OLED_WR_Byte(F6x8[c][i],OLED_DATA);
145         }
146     }    
147 }
148 
149 u32 oled_pow(u8 m,u8 n)
150 {
151     //m^n函数
152     u32 result = 1;
153     while(n--)result*=m;
154     return result;
155 }
156 
157 void OLED_ShowNum(u8 x,u8 y,long num,u8 len,u8 size)
158 { 
159     //功能:显示数字
160     //x,y :起点坐标    
161     //num:+-65535;                            
162     //len :数字的位数,负号算一位
163     //size:字体大小
164     u32 t,temp1,temp2,temp3,flag; 
165     if(num<0)
166     {
167         flag=1;      //负数标志位置1
168         num=-num;   //数字变正数
169     }
170     for(t=0;t<len;t++)
171     {
172         temp1=num/oled_pow(10,len-t-1);
173         temp2=temp1%10;
174         if(flag==1)
175         {
176             temp3 = num/oled_pow(10,len-t-2);
177         }
178         if(temp1!=0)
179         {
180             OLED_ShowChar(x,y,'0'+temp2,size);
181             
182         }
183         else  
184         {  
185             if(t==len-1&&temp2==0)
186             {                            
187                OLED_ShowChar(x,y,'0',size);
188             }
189             else
190             {
191                 if(flag==1&&temp3!=0)      //该数是负数
192                 {
193                     OLED_ShowChar(x,y,'-',size);  //输出负号
194                     flag=0;                       //负号已输出,标志位置0
195                 }
196                 else
197                 {
198                     OLED_ShowChar(x,y,' ',size);
199                 }    
200             }
201         }        
202         x+=8;
203     }
204 
205 }
206 
207 void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 size)
208 {
209     //显示一个汉字串和字符号串
210     //输入\r可以换行
211     //写入新汉字需要进行登记
212     u8 x0=x;
213     u16 k;
214     while(*chr!='\0')
215     {
216         if((*chr)<128)
217         {
218             if(*chr==13)
219             {
220                 x=x0;
221                 y+=size/8;
222             }
223             else
224             {
225                 OLED_ShowChar(x,y,*chr,size);
226                 x+=8;
227                 if(x>120)
228                 {
229                     x=0;
230                     y+=size/8;
231                 }            
232             } 
233             chr++;
234         }
235         else if(size==16)        //字体是否为16
236         {
237             for(k=0;k<hz16_num;k++)  //汉字搜索
238             {
239                 if ((hz16[k].Index[0]==*(chr))&&(hz16[k].Index[1]==*(chr+1)))   //是否是已登记汉字
240                { 
241                     u8 t;
242                     OLED_Set_Pos(x,y);
243                     for(t=0;t<16;t++)
244                     {
245                         OLED_WR_Byte(hz16[k].Msk[t],OLED_DATA);
246                         
247                     }
248                     OLED_Set_Pos(x,y+1);
249                     for(t=0;t<16;t++)
250                     {
251                         OLED_WR_Byte(hz16[k].Msk[t+16],OLED_DATA);
252                     }
253                 
254                 }
255                 
256             } 
257             if(x>112)
258             {
259                 x=0;
260                 y+=2;
261             }                
262             chr+=2;x+=16;
263             
264         }
265         else       //输入错误,忽略汉字
266         {
267            chr+=2;
268         }
269     }
270 }
271 void OLED_Draw12864BMP(u8 BMP[])
272 {
273     //显示显示BMP图片128×64
274     u16 j=0;
275     u8 x,y;
276     for(y=0;y<8;y++)
277     {
278         OLED_Set_Pos(0,y);
279         for(x=0;x<128;x++)
280         {
281             #if DISPLAY_MODE
282             OLED_WR_Byte(~BMP[j++],OLED_DATA);
283             #else
284             OLED_WR_Byte(BMP[j++],OLED_DATA);
285             #endif
286         }
287     }
288 }
289 void OLED_DrawBMP(u8 x0,u8 y0,u8 x1,u8 y1,u8 BMP[])
290 {
291     //显示显示BMP图片128×64起始点坐标(x,y),x的范围0~127,y为页的范围0~7
292     u16 j=0;
293     u8 x,y;
294     for(y=y0;y<y1;y++)
295     {
296         OLED_Set_Pos(x0,y);
297         for(x=x0;x<x1;x++)
298         {
299             OLED_WR_Byte(BMP[j++],OLED_DATA);
300         }
301     }
302 }
303 
304 void OLED_Init(void)
305 {
306     
307     //初始化需要用到的IO,从头文件修改即可
308     //执行初始化OLED代码
309     GPIO_InitTypeDef GPIO_InitStructure;
310     //SCL  D0
311     RCC_APB2PeriphClockCmd(SCL_GPIOClock,ENABLE);
312     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
313     GPIO_InitStructure.GPIO_Pin = SCL_GPIO_Pin;
314     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
315     GPIO_Init(SCL_GPIO,&GPIO_InitStructure);    
316     GPIO_SetBits(SCL_GPIO,SCL_GPIO_Pin);
317     //SDA  D1
318     RCC_APB2PeriphClockCmd(SDA_GPIOClock,ENABLE);    
319     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
320     GPIO_InitStructure.GPIO_Pin = SDA_GPIO_Pin;
321     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
322     GPIO_Init(SDA_GPIO,&GPIO_InitStructure);    
323     GPIO_SetBits(SDA_GPIO,SDA_GPIO_Pin);
324     
325     
326     OLED_WR_Byte(0xAE,OLED_CMD);//关闭显示
327     OLED_WR_Byte(0x02,OLED_CMD);//[1:0],00,列地址模式;01,
328                                                             //行地址模式;10,页地址模式;默认 10;
329     OLED_WR_Byte(0x10,OLED_CMD);//设置高列地址
330     OLED_WR_Byte(0x40,OLED_CMD);//设置显示开始行 [5:0],行数
331     OLED_WR_Byte(0x81,OLED_CMD);//对比度设置
332     OLED_WR_Byte(0xCF,OLED_CMD);//设定SEG输出电流亮度
333     OLED_WR_Byte(0xA1,OLED_CMD);//段重定义设置,bit0:0,0->0;1,0->127;     0xa0左右反置 0xa1正常
334     OLED_WR_Byte(0xC8,OLED_CMD);//设置 COM 扫描方向;bit3:0,普通模式;1,
335                                                             //重定义模式 COM[N-1]->COM0;N:驱动路数   0xc0上下反置 0xc8正常
336     OLED_WR_Byte(0xA8,OLED_CMD);//设置驱动路数
337     OLED_WR_Byte(0x3f,OLED_CMD);//默认 0X3F(1/64)
338     OLED_WR_Byte(0x81,OLED_CMD);//对比度设置
339     OLED_WR_Byte(0xfF,OLED_CMD);//1~255;默认0X7F (亮度设置,越大越亮)
340     OLED_WR_Byte(0xD3,OLED_CMD);////设置显示偏移(0x00~0x3F)
341     OLED_WR_Byte(0x00,OLED_CMD);//-not offset
342     OLED_WR_Byte(0xd5,OLED_CMD);//设置时钟分频因子,震荡频率
343     OLED_WR_Byte(0x80,OLED_CMD);//[3:0],分频因子;[7:4],震荡频率
344     OLED_WR_Byte(0xD9,OLED_CMD);//设置预充电周期
345     OLED_WR_Byte(0xF1,OLED_CMD);//将预充电作为15个时钟和放电作为1个时钟
346     OLED_WR_Byte(0xDA,OLED_CMD);//设置 COM 硬件引脚配置
347     OLED_WR_Byte(0x12,OLED_CMD);//[5:4]配置
348     OLED_WR_Byte(0xDB,OLED_CMD);//设置 VCOMH 电压倍率
349     OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
350     OLED_WR_Byte(0x20,OLED_CMD);//设置内存地址模式 (0x00/0x01/0x02)
351     OLED_WR_Byte(0x02,OLED_CMD);//[1:0],00,列地址模式;01,
352                                                             //行地址模式;10,页地址模式;默认 10;
353     OLED_WR_Byte(0x8D,OLED_CMD);//电荷泵启用/禁用
354     OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
355     OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
356     #if DISPLAY_MODE == 1
357     OLED_WR_Byte(0xA7,OLED_CMD);//设置显示方式;bit0:1,反相显示;0,正常显示 
358     #else
359     OLED_WR_Byte(0xA6,OLED_CMD);//设置显示方式;bit0:1,反相显示;0,正常显示    
360     #endif
361     OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
362 
363     OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/     
364     OLED_Clear();
365     OLED_Set_Pos(0,0);    
366     
367     
368     RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
369     GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);
370 }

oled.c

stm32的I2C实验 stm32的I2C实验

 1 #ifndef _OLED_H_
 2 #define _OLED_H_
 3 
 4 #include "stm32f10x_gpio.h"
 5 #include "oled_bmp.h"
 6 #include "oled_font.h"
 7 
 8 
 9 /****************可根据需求设置的选项******************/
10 #define DISPLAY_MODE     1     //显示模式,1为黑字白底,2为白字黑底
11 
12 
13 /********************引脚定义*************************/
14 // IIC_SCL 
15 #define SCL_GPIOClock    RCC_APB2Periph_GPIOB
16 #define SCL_GPIO         GPIOB
17 #define SCL_GPIO_Pin     GPIO_Pin_3
18 //IIC_SDA 
19 #define SDA_GPIOClock    RCC_APB2Periph_GPIOB
20 #define SDA_GPIO         GPIOB
21 #define SDA_GPIO_Pin     GPIO_Pin_4
22 
23 
24 /***************************************************/
25    
26 #define OLED_CMD  0
27 #define OLED_DATA 1
28 
29 
30 extern u8 string[16];
31 
32 /* OLED初始化函数 */
33 void OLED_Init(void);
34 
35 /* 功能函数 */    
36 void OLED_Clear(void); //清屏
37 void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 size);          //显示一个字符,(x坐标,y坐标,显示的字符,字体)ps:字体为16或者8
38 void OLED_ShowNum(u8 x,u8 y,long num,u8 len,u8 size);  //显示数字,(x坐标,y坐标,显示的数字,长度,字体) ps:字体为16或者8
39 void OLED_DrawBMP(u8 x0,u8 y0,u8 x1,u8 y1,u8 BMP[]);   //显示图片,(起始x,y坐标,终止x,y坐标,图片地址)
40 void OLED_Draw12864BMP(u8 BMP[]);                      //显示128*64的图片(图片地址)
41 void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 size);       //显示汉字和字符串,可以输入已登记的汉字,(x坐标,y坐标,文字串,字符串字体)
42                                                                          //汉字的字体固定16*16,不可改变,若要输入汉字,字体必须位16,字体为8为纯字符串
43                                                                          
44 /* PS:可以实验sprintf函数实现带参数的字符串
45 方法:
46        定义一个u8 string[16];这样的变量
47          然后使用sprintf(string,"display_num:%d",num);
48          再然后调用OLED_ShowString(0,0,string,8);函数即可显示带参数的字符串,sprintf函数的更多用法可以百度查找
49  */
50 
51 /***************************************************/
52 
53 /* 其他函数,不需要调用 */
54 void OLED_Set_Pos(u8 x,u8 y);
55 void OLED_WR_Byte(u8 dat,u8 cmd);
56 
57 
58 #endif

oled.h

stm32的I2C实验 stm32的I2C实验

  1 #include "oled_bmp.h"
  2 //图片地址
  3 //用于存放图片数组,存放后需要在头文件声明
  4 //图片需要为PCtol2002设置为 逆向 十六进制 C51代码 行前缀无 行后缀,
  5 unsigned char BMP1[]=
  6 {
  7 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  8 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  9 0xF0,0x70,0x30,0xD0,0xEC,0xF4,0xF8,0xF8,0xFA,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFA,
 10 0x78,0x78,0xB4,0xB4,0xD4,0xD4,0xD4,0xDC,0xD8,0xD8,0xF8,0xE8,0xE8,0xE8,0xE8,0xE8,
 11 0xE8,0xE8,0xE8,0xE8,0xE8,0xE8,0xE8,0xE8,0xE8,0xE8,0x98,0x9C,0x94,0x94,0x54,0x74,
 12 0xB4,0xB4,0x78,0xF8,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xF8,0xFA,0xF8,0xFC,0xF4,0xEC,
 13 0x8C,0x60,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 14 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 15 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 16 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 17 0x03,0x03,0x03,0x00,0xCB,0xF7,0x77,0x8F,0xEF,0x7F,0x9F,0xEF,0xF7,0xEB,0xFD,0xFE,
 18 0xFE,0xF7,0xEF,0xED,0xED,0xAE,0xEE,0xEE,0xBE,0x9E,0xDE,0xDE,0xDE,0xDE,0xDE,0xDE,
 19 0xFD,0xED,0x6D,0xEE,0x7E,0x6E,0x5E,0xBE,0xBF,0xFE,0xFE,0xDE,0xDE,0x9E,0xDE,0xEE,
 20 0xEE,0xFF,0xFD,0xFE,0xFC,0x0D,0x0B,0x27,0x8F,0x7F,0xEF,0x8F,0x6F,0x07,0x0B,0x0B,
 21 0x0C,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 22 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 23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 0x7D,0x7D,0x7E,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x9F,0x3F,0xBF,
 37 0xBF,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,
 38 0xFD,0xF8,0xF6,0xE4,0xCC,0x30,0x70,0x90,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 39 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF7,0x80,0x7F,0xFF,
 40 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,
 41 0xF8,0xFF,0xF7,0xF6,0xE1,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
 42 0xFF,0xFF,0x01,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 43 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,
 44 0x01,0x70,0x33,0x30,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xF1,
 45 0xF7,0xFB,0xFB,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
 46 0xFF,0xFF,0x7F,0x7F,0xBF,0xBF,0xDC,0x23,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 47 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,
 48 0x06,0x05,0x05,0x03,0x0B,0x0B,0x03,0x07,0x17,0x07,0x17,0x17,0x07,0x17,0x07,0x07,
 49 0x07,0x07,0x0F,0x0F,0x6F,0x2F,0x6F,0x4F,0xBF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
 50 0xFF,0xFF,0xFF,0xF8,0xE6,0xCC,0xB0,0x30,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,
 51 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,
 52 0xC0,0x70,0x70,0x90,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xBF,0xC7,
 53 0x77,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x01,
 54 0x02,0x02,0x03,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 55 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 56 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xD4,0x54,0x78,0x7B,0xFB,0xFD,0xFD,
 57 0xFA,0xFA,0xFA,0xFA,0xDA,0xDE,0x36,0xAC,0x2D,0xAD,0xAC,0xAD,0xFF,0xFF,0x3F,0xAF,
 58 0xAF,0xAF,0xA3,0x8B,0x8F,0xBF,0xBF,0xEF,0xDF,0xDF,0xEE,0xBE,0x9E,0xAE,0xA2,0xF2,
 59 0x72,0xF2,0xFA,0xFA,0xFE,0xFE,0xFE,0xFA,0xFA,0xF2,0x72,0xF2,0x8A,0x82,0xFE,0x7E,
 60 0xBA,0x02,0xFB,0xFF,0xBB,0x93,0xF3,0xC3,0xFB,0xFF,0x7F,0xFF,0xFD,0xFC,0xFD,0xFD,
 61 0xFD,0xFD,0xFD,0xFD,0x7C,0x88,0xFC,0xFC,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 62 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 63 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 64 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0xA9,0xBE,0x1E,0xFE,0x7F,0x7F,0x7F,
 65 0x7F,0x7F,0x7F,0xFF,0xFE,0x9A,0x9B,0xFD,0xFE,0x2B,0x3D,0xFF,0xD7,0x7C,0x7E,0x97,
 66 0xBF,0x3D,0x7F,0x7B,0x7F,0xFF,0xFE,0x7E,0x7E,0x7E,0x7E,0x7E,0x7F,0x7F,0x5F,0x99,
 67 0x5D,0x5D,0x7D,0x7F,0x7B,0x5B,0x7F,0x7D,0x5D,0xDD,0x99,0x49,0x45,0x61,0x3E,0xFE,
 68 0xC1,0x81,0x7E,0x7F,0x41,0x4D,0x75,0x78,0x4B,0x7F,0x7F,0x7B,0x7F,0x7F,0x7F,0xFF,
 69 0x7E,0x7E,0x7F,0x7B,0x4D,0xEF,0x67,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 70 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 71 };
 72 
 73 unsigned char BMP2[] =
 74 {
 75     //测试图片2,可爱的卡通少女
 76     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
 77     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
 78     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
 79     0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x3F,0xBF,0xBF,0x9F,0xDF,0xDF,0xDF,0xDF,0xDF,
 80     0xDF,0xDF,0xDF,0xDF,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xFF,0xFF,
130     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
131     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
132     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
133     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
134     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
135     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFF,
136     0xFF,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
137     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
138     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
139     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
140 };

oled_bmp.c

stm32的I2C实验 stm32的I2C实验

1 #ifndef __BMP_H
2 #define __BMP_H
3 
4 extern unsigned char BMP1[];
5 extern unsigned char BMP2[];
6 
7 
8 #endif

oled_bmp.h

stm32的I2C实验 stm32的I2C实验

  1 #include "oled_font.h"
  2 
  3 /*
  4 此文件用来存放汉字的点阵和字符点阵
  5 必须在.h文件声明
  6 */
  7 
  8 /*     字模选项
  9    阴码
 10     列行试
 11     点阵32
 12     索引  随便
 13     取模逆向
 14     输出数制 十六进制数
 15     C51格式
 16     段前缀      无
 17     段后缀      无
 18     注释前缀    "
 19     注释后缀    ",
 20     数据前缀    0x
 21     数据后缀    ,
 22     行前缀      无
 23     行后缀      ,
 24     行尾缀      ,
 25 */
 26 
 27 //常用ASCII表
 28 //偏移量32
 29 //ASCII字符集
 30 //偏移量32
 31 //大小:12*6
 32 /************************************6*8的点阵************************************/
 33 const unsigned char F6x8[][6] =        
 34 {
 35 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp
 36 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// !
 37 0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// "
 38 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// #
 39 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $
 40 0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// %
 41 0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// &
 42 0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// '
 43 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// (
 44 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// )
 45 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// *
 46 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// +
 47 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// ,
 48 0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// -
 49 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// .
 50 0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// /
 51 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
 52 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1
 53 0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2
 54 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3
 55 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4
 56 0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5
 57 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
 58 0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7
 59 0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8
 60 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9
 61 0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// :
 62 0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ;
 63 0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// <
 64 0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// =
 65 0x00, 0x00, 0x41, 0x22, 0x14, 0x08,// >
 66 0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ?
 67 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @
 68 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A
 69 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B
 70 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C
 71 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
 72 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E
 73 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F
 74 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G
 75 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
 76 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I
 77 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J
 78 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K
 79 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L
 80 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M
 81 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
 82 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
 83 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P
 84 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
 85 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R
 86 0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S
 87 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T
 88 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
 89 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
 90 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W
 91 0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X
 92 0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y
 93 0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z
 94 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// [
 95 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55,// 55
 96 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,// ]
 97 0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^
 98 0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _
 99 0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// '
100 0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a
101 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b
102 0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c
103 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d
104 0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e
105 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f
106 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g
107 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h
108 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i
109 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j
110 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k
111 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l
112 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m
113 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n
114 0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o
115 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p
116 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q
117 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r
118 0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s
119 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t
120 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
121 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
122 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
123 0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x
124 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y
125 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z
126 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines
127 };
128 /****************************************8*16的点阵************************************/
129 const unsigned char F8X16[]=      
130 {
131   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
132   0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
133   0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
134   0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
135   0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
136   0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
137   0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
138   0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
139   0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
140   0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
141   0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
142   0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
143   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
144   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
145   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
146   0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
147   0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
148   0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
149   0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
150   0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
151   0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
152   0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
153   0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
154   0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
155   0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
156   0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
157   0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
158   0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
159   0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
160   0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
161   0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
162   0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
163   0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
164   0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
165   0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
166   0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
167   0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
168   0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
169   0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
170   0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
171   0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
172   0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
173   0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
174   0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
175   0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
176   0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
177   0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
178   0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
179   0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
180   0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
181   0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
182   0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
183   0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
184   0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
185   0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
186   0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
187   0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
188   0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
189   0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
190   0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
191   0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
192   0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
193   0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
194   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
195   0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
196   0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
197   0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
198   0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
199   0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
200   0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
201   0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
202   0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
203   0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
204   0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
205   0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
206   0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
207   0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
208   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
209   0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
210   0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
211   0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
212   0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
213   0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
214   0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
215   0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
216   0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
217   0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
218   0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
219   0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
220   0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
221   0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
222   0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
223   0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
224   0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
225   0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
226 };
227 
228 //宋体5号
229 #define hz16_num   54
230 const struct typFNT_GB162 hz16[] = {
231 0x40,0x40,0x42,0xCC,0x00,0x08,0x28,0x48,0x89,0x0E,0xC8,0x38,0x08,0x08,0x00,0x00,
232 0x00,0x40,0x20,0x1F,0x20,0x50,0x48,0x44,0x42,0x41,0x42,0x44,0x58,0x40,0x40,0x00,"这",0,
233 /* (16 X 16 , 宋体 )*/
234 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
235 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,"一",1,
236 /* (16 X 16 , 宋体 )*/
237 0x40,0x40,0x40,0xFF,0x20,0x20,0x20,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
238 0x00,0x00,0x00,0x1F,0x08,0x84,0x42,0x20,0x18,0x07,0x40,0x80,0x40,0x3F,0x00,0x00,"切",2,
239 /* (16 X 16 , 宋体 )*/
240 0x00,0x00,0x00,0x7E,0x42,0x42,0x42,0xC2,0x42,0x42,0x42,0x7E,0x00,0x00,0x00,0x00,
241 0x80,0x40,0x30,0x0E,0x10,0x20,0x40,0x7F,0x44,0x44,0x44,0x44,0x44,0x40,0x40,0x00,"足",3,
242 /* (16 X 16 , 宋体 )*/
243 0x10,0xCC,0x4B,0x48,0xC8,0x08,0xF8,0x00,0x90,0x8C,0x57,0xA4,0x14,0x0C,0x00,0x00,
244 0x00,0x0F,0x04,0x44,0x8F,0x40,0x3F,0x00,0x88,0x84,0x46,0x29,0x11,0x0D,0x03,0x00,"够",4,
245 /* (16 X 16 , 宋体 )*/
246 0x00,0x02,0x02,0x02,0x02,0x02,0x02,0xE2,0x22,0x12,0x0A,0x06,0x02,0x00,0x00,0x00,
247 0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,"了",5,
248 /* (16 X 16 , 宋体 )*/
249 };

oled_font.c

stm32的I2C实验 stm32的I2C实验

 1 #ifndef __OLEDFONT_H
 2 #define __OLEDFONT_H      
 3 
 4 #define hz16_num   54  //汉字个数
 5 
 6 struct typFNT_GB162    //汉字用的结构体
 7 {
 8      char Msk[32];
 9      unsigned char Index[2];    
10      unsigned char num;  
11 };
12 extern const struct typFNT_GB162 hz16[];
13 extern const unsigned char F6x8[][6];
14 extern const unsigned char F8X16[];
15 
16 
17 #endif

oled_font.h

stm32的I2C实验 stm32的I2C实验

 1 #include "sys.h"
 2 #include "delay.h"
 3 #include "usart.h"
 4 #include "oled_bmp.h"
 5 #include "oled_font.h"
 6 #include "oled.h"
 7 
 8 int main(void)
 9 {    
10     delay_init();
11     OLED_Init();
12     
13     //OLED_ShowString(0,0,"ABCDEFG",8);
14     //OLED_ShowString(0,1,"ABCDEFG",8);
15     
16     OLED_ShowString(0,0,"ABCDEFG",16);
17     OLED_ShowString(0,2,"这一切足够了",16);
18 
19     //OLED_Draw12864BMP(BMP1);
20     while(1)
21     {
22     
23     }
24 }

main.c

字模工具使用:

从百度网盘中下载了PCtoLCD2002以后直接解压运行exe文件就可以使用了

首先在模式中选择字符模式

stm32的I2C实验

在字模选项中按下面图片的样式填写

stm32的I2C实验 stm32的I2C实验

 1 /*     
 2    阴码
 3     列行试
 4     点阵32
 5     索引  随便
 6     取模逆向
 7     输出数制 十六进制数
 8     C51格式
 9     段前缀      无
10     段后缀      无
11     注释前缀    "
12     注释后缀    ",
13     数据前缀    0x
14     数据后缀    ,
15     行前缀      无
16     行后缀      ,
17     行尾缀      ,
18 */

字模选项

stm32的I2C实验

设置好之后我们在下方的空格栏填入自己想要显示的字符

stm32的I2C实验

点击生成字模就可以生成我们需要的编码

stm32的I2C实验 stm32的I2C实验

 1 0x00,0x04,0x04,0xF4,0x54,0x54,0x54,0x5F,0x54,0x54,0x54,0xF4,0x04,0x04,0x00,0x00,
 2 0x10,0x10,0x90,0x5F,0x35,0x15,0x15,0x15,0x15,0x15,0x35,0x5F,0x90,0x10,0x10,0x00,"真",0,
 3 /* (16 X 16 , 宋体 )*/
 4 0x00,0xF8,0x0C,0x0B,0x08,0x08,0xF8,0x40,0x30,0x8F,0x08,0x08,0x08,0xF8,0x00,0x00,
 5 0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00,0x00,0x43,0x80,0x40,0x3F,0x00,0x00,"的",1,
 6 /* (16 X 16 , 宋体 )*/
 7 0x00,0x40,0x20,0x1E,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,
 8 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,"牛",2,
 9 /* (16 X 16 , 宋体 )*/
10 0x00,0x00,0xF8,0x08,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x28,0x18,0x00,0x00,
11 0x80,0x60,0x1F,0x80,0x80,0x43,0x44,0x28,0x10,0x28,0x44,0x43,0x80,0x80,0x80,0x00,"皮",3,
12 /* (16 X 16 , 宋体 )*/

真的牛皮

stm32的I2C实验

将编码放在oled_font.c中保存就可以在OLED_ShowString中使用我们需要的字符了

例如OLED_ShowString(0,2,"这一切足够了",16);

(这里我没有用上图的"真的牛皮",我显示的是"这一切足够了")

 stm32的I2C实验

结束啦

想要显示图片也可以使用这个工具,这里不多介绍了

图片必须是128*64的二值bmp图片,不然直接导入生成显示的图片会有些问题

2月4日,今天也是充满希望的一天

stm32的I2C实验

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
3年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
为什么mysql不推荐使用雪花ID作为主键
作者:毛辰飞背景在mysql中设计表的时候,mysql官方推荐不要使用uuid或者不连续不重复的雪花id(long形且唯一),而是推荐连续自增的主键id,官方的推荐是auto_increment,那么为什么不建议采用uuid,使用uuid究
Python进阶者 Python进阶者
11个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这
Easter79
Easter79
Lv1
今生可爱与温柔,每一样都不能少。
文章
2.8k
粉丝
5
获赞
1.2k