当前位置:   article > 正文

51单片机基础之OLED_oled_showchinese

oled_showchinese

取模软件的配置:

百度网盘 获取链接:

链接:https://pan.baidu.com/s/1rFjU00HDLwGi8WZsOY7jnA 
提取码:1234

代码:

  1. main.c文件
  2. #include "reg51.h"
  3. #include "oled.h"
  4. void main(void)
  5. {
  6. unsigned int t=1;
  7. OLED_Init(); //初始化OLED
  8. OLED_Clear(); //清屏函数
  9. while(1)
  10. {
  11. //这个函数显示中文
  12. OLED_ShowCHinese(0,0,0);////第一个形参是列,第二个是行,第三个是显示哪个中文,这里一个字占16
  13. OLED_ShowCHinese(18,0,1);//
  14. OLED_ShowCHinese(36,0,2);//
  15. OLED_ShowCHinese(54,0,3);//
  16. OLED_ShowCHinese(72,0,4);//
  17. OLED_ShowCHinese(90,0,5);//
  18. OLED_ShowCHinese(108,0,6);//
  19. //这个函数显示字符
  20. OLED_ShowString(6,3,"chenhaodong123.",16);//第一个形参表示第六行,第二个形参表示排,第三个表示写入的字符,第四个表示字体大小
  21. OLED_ShowString(0,6,"ASCII:",16);
  22. OLED_ShowString(63,6,"CODE:",16);
  23. //显示数字变量
  24. OLED_ShowNum(103,6,t,1,16); //第一个参数表示列,第二个参数表示行,第三个参数表示变量数字,第四个参数表示显示数字的位数,第五个参数表示字体大小
  25. // delay_ms(8000);
  26. }
  27. }
  1. oled.c文件
  2. #include "oled.h"
  3. #include "oledfont.h" //取模的中文库
  4. void delay_ms(unsigned int ms)
  5. {
  6. unsigned int a;
  7. while(ms)
  8. {
  9. a=1800;
  10. while(a--);
  11. ms--;
  12. }
  13. }
  14. /**********************************************
  15. //IIC Start
  16. **********************************************/
  17. void IIC_Start()
  18. {
  19. OLED_SCLK_Set() ;
  20. OLED_SDIN_Set();
  21. OLED_SDIN_Clr();
  22. OLED_SCLK_Clr();
  23. }
  24. /**********************************************
  25. //IIC Stop
  26. **********************************************/
  27. void IIC_Stop()
  28. {
  29. OLED_SCLK_Set() ;
  30. // OLED_SCLK_Clr();
  31. OLED_SDIN_Clr();
  32. OLED_SDIN_Set();
  33. }
  34. void IIC_Wait_Ack()
  35. {
  36. //GPIOB->CRH &= 0XFFF0FFFF; //设置PB12为上拉输入模式
  37. //GPIOB->CRH |= 0x00080000;
  38. // OLED_SDA = 1;
  39. // delay_us(1);
  40. //OLED_SCL = 1;
  41. //delay_us(50000);
  42. /* while(1)
  43. {
  44. if(!OLED_SDA) //判断是否接收到OLED 应答信号
  45. {
  46. //GPIOB->CRH &= 0XFFF0FFFF; //设置PB12为通用推免输出模式
  47. //GPIOB->CRH |= 0x00030000;
  48. return;
  49. }
  50. }
  51. */
  52. OLED_SCLK_Set() ;
  53. OLED_SCLK_Clr();
  54. }
  55. /**********************************************
  56. // IIC Write byte
  57. **********************************************/
  58. void Write_IIC_Byte(unsigned char IIC_Byte)
  59. {
  60. unsigned char i;
  61. unsigned char m,da;
  62. da=IIC_Byte;
  63. OLED_SCLK_Clr();
  64. for(i=0;i<8;i++)
  65. {
  66. m=da;
  67. // OLED_SCLK_Clr();
  68. m=m&0x80;
  69. if(m==0x80)
  70. {OLED_SDIN_Set();}
  71. else OLED_SDIN_Clr();
  72. da=da<<1;
  73. OLED_SCLK_Set();
  74. OLED_SCLK_Clr();
  75. }
  76. }
  77. /**********************************************
  78. // IIC Write Command
  79. **********************************************/
  80. void Write_IIC_Command(unsigned char IIC_Command)
  81. {
  82. IIC_Start();
  83. Write_IIC_Byte(0x78); //Slave address,SA0=0
  84. IIC_Wait_Ack();
  85. Write_IIC_Byte(0x00); //write command
  86. IIC_Wait_Ack();
  87. Write_IIC_Byte(IIC_Command);
  88. IIC_Wait_Ack();
  89. IIC_Stop();
  90. }
  91. /**********************************************
  92. // IIC Write Data
  93. **********************************************/
  94. void Write_IIC_Data(unsigned char IIC_Data)
  95. {
  96. IIC_Start();
  97. Write_IIC_Byte(0x78); //D/C#=0; R/W#=0
  98. IIC_Wait_Ack();
  99. Write_IIC_Byte(0x40); //write data
  100. IIC_Wait_Ack();
  101. Write_IIC_Byte(IIC_Data);
  102. IIC_Wait_Ack();
  103. IIC_Stop();
  104. }
  105. void OLED_WR_Byte(unsigned dat,unsigned cmd)
  106. {
  107. if(cmd)
  108. {
  109. Write_IIC_Data(dat);
  110. }
  111. else
  112. {
  113. Write_IIC_Command(dat);
  114. }
  115. }
  116. /********************************************
  117. // fill_Picture
  118. ********************************************/
  119. void fill_picture(unsigned char fill_Data)
  120. {
  121. unsigned char m,n;
  122. for(m=0;m<8;m++)
  123. {
  124. OLED_WR_Byte(0xb0+m,0); //page0-page1
  125. OLED_WR_Byte(0x00,0); //low column start address
  126. OLED_WR_Byte(0x10,0); //high column start address
  127. for(n=0;n<128;n++)
  128. {
  129. OLED_WR_Byte(fill_Data,1);
  130. }
  131. }
  132. }
  133. /***********************Delay****************************************/
  134. void Delay_50ms(unsigned int Del_50ms)
  135. {
  136. unsigned int m;
  137. for(;Del_50ms>0;Del_50ms--)
  138. for(m=6245;m>0;m--);
  139. }
  140. void Delay_1ms(unsigned int Del_1ms)
  141. {
  142. unsigned char j;
  143. while(Del_1ms--)
  144. {
  145. for(j=0;j<123;j++);
  146. }
  147. }
  148. //坐标设置
  149. void OLED_Set_Pos(unsigned char x, unsigned char y)
  150. { OLED_WR_Byte(0xb0+y,OLED_CMD);
  151. OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
  152. OLED_WR_Byte((x&0x0f),OLED_CMD);
  153. }
  154. //开启OLED显示
  155. void OLED_Display_On(void)
  156. {
  157. OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
  158. OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
  159. OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
  160. }
  161. //关闭OLED显示
  162. void OLED_Display_Off(void)
  163. {
  164. OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
  165. OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
  166. OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
  167. }
  168. //清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
  169. void OLED_Clear(void)
  170. {
  171. u8 i,n;
  172. for(i=0;i<8;i++)
  173. {
  174. OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址(0~7
  175. OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
  176. OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
  177. for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
  178. } //更新显示
  179. }
  180. void OLED_On(void)
  181. {
  182. u8 i,n;
  183. for(i=0;i<8;i++)
  184. {
  185. OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址(0~7
  186. OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
  187. OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
  188. for(n=0;n<128;n++)OLED_WR_Byte(1,OLED_DATA);
  189. } //更新显示
  190. }
  191. //在指定位置显示一个字符,包括部分字符
  192. //x:0~127
  193. //y:0~63
  194. //mode:0,反白显示;1,正常显示
  195. //size:选择字体 16/12
  196. void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 Char_Size)
  197. {
  198. unsigned char c=0,i=0;
  199. c=chr-' ';//得到偏移后的值
  200. if(x>Max_Column-1){x=0;y=y+2;}
  201. if(Char_Size ==16)
  202. {
  203. OLED_Set_Pos(x,y);
  204. for(i=0;i<8;i++)
  205. OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
  206. OLED_Set_Pos(x,y+1);
  207. for(i=0;i<8;i++)
  208. OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
  209. }
  210. else {
  211. OLED_Set_Pos(x,y);
  212. for(i=0;i<6;i++)
  213. OLED_WR_Byte(F6x8[c][i],OLED_DATA);
  214. }
  215. }
  216. //m^n函数
  217. u32 oled_pow(u8 m,u8 n)
  218. {
  219. u32 result=1;
  220. while(n--)result*=m;
  221. return result;
  222. }
  223. //显示2个数字
  224. //x,y :起点坐标
  225. //len :数字的位数
  226. //size:字体大小
  227. //mode:模式 0,填充模式;1,叠加模式
  228. //num:数值(0~4294967295);
  229. void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2)
  230. {
  231. u8 t,temp;
  232. u8 enshow=0;
  233. for(t=0;t<len;t++)
  234. {
  235. temp=(num/oled_pow(10,len-t-1))%10;
  236. if(enshow==0&&t<(len-1))
  237. {
  238. if(temp==0)
  239. {
  240. OLED_ShowChar(x+(size2/2)*t,y,' ',size2);
  241. continue;
  242. }else enshow=1;
  243. }
  244. OLED_ShowChar(x+(size2/2)*t,y,temp+'0',size2);
  245. }
  246. }
  247. //显示一个字符号串
  248. void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 Char_Size)
  249. {
  250. unsigned char j=0;
  251. while (chr[j]!='\0')
  252. { OLED_ShowChar(x,y,chr[j],Char_Size);
  253. x+=8;
  254. if(x>120){x=0;y+=2;}
  255. j++;
  256. }
  257. }
  258. //显示汉字
  259. void OLED_ShowCHinese(u8 x,u8 y,u8 no)
  260. {
  261. u8 t,adder=0;
  262. OLED_Set_Pos(x,y);
  263. for(t=0;t<16;t++)
  264. {
  265. OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
  266. adder+=1;
  267. }
  268. OLED_Set_Pos(x,y+1);
  269. for(t=0;t<16;t++)
  270. {
  271. OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
  272. adder+=1;
  273. }
  274. }
  275. /***********功能描述:显示显示BMP图片128×64起始点坐标(x,y),x的范围0127,y为页的范围07*****************/
  276. void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
  277. {
  278. unsigned int j=0;
  279. unsigned char x,y;
  280. if(y1%8==0) y=y1/8;
  281. else y=y1/8+1;
  282. for(y=y0;y<y1;y++)
  283. {
  284. OLED_Set_Pos(x0,y);
  285. for(x=x0;x<x1;x++)
  286. {
  287. OLED_WR_Byte(BMP[j++],OLED_DATA);
  288. }
  289. }
  290. }
  291. //初始化SSD1306
  292. void OLED_Init(void)
  293. {
  294. OLED_WR_Byte(0xAE,OLED_CMD);//--display off
  295. OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
  296. OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
  297. OLED_WR_Byte(0x40,OLED_CMD);//--set start line address
  298. OLED_WR_Byte(0xB0,OLED_CMD);//--set page address
  299. OLED_WR_Byte(0x81,OLED_CMD); // contract control
  300. OLED_WR_Byte(0xFF,OLED_CMD);//--128
  301. OLED_WR_Byte(0xA1,OLED_CMD);//set segment remap
  302. OLED_WR_Byte(0xA6,OLED_CMD);//--normal / reverse
  303. OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
  304. OLED_WR_Byte(0x3F,OLED_CMD);//--1/32 duty
  305. OLED_WR_Byte(0xC8,OLED_CMD);//Com scan direction
  306. OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset
  307. OLED_WR_Byte(0x00,OLED_CMD);//
  308. OLED_WR_Byte(0xD5,OLED_CMD);//set osc division
  309. OLED_WR_Byte(0x80,OLED_CMD);//
  310. OLED_WR_Byte(0xD8,OLED_CMD);//set area color mode off
  311. OLED_WR_Byte(0x05,OLED_CMD);//
  312. OLED_WR_Byte(0xD9,OLED_CMD);//Set Pre-Charge Period
  313. OLED_WR_Byte(0xF1,OLED_CMD);//
  314. OLED_WR_Byte(0xDA,OLED_CMD);//set com pin configuartion
  315. OLED_WR_Byte(0x12,OLED_CMD);//
  316. OLED_WR_Byte(0xDB,OLED_CMD);//set Vcomh
  317. OLED_WR_Byte(0x30,OLED_CMD);//
  318. OLED_WR_Byte(0x8D,OLED_CMD);//set charge pump enable
  319. OLED_WR_Byte(0x14,OLED_CMD);//
  320. OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
  321. }
  1. oled.h文件
  2. #include "reg51.h"
  3. #ifndef __OLED_H
  4. #define __OLED_H
  5. #define u8 unsigned char
  6. #define u32 unsigned int
  7. #define OLED_CMD 0 //写命令
  8. #define OLED_DATA 1 //写数据
  9. #define OLED_MODE 0
  10. sbit OLED_SCL=P3^2;//时钟 D0(SCLK?
  11. sbit OLED_SDIN=P3^3;//D1(MOSI) 数据
  12. #define OLED_CS_Clr() OLED_CS=0
  13. #define OLED_CS_Set() OLED_CS=1
  14. #define OLED_RST_Clr() OLED_RST=0
  15. #define OLED_RST_Set() OLED_RST=1
  16. #define OLED_DC_Clr() OLED_DC=0
  17. #define OLED_DC_Set() OLED_DC=1
  18. #define OLED_SCLK_Clr() OLED_SCL=0
  19. #define OLED_SCLK_Set() OLED_SCL=1
  20. #define OLED_SDIN_Clr() OLED_SDIN=0
  21. #define OLED_SDIN_Set() OLED_SDIN=1
  22. //OLED模式设置
  23. //0:4线串行模式
  24. //1:并行8080模式
  25. #define SIZE 16
  26. #define XLevelL 0x02
  27. #define XLevelH 0x10
  28. #define Max_Column 128
  29. #define Max_Row 64
  30. #define Brightness 0xFF
  31. #define X_WIDTH 128
  32. #define Y_WIDTH 64
  33. //-----------------OLED端口定义----------------
  34. void delay_ms(unsigned int ms);
  35. //OLED控制用函数
  36. void OLED_WR_Byte(unsigned dat,unsigned cmd);
  37. void OLED_Display_On(void);
  38. void OLED_Display_Off(void);
  39. void OLED_Init(void);
  40. void OLED_Clear(void);
  41. void OLED_DrawPoint(u8 x,u8 y,u8 t);
  42. void OLED_Fill(u8 x1,u8 y1,u8 x2,u8 y2,u8 dot);
  43. void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 Char_Size);
  44. void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size);
  45. void OLED_ShowString(u8 x,u8 y, u8 *p,u8 Char_Size);
  46. void OLED_Set_Pos(unsigned char x, unsigned char y);
  47. void OLED_ShowCHinese(u8 x,u8 y,u8 no);
  48. void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
  49. void Delay_50ms(unsigned int Del_50ms);
  50. void Delay_1ms(unsigned int Del_1ms);
  51. void fill_picture(unsigned char fill_Data);
  52. void Picture();
  53. void IIC_Start();
  54. void IIC_Stop();
  55. void Write_IIC_Command(unsigned char IIC_Command);
  56. void Write_IIC_Data(unsigned char IIC_Data);
  57. void Write_IIC_Byte(unsigned char IIC_Byte);
  58. void IIC_Wait_Ack();
  59. #endif
  1. oledfont.h文件
  2. #ifndef __OLEDFONT_H
  3. #define __OLEDFONT_H
  4. //常用ASCII表
  5. //偏移量32
  6. //ASCII字符集
  7. //偏移量32
  8. //大小:12*6
  9. /************************************6*8的点阵************************************/
  10. const unsigned char code F6x8[][6] =
  11. {
  12. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp
  13. 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// !
  14. 0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// "
  15. 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// #
  16. 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $
  17. 0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// %
  18. 0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// &
  19. 0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// '
  20. 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// (
  21. 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// )
  22. 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// *
  23. 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// +
  24. 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// ,
  25. 0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// -
  26. 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// .
  27. 0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// /
  28. 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
  29. 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1
  30. 0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2
  31. 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3
  32. 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4
  33. 0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5
  34. 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
  35. 0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7
  36. 0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8
  37. 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9
  38. 0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// :
  39. 0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ;
  40. 0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// <
  41. 0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// =
  42. 0x00, 0x00, 0x41, 0x22, 0x14, 0x08,// >
  43. 0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ?
  44. 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @
  45. 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A
  46. 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B
  47. 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C
  48. 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
  49. 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E
  50. 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F
  51. 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G
  52. 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
  53. 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I
  54. 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J
  55. 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K
  56. 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L
  57. 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M
  58. 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
  59. 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
  60. 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P
  61. 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
  62. 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R
  63. 0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S
  64. 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T
  65. 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
  66. 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
  67. 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W
  68. 0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X
  69. 0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y
  70. 0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z
  71. 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// [
  72. 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55,// 55
  73. 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,// ]
  74. 0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^
  75. 0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _
  76. 0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// '
  77. 0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a
  78. 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b
  79. 0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c
  80. 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d
  81. 0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e
  82. 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f
  83. 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g
  84. 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h
  85. 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i
  86. 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j
  87. 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k
  88. 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l
  89. 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m
  90. 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n
  91. 0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o
  92. 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p
  93. 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q
  94. 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r
  95. 0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s
  96. 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t
  97. 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
  98. 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
  99. 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
  100. 0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x
  101. 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y
  102. 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z
  103. 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines
  104. };
  105. /****************************************8*16的点阵************************************/
  106. const unsigned char code F8X16[]=
  107. {
  108. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
  109. 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
  110. 0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
  111. 0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
  112. 0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
  113. 0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
  114. 0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
  115. 0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
  116. 0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
  117. 0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
  118. 0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
  119. 0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
  120. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
  121. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
  122. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
  123. 0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
  124. 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
  125. 0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
  126. 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
  127. 0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
  128. 0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
  129. 0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
  130. 0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
  131. 0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
  132. 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
  133. 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
  134. 0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
  135. 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
  136. 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
  137. 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
  138. 0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
  139. 0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
  140. 0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
  141. 0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
  142. 0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
  143. 0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
  144. 0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
  145. 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
  146. 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
  147. 0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
  148. 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
  149. 0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
  150. 0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
  151. 0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
  152. 0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
  153. 0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
  154. 0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
  155. 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
  156. 0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
  157. 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
  158. 0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
  159. 0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
  160. 0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
  161. 0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
  162. 0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
  163. 0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
  164. 0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
  165. 0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
  166. 0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
  167. 0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
  168. 0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
  169. 0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
  170. 0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
  171. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
  172. 0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
  173. 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
  174. 0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
  175. 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
  176. 0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
  177. 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
  178. 0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
  179. 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
  180. 0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
  181. 0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
  182. 0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
  183. 0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
  184. 0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
  185. 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
  186. 0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
  187. 0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
  188. 0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
  189. 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
  190. 0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
  191. 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
  192. 0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
  193. 0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
  194. 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
  195. 0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
  196. 0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
  197. 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
  198. 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
  199. 0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
  200. 0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
  201. 0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
  202. 0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
  203. };
  204. //汉字
  205. unsigned char code Hzk[][32]={
  206. {0x00,0xFE,0x22,0x5A,0x86,0x08,0x88,0x68,0x18,0x0F,0xE8,0x08,0x08,0x08,0x08,0x00},
  207. {0x00,0xFF,0x04,0x08,0x07,0x20,0x11,0x0D,0x41,0x81,0x7F,0x01,0x05,0x09,0x30,0x00},/*"陈",0*/
  208. /* (16 X 16 , 宋体 )*/
  209. {0x10,0x60,0x02,0x8C,0x20,0x90,0x8E,0x88,0x88,0xFF,0x88,0x88,0x88,0x88,0x80,0x00},
  210. {0x04,0x04,0x7E,0x01,0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0xFC,0x00,0x00,0x00},/*"浩",1*/
  211. /* (16 X 16 , 宋体 )*/
  212. {0x00,0x08,0x88,0x48,0x28,0x18,0x0F,0xE8,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00},
  213. {0x00,0x20,0x11,0x09,0x05,0x41,0x81,0x7F,0x01,0x01,0x05,0x09,0x11,0x20,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. {0x80,0xA0,0x90,0x8E,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x88,0x88,0x80,0x80,0x00},
  219. {0x20,0x20,0x10,0x08,0x04,0x02,0x01,0xFF,0x01,0x02,0x04,0x08,0x10,0x20,0x20,0x00},/*"朱",4*/
  220. /* (16 X 16 , 宋体 )*/
  221. {0x00,0x80,0x60,0xF8,0x47,0x40,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00},
  222. {0x01,0x00,0x00,0xFF,0x40,0x40,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00},/*"佳",5*/
  223. /* (16 X 16 , 宋体 )*/
  224. {0x00,0x80,0x60,0xF8,0x07,0x00,0x1C,0xE0,0x01,0x06,0x00,0xE0,0x1E,0x00,0x00,0x00},
  225. {0x01,0x00,0x00,0xFF,0x00,0x80,0x40,0x20,0x13,0x0C,0x13,0x20,0x40,0x80,0x80,0x00},/*"仪",6*/
  226. /* (16 X 16 , 宋体 )*/
  227. };
  228. #endif

运行结果:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/309499
推荐阅读
相关标签
  

闽ICP备14008679号