• 电脑通过串口助手和51单片机串口通讯


    今天有时间把电脑和51单片机之间的串口通讯搞定了,电脑发送的串口数据,单片机能够正常接收并显示到oled屏幕上,特此记录一下,防止后面自己忘记了怎么搞得了。

    先来两个图片看看结果吧!

    下面是串口3.c的文件全部内容:

    1. #include"oled.h"
    2. #define REC_MAX 30 //最大接收数据字节数 修改30就是可以了
    3. #define END_STR '.' //接收数据的结束标志 修改.能新建结束符了十六进制也可以
    4. u8 dat[REC_MAX]={0}; // 接收串口数据的数组,只接收20个字节
    5. u8 i=0;
    6. void time_init() // 定时器初始化
    7. {
    8. SCON=0x50; // 串口工作在8位异步允许接收模式
    9. TMOD=0x20; // 波特率设置由定时器1产生
    10. TH1=0xFD; // 9600
    11. TL1=0xFD; // 9600
    12. ES=1; // 串口中断允许
    13. EA=1; // 总中断允许
    14. TR1=1; // 定时器1中断允许
    15. }
    16. int main()
    17. {
    18. OLED_Init(); // oled初始化
    19. OLED_Clear(); // oled 清屏
    20. time_init(); // 定时器初始化
    21. while(1)
    22. {
    23. OLED_ShowString(0,0,dat,16); // 显示dat数组中的字符
    24. }
    25. }
    26. void zd() interrupt 4 //串口中断函数
    27. {
    28. u8 j=0;
    29. if(RI==1) //如果是允许接收等于1
    30. {
    31. dat[i]=SBUF; // 数组的第i位为接收的1字节数据
    32. i++; // i++ ,走向下一个字节
    33. RI=0; //接收标志位清0,开始接收下一个字节
    34. }
    35. if(SBUF == END_STR) //如果SBUF接收缓存中是0x2E也就是“.”,就是结束符,开始下面的代码:
    36. {
    37. OLED_Clear(); // 清屏
    38. for(j=i;j//由于每次接收到了比数组中字节数少的信息后,上次的字节信息还有
    39. { // 所以这里把每次接收完了,把后面的字节都填充成0.
    40. dat[j]=0x00;
    41. }
    42. OLED_Clear(); // 实际使用中1次清屏有可能有残留,字符,所以清两次
    43. i=0;
    44. }
    45. }

    下面是oled.h的全部内容:

    1. #include "reg52.h"
    2. #ifndef __OLED_H
    3. #define __OLED_H
    4. #define u8 unsigned char
    5. #define u32 unsigned int
    6. #define OLED_CMD 0 //写命令
    7. #define OLED_DATA 1 //写数据
    8. #define OLED_MODE 0
    9. sbit OLED_SCL=P3^2; //时钟线
    10. sbit OLED_SDIN=P3^3; //数据线
    11. #define OLED_CS_Clr() OLED_CS=0
    12. #define OLED_CS_Set() OLED_CS=1
    13. #define OLED_RST_Clr() OLED_RST=0
    14. #define OLED_RST_Set() OLED_RST=1
    15. #define OLED_DC_Clr() OLED_DC=0
    16. #define OLED_DC_Set() OLED_DC=1
    17. #define OLED_SCLK_Clr() OLED_SCL=0
    18. #define OLED_SCLK_Set() OLED_SCL=1
    19. #define OLED_SDIN_Clr() OLED_SDIN=0
    20. #define OLED_SDIN_Set() OLED_SDIN=1
    21. //OLED模式设置
    22. //0:4线串行模式
    23. //1:并行8080模式
    24. #define SIZE 16
    25. #define XLevelL 0x02
    26. #define XLevelH 0x10
    27. #define Max_Column 128
    28. #define Max_Row 64
    29. #define Brightness 0xFF
    30. #define X_WIDTH 128
    31. #define Y_WIDTH 64
    32. //-----------------OLED端口定义----------------
    33. void delay_ms(unsigned int ms);
    34. //OLED控制用函数
    35. void OLED_WR_Byte(unsigned dat,unsigned cmd);
    36. void OLED_Display_On(void);
    37. void OLED_Display_Off(void);
    38. void OLED_Init(void);
    39. void OLED_Clear(void);
    40. void OLED_DrawPoint(u8 x,u8 y,u8 t);
    41. void OLED_Fill(u8 x1,u8 y1,u8 x2,u8 y2,u8 dot);
    42. void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 Char_Size);
    43. void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size);
    44. void OLED_ShowString(u8 x,u8 y, u8 *p,u8 Char_Size);
    45. void OLED_Set_Pos(unsigned char x, unsigned char y);
    46. void OLED_ShowCHinese(u8 x,u8 y,u8 no);
    47. void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
    48. void Delay_50ms(unsigned int Del_50ms);
    49. void Delay_1ms(unsigned int Del_1ms);
    50. void fill_picture(unsigned char fill_Data);
    51. void Picture();
    52. void IIC_Start();
    53. void IIC_Stop();
    54. void Write_IIC_Command(unsigned char IIC_Command);
    55. void Write_IIC_Data(unsigned char IIC_Data);
    56. void Write_IIC_Byte(unsigned char IIC_Byte);
    57. void IIC_Wait_Ack();
    58. #endif

    下面是oled.c的全部内容:

    1. #include "oled.h"
    2. #include "oledfont.h" //取模的中文库
    3. void delay_ms(unsigned int ms)
    4. {
    5. unsigned int a;
    6. while(ms)
    7. {
    8. a=1800;
    9. while(a--);
    10. ms--;
    11. }
    12. }
    13. /**********************************************
    14. //IIC Start
    15. **********************************************/
    16. void IIC_Start()
    17. {
    18. OLED_SCLK_Set() ;
    19. OLED_SDIN_Set();
    20. OLED_SDIN_Clr();
    21. OLED_SCLK_Clr();
    22. }
    23. /**********************************************
    24. //IIC Stop
    25. **********************************************/
    26. void IIC_Stop()
    27. {
    28. OLED_SCLK_Set() ;
    29. // OLED_SCLK_Clr();
    30. OLED_SDIN_Clr();
    31. OLED_SDIN_Set();
    32. }
    33. void IIC_Wait_Ack()
    34. {
    35. //GPIOB->CRH &= 0XFFF0FFFF; //设置PB12为上拉输入模式
    36. //GPIOB->CRH |= 0x00080000;
    37. // OLED_SDA = 1;
    38. // delay_us(1);
    39. //OLED_SCL = 1;
    40. //delay_us(50000);
    41. /* while(1)
    42. {
    43. if(!OLED_SDA) //判断是否接收到OLED 应答信号
    44. {
    45. //GPIOB->CRH &= 0XFFF0FFFF; //设置PB12为通用推免输出模式
    46. //GPIOB->CRH |= 0x00030000;
    47. return;
    48. }
    49. }
    50. */
    51. OLED_SCLK_Set() ;
    52. OLED_SCLK_Clr();
    53. }
    54. /**********************************************
    55. // IIC Write byte
    56. **********************************************/
    57. void Write_IIC_Byte(unsigned char IIC_Byte)
    58. {
    59. unsigned char i;
    60. unsigned char m,da;
    61. da=IIC_Byte;
    62. OLED_SCLK_Clr();
    63. for(i=0;i<8;i++)
    64. {
    65. m=da;
    66. // OLED_SCLK_Clr();
    67. m=m&0x80;
    68. if(m==0x80)
    69. {OLED_SDIN_Set();}
    70. else OLED_SDIN_Clr();
    71. da=da<<1;
    72. OLED_SCLK_Set();
    73. OLED_SCLK_Clr();
    74. }
    75. }
    76. /**********************************************
    77. // IIC Write Command
    78. **********************************************/
    79. void Write_IIC_Command(unsigned char IIC_Command)
    80. {
    81. IIC_Start();
    82. Write_IIC_Byte(0x78); //Slave address,SA0=0
    83. IIC_Wait_Ack();
    84. Write_IIC_Byte(0x00); //write command
    85. IIC_Wait_Ack();
    86. Write_IIC_Byte(IIC_Command);
    87. IIC_Wait_Ack();
    88. IIC_Stop();
    89. }
    90. /**********************************************
    91. // IIC Write Data
    92. **********************************************/
    93. void Write_IIC_Data(unsigned char IIC_Data)
    94. {
    95. IIC_Start();
    96. Write_IIC_Byte(0x78); //D/C#=0; R/W#=0
    97. IIC_Wait_Ack();
    98. Write_IIC_Byte(0x40); //write data
    99. IIC_Wait_Ack();
    100. Write_IIC_Byte(IIC_Data);
    101. IIC_Wait_Ack();
    102. IIC_Stop();
    103. }
    104. void OLED_WR_Byte(unsigned dat,unsigned cmd)
    105. {
    106. if(cmd)
    107. {
    108. Write_IIC_Data(dat);
    109. }
    110. else
    111. {
    112. Write_IIC_Command(dat);
    113. }
    114. }
    115. /********************************************
    116. // fill_Picture
    117. ********************************************/
    118. void fill_picture(unsigned char fill_Data)
    119. {
    120. unsigned char m,n;
    121. for(m=0;m<8;m++)
    122. {
    123. OLED_WR_Byte(0xb0+m,0); //page0-page1
    124. OLED_WR_Byte(0x00,0); //low column start address
    125. OLED_WR_Byte(0x10,0); //high column start address
    126. for(n=0;n<128;n++)
    127. {
    128. OLED_WR_Byte(fill_Data,1);
    129. }
    130. }
    131. }
    132. /***********************Delay****************************************/
    133. void Delay_50ms(unsigned int Del_50ms)
    134. {
    135. unsigned int m;
    136. for(;Del_50ms>0;Del_50ms--)
    137. for(m=6245;m>0;m--);
    138. }
    139. void Delay_1ms(unsigned int Del_1ms)
    140. {
    141. unsigned char j;
    142. while(Del_1ms--)
    143. {
    144. for(j=0;j<123;j++);
    145. }
    146. }
    147. //坐标设置
    148. void OLED_Set_Pos(unsigned char x, unsigned char y)
    149. { OLED_WR_Byte(0xb0+y,OLED_CMD);
    150. OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
    151. OLED_WR_Byte((x&0x0f),OLED_CMD);
    152. }
    153. //开启OLED显示
    154. void OLED_Display_On(void)
    155. {
    156. OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
    157. OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
    158. OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
    159. }
    160. //关闭OLED显示
    161. void OLED_Display_Off(void)
    162. {
    163. OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
    164. OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
    165. OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
    166. }
    167. //清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
    168. void OLED_Clear(void)
    169. {
    170. u8 i,n;
    171. for(i=0;i<8;i++)
    172. {
    173. OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址(0~7)
    174. OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
    175. OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
    176. for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
    177. } //更新显示
    178. }
    179. void OLED_On(void)
    180. {
    181. u8 i,n;
    182. for(i=0;i<8;i++)
    183. {
    184. OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址(0~7)
    185. OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
    186. OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
    187. for(n=0;n<128;n++)OLED_WR_Byte(1,OLED_DATA);
    188. } //更新显示
    189. }
    190. //在指定位置显示一个字符,包括部分字符
    191. //x:0~127
    192. //y:0~63
    193. //mode:0,反白显示;1,正常显示
    194. //size:选择字体 16/12
    195. void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 Char_Size)
    196. {
    197. unsigned char c=0,i=0;
    198. c=chr-' ';//得到偏移后的值
    199. if(x>Max_Column-1){x=0;y=y+2;}
    200. if(Char_Size ==16)
    201. {
    202. OLED_Set_Pos(x,y);
    203. for(i=0;i<8;i++)
    204. OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
    205. OLED_Set_Pos(x,y+1);
    206. for(i=0;i<8;i++)
    207. OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
    208. }
    209. else {
    210. OLED_Set_Pos(x,y);
    211. for(i=0;i<6;i++)
    212. OLED_WR_Byte(F6x8[c][i],OLED_DATA);
    213. }
    214. }
    215. //m^n函数
    216. u32 oled_pow(u8 m,u8 n)
    217. {
    218. u32 result=1;
    219. while(n--)result*=m;
    220. return result;
    221. }
    222. //显示2个数字
    223. //x,y :起点坐标
    224. //len :数字的位数
    225. //size:字体大小
    226. //mode:模式 0,填充模式;1,叠加模式
    227. //num:数值(0~4294967295);
    228. void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
    229. {
    230. u8 t,temp;
    231. u8 enshow=0;
    232. for(t=0;t
    233. {
    234. temp=(num/oled_pow(10,len-t-1))%10;
    235. if(enshow==0&&t<(len-1))
    236. {
    237. if(temp==0)
    238. {
    239. OLED_ShowChar(x+(size2/2)*t,y,' ',size2);
    240. continue;
    241. }else enshow=1;
    242. }
    243. OLED_ShowChar(x+(size2/2)*t,y,temp+'0',size2);
    244. }
    245. }
    246. //显示一个字符号串
    247. void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 Char_Size)
    248. {
    249. unsigned char j=0;
    250. while (chr[j]!='\0')
    251. { OLED_ShowChar(x,y,chr[j],Char_Size);
    252. x+=8;
    253. if(x>120){x=0;y+=2;}
    254. j++;
    255. }
    256. }
    257. //显示汉字
    258. void OLED_ShowCHinese(u8 x,u8 y,u8 no)
    259. {
    260. u8 t,adder=0;
    261. OLED_Set_Pos(x,y);
    262. for(t=0;t<16;t++)
    263. {
    264. OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
    265. adder+=1;
    266. }
    267. OLED_Set_Pos(x,y+1);
    268. for(t=0;t<16;t++)
    269. {
    270. OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
    271. adder+=1;
    272. }
    273. }
    274. /***********功能描述:显示显示BMP图片128×64起始点坐标(x,y),x的范围0~127,y为页的范围0~7*****************/
    275. void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
    276. {
    277. unsigned int j=0;
    278. unsigned char x,y;
    279. if(y1%8==0) y=y1/8;
    280. else y=y1/8+1;
    281. for(y=y0;y
    282. {
    283. OLED_Set_Pos(x0,y);
    284. for(x=x0;x
    285. {
    286. OLED_WR_Byte(BMP[j++],OLED_DATA);
    287. }
    288. }
    289. }
    290. //初始化SSD1306
    291. void OLED_Init(void)
    292. {
    293. OLED_WR_Byte(0xAE,OLED_CMD);//--display off
    294. OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
    295. OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
    296. OLED_WR_Byte(0x40,OLED_CMD);//--set start line address
    297. OLED_WR_Byte(0xB0,OLED_CMD);//--set page address
    298. OLED_WR_Byte(0x81,OLED_CMD); // contract control
    299. OLED_WR_Byte(0xFF,OLED_CMD);//--128
    300. OLED_WR_Byte(0xA1,OLED_CMD);//set segment remap
    301. OLED_WR_Byte(0xA6,OLED_CMD);//--normal / reverse
    302. OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
    303. OLED_WR_Byte(0x3F,OLED_CMD);//--1/32 duty
    304. OLED_WR_Byte(0xC8,OLED_CMD);//Com scan direction
    305. OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset
    306. OLED_WR_Byte(0x00,OLED_CMD);//
    307. OLED_WR_Byte(0xD5,OLED_CMD);//set osc division
    308. OLED_WR_Byte(0x80,OLED_CMD);//
    309. OLED_WR_Byte(0xD8,OLED_CMD);//set area color mode off
    310. OLED_WR_Byte(0x05,OLED_CMD);//
    311. OLED_WR_Byte(0xD9,OLED_CMD);//Set Pre-Charge Period
    312. OLED_WR_Byte(0xF1,OLED_CMD);//
    313. OLED_WR_Byte(0xDA,OLED_CMD);//set com pin configuartion
    314. OLED_WR_Byte(0x12,OLED_CMD);//
    315. OLED_WR_Byte(0xDB,OLED_CMD);//set Vcomh
    316. OLED_WR_Byte(0x30,OLED_CMD);//
    317. OLED_WR_Byte(0x8D,OLED_CMD);//set charge pump enable
    318. OLED_WR_Byte(0x14,OLED_CMD);//
    319. OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
    320. }

    下面是oledfont.h的全部内容:

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

    下面是我的keil5的界面,能体现出各个文件的调用分部情况:

    这些内容是我花了好几天的时间才理清楚的,希望看到的小伙伴,给点个爱心,并转发出去,希望帮到更多的人,这个东西网上很难找的。谢谢!

  • 相关阅读:
    app毕业设计开题报告-基于Uniapp实现的移动端的医生挂号就诊平台
    论文解析——AMD EPYC和Ryzen处理器系列的开创性的chiplet技术和设计
    高并发场景下,6种方案,保证缓存和数据库的最终一致性!
    SpringBoot2.x简单集成Flowable
    [Bread.Mvc] 开源一款自用 MVC 框架,支持 Native AOT
    Spring Boot 打印日志文件
    Github每日精选(第42期):web前端自定义Alert窗口sweetalert
    SpringBoot Web开发----请求参数处理
    PostgreSQL设置主键从1开始自增
    不同色系的窗帘带来的含义也不一样 | 好佳居窗帘十大品牌
  • 原文地址:https://blog.csdn.net/xingyuncao520025/article/details/133461787