找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3857|回复: 0
打印 上一主题 下一主题
收起左侧

基于LPC2131的OCMJ4X8C 液晶驱动程序

[复制链接]
跳转到指定楼层
楼主
ID:71407 发表于 2015-1-1 17:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
延时大就非常稳定,但是执行速度却下来了,延时小却不大稳定。最后终于把延时时间给调的合适而使其达到执行速度快而且稳定的效果。注意由于LPC2131是3.3V的电压,而OCMJ4X8C是5V供电,因此两者最好共地,在条件允许的情况下,可以给LPC2131和OCMJ4X8C的接口加一个3.3V转5V的电平转换电路,使其更加稳定,不加亦可。
  1. //=====================================================================
  2. //                    OCMJ4X8C 液晶驱动程序(串行)
  3. //硬件连接: CS --P0^4;  
  4. //          STD --P0^5;   
  5. //          SCLK--P0^6;   
  6. //          PSB --VSS;   
  7. //          RST --VDD;
  8. //          VDD--逻辑电源(+5V)
  9. //          VSS--GND(0V)
  10. //ocm4x8c(串).c
  11. //writer:谷雨 2008年8月2日于EDA实验室
  12. //说明:   修改端口的时候只需修改定义口以及函数void Lcd_IO_Inti (void)即可
  13. //=====================================================================
  14. #include "config.h"
  15. #define comm 0
  16. #define dat   1
  17. #define x1    0x80
  18. #define x2    0x88
  19. #define y     0x80
  20. //**************************修改硬件时要修改的部分********************************
  21. /*定义CS控制*/
  22. #define Lcd_CS        4            //串行口使能,高电平有效(作RS时,1为数据,0为指令)
  23. #define Set_CS()      IO0SET =1<<Lcd_CS
  24. #define Clr_CS()      IO0CLR =1<<Lcd_CS
  25. /*定义STD控制*/
  26. #define Lcd_STD       5            //串口数据(作R/W时,1为读,0为写)        
  27. #define Set_STD()     IO0SET =1<<Lcd_STD
  28. #define Clr_STD()     IO0CLR =1<<Lcd_STD
  29. /*定义SCLK控制*/
  30. #define Lcd_SCLK      6           //串口时钟,高电平有效
  31. #define Set_SCLK()    IO0SET =1<<Lcd_SCLK
  32. #define Clr_SCLK()    IO0CLR =1<<Lcd_SCLK
  33. //**************************函数定义********************************
  34. static void Delay_1(uint32 time);
  35. static void wr_lcd (uint8 dat_comm,uint8 content);
  36. extern void Lcd_IO_Inti(void);
  37. extern void Lcd_Inti(void);
  38. extern void set_position(uint8 xx,uint8 yy);
  39. extern void send_str(uint8 const *cc);
  40. extern void send_disp (uint8 const *img);
  41. extern void send_img1(uint8 const *img);
  42. extern void lat_disp (uint8 data1,uint8 data2);
  43. extern void con_disp (uint8 data1,uint8 data2,uint8 x0,uint8 y0,uint8 xl,uint8 yl);
  44. extern void con_disp_line (uint8 line);
  45. extern void clear (void);
  46. extern void clear_line(uint8 line);
  47. extern void clear_point(uint8 line,uint8 row);
  48. //======================================================
  49. // 函数名称 : Delay_1()
  50. // 函数功能 : 1微秒延时
  51. // 入口参数 : time   延时的毫秒数
  52. // 出口参数 : 无
  53. //======================================================
  54. void Delay_1(uint32 time)  
  55. {
  56. while(time--);
  57. }
  58. //=================================================================
  59. // 函数名称 :void Lcd_IO_Inti (void)
  60. // 函数功能 :实现lcd IO 口初始化
  61. // 入口参数 :无
  62. // 出口参数 :无
  63. //=================================================================
  64. void Lcd_IO_Inti(void)
  65. {
  66. PINSEL0&=(~0x3f00);
  67. IO0DIR|= (1<<Lcd_CS) | (1<<Lcd_STD) | (1<<Lcd_SCLK);    //设置Lcd_CS,Lcd_STD,Lcd_SCLK为输出
  68. IO0CLR = (1<<Lcd_CS) | (1<<Lcd_STD) | (1<<Lcd_SCLK);    //Lcd_CS,Lcd_STD,Lcd_SCLK置低消除影响
  69. }
  70. //=================================================================
  71. // 函数名称 :void Lcd_Inti(void)
  72. // 函数功能 :实现lcd初始化
  73. // 入口参数 :无
  74. // 出口参数 :无
  75. //=================================================================
  76. void Lcd_Inti(void)
  77. {
  78. wr_lcd (comm,0x30); //30---基本指令动作
  79. wr_lcd (comm,0x01); //清屏,地址指针指向00H
  80. Delay_1 (0xffff); //清屏需较长时间
  81. wr_lcd (comm,0x06); //光标的移动方向
  82.     wr_lcd (comm,0x0c); //显示打开,光标关,反白关
  83. }
  84. //=================================================================
  85. //函数名:void set_position(uint8 xx,uint8 yy)
  86. //函数功能: 设定显示坐标
  87. //入口参数:xx yy   
  88. //         xx:0~3   yy:0~7
  89. //出口参数:无
  90. //=================================================================
  91. void set_position(uint8 xx,uint8 yy) //坐标   
  92. {
  93.    uint8 line;
  94.    wr_lcd (comm,0x30); //30---基本指令动作
  95.    switch(xx)
  96.    {
  97.      case 0:line=0x00;break;
  98.      case 1:line=0x10;break;
  99.      case 2:line=0x08;break;
  100.      case 3:line=0x18;break;
  101.      default:break;
  102.    }
  103.    wr_lcd(comm,0x80+line+yy);    //设定地址
  104. }
  105. //=================================================================
  106. //函数名:void send_str(uint8 *cc)
  107. //函数功能: 显示汉字或是字符
  108. //入口参数:*cc
  109. //出口参数:无  
  110. //注意:注意为全角字符,即每个字符占十六个字节
  111. //     显示汉字或者字符时先设定显示坐标,最多显示8个汉字         
  112. //=================================================================
  113. void send_str(uint8 const *cc)
  114. {
  115.    uint8 i;
  116.    wr_lcd (comm,0x30);
  117.    for(i=0;(i<16)&&*(cc+i);i++)
  118.      wr_lcd(dat,*(cc+i));
  119. }
  120. //=================================================================
  121. //函数名:void send_disp (uint8 const *img)
  122. //函数功能: 显示图形
  123. //入口参数:uchar code *img   
  124. //出口参数:无
  125. //注意:显示图形时先写第一行数据,依次向后
  126. //=================================================================
  127. void send_disp (uint8 const *img)
  128. {
  129. uint8 i,j;
  130. for(j=0;j<32;j++)      //上半屏写入图形数据
  131. {
  132.     for(i=0;i<8;i++)
  133.     {
  134.       wr_lcd (comm,0x34); //8位控制端口,选择扩充指令集
  135.       wr_lcd (comm,y+j); //选择图形区Y轴坐标
  136.       wr_lcd (comm,x1+i); //选择图形区X轴坐标
  137.       wr_lcd (comm,0x30); //选择基本指令集
  138.       wr_lcd (dat,img[j*16+i*2]); //写图形数据
  139.       wr_lcd (dat,img[j*16+i*2+1]);
  140.     }
  141. }
  142. for(j=32;j<64;j++)    //下半屏写入图形数据
  143. {
  144.     for(i=0;i<8;i++)
  145.     {
  146.       wr_lcd (comm,0x34);
  147.       wr_lcd (comm,y+j-32);
  148.       wr_lcd (comm,x2+i);
  149.       wr_lcd (comm,0x30);
  150.       wr_lcd (dat,img[j*16+i*2]);
  151.       wr_lcd (dat,img[j*16+i*2+1]);
  152.     }
  153. }
  154. wr_lcd (comm,0x36);   //写入数据后选择图形显示
  155. }
  156. //=================================================================
  157. //函数名:void send_img1(uint8 const *img)
  158. //函数功能: 下半屏显示图形
  159. //入口参数:uchar code *img
  160. //出口参数:无   
  161. //=================================================================
  162. void send_img1(uint8 const *img)
  163. {
  164. uint8 i,j;
  165. for(j=0;j<32;j++)
  166. {
  167.     for(i=0;i<8;i++)
  168.     {
  169.       wr_lcd (comm,0x34);  
  170.       wr_lcd (comm,y+j);  
  171.       wr_lcd (comm,x2+i);  
  172.       wr_lcd (comm,0x30);  
  173.       wr_lcd (dat,img[j*16+i*2]);  
  174.       wr_lcd (dat,img[j*16+i*2+1]);
  175.     }
  176. }
  177. wr_lcd (comm,0x36);
  178. }
  179. //=================================================================
  180. //函数名:void lat_disp (uint8 data1,uint8 data2)
  181. //函数功能:显示点阵
  182. //入口参数:uchar data1 奇数行显示的点阵
  183. //         uchar data2 偶数行显示的点阵
  184. //出口参数:无
  185. //=================================================================
  186. void lat_disp (uint8 data1,uint8 data2)
  187. {
  188. uint8 i,j,k,x;
  189. x=x1;
  190. for(k=0;k<2;k++)
  191. {
  192.     for(j=0;j<16;j++)
  193.     {
  194.       for(i=0;i<8;i++)
  195.       {
  196.         wr_lcd (comm,0x34);    //8位控制端口,选择扩充指令集
  197.         wr_lcd (comm,y+j*2);   //Y轴
  198.         wr_lcd (comm,x+i);    //X轴
  199.         wr_lcd (comm,0x30);    //选择基本指令集
  200.         wr_lcd (dat,data1);    //写入数据
  201.         wr_lcd (dat,data1);
  202.       }
  203.       for(i=0;i<8;i++)
  204.       {
  205.         wr_lcd (comm,0x34);
  206.         wr_lcd (comm,y+j*2+1);
  207.         wr_lcd (comm,x+i);
  208.         wr_lcd (comm,0x30);
  209.         wr_lcd (dat,data2);
  210.         wr_lcd (dat,data2);
  211.       }
  212.     }
  213.     x=x2;
  214. }
  215. wr_lcd (comm,0x36);   //写入数据后选择显示
  216. }
  217. //=================================================================
  218. //函数名:void con_disp (uchar data1,uchar data2,uchar x0,uchar y0,uchar xl,uchar yl)
  219. //函数功能:反白显示
  220. //入口参数:data1,data2,x0,y0,x1,y1
  221. //     当data1=0xff,data2=0xff时,在x0,y0处开始反白显示区域为16*xl*yl.
  222. //出口参数:无
  223. //=================================================================
  224. void con_disp (uint8 data1,uint8 data2,uint8 x0,uint8 y0,uint8 xl,uint8 yl)
  225. {
  226. uint8 i,j;
  227. for(j=0;j<yl;j++)
  228. {
  229.     for(i=0;i<xl;i++)
  230.     {
  231.       wr_lcd (comm,0x34);
  232.       wr_lcd (comm,y0+j);
  233.       wr_lcd (comm,x0+i);
  234.       wr_lcd (comm,0x30);
  235.       wr_lcd (dat,data1);
  236.       wr_lcd (dat,data2);
  237.     }
  238. }
  239. wr_lcd (comm,0x36);
  240. }

  241. //=================================================================
  242. //函数名:void con_disp_line (uint8 line)
  243. //函数功能:选择某行反白显示
  244. //入口参数:line
  245. //         line为1或者2,1选择1、3行反白显示,2选择2、4行反白显示
  246. //出口参数:无
  247. //=================================================================
  248. void con_disp_line (uint8 line)
  249. {
  250.      uint8 a;
  251.      wr_lcd (comm,0x34); //8位控制端口,选择扩充指令集
  252. switch(line)
  253. {
  254.        case 1:a=0x04;break;
  255.        case 2:a=0x05;break;
  256.        default:break;
  257.      }
  258. wr_lcd (comm,a);     //反白选择
  259. Delay_1(0xffff);
  260. wr_lcd (comm,0x36);   //显示
  261. }
  262. //=================================================================
  263. //函数名:void clear()
  264. //函数功能:清屏
  265. //入口参数:无
  266. //出口参数:无
  267. //=================================================================
  268. void clear (void)
  269. {
  270. wr_lcd (comm,0x30);   //选择基本指令集
  271. wr_lcd (comm,0x01);   //清屏
  272. Delay_1(0xffff);     //延时
  273. }
  274. //=================================================================
  275. //函数名:void clear_line(uint8 line)
  276. //函数功能:清除一行
  277. //入口参数: line 0~3
  278. //出口参数:无
  279. //=================================================================
  280. void clear_line(uint8 line) //清除一行(0~3行)
  281. {
  282. uint8 i;
  283. set_position(line,0);
  284. for(i=0;i<16;i++)
  285.     wr_lcd (dat,0x20);//填充空格
  286. }
  287. //=================================================================
  288. //函数名:void clear_point(uint8 line,uint8 row)
  289. //函数功能:清除一点
  290. //入口参数: line 选择的行
  291. //          row 选择的列
  292. //出口参数:无
  293. //=================================================================
  294. void clear_point(uint8 line,uint8 row)
  295. {
  296. set_position(line,row);
  297. wr_lcd (dat,0x20);//填充空格
  298. wr_lcd (dat,0x20);
  299. }
  300. //=================================================================
  301. // 函数名称 :void wr_lcd (uint8 dat_comm,uint8 content)
  302. // 函数功能 :向lcd中写数据或者指令
  303. // 入口参数 :dat_comm 选择是写数据或者写指令位
  304. //            content    dat_comm为1时写数据,否则写指令
  305. // 出口参数 :无
  306. //=================================================================
  307. void wr_lcd (uint8 dat_comm,uint8 content)
  308. {
  309. uint8 i,j;
  310. Clr_SCLK();
  311. Set_CS();
  312. Delay_1(1);
  313. Set_STD();
  314. for(i=0;i<5;i++)    //写入5个1,作为启动位
  315. {
  316.    Set_SCLK();
  317.    Delay_1(1);
  318.    Clr_SCLK();
  319.    Delay_1(1);
  320. }
  321. Clr_STD();
  322. Set_SCLK();
  323. Delay_1(1);
  324. Clr_SCLK();
  325. Delay_1(1);
  326. if(dat_comm)    //判断写数据还是指令
  327. {
  328.    Set_STD();   //data
  329. }
  330. else
  331. {
  332.    Clr_STD();    //command
  333. }
  334. Set_SCLK();
  335. Delay_1(1);
  336. Clr_SCLK();
  337. Delay_1(1);
  338. Clr_STD();       //写入1个0
  339. Set_SCLK();
  340. Delay_1(1);
  341. Clr_SCLK();
  342. Delay_1(1);
  343. for(j=0;j<2;j++)
  344. {
  345.    for(i=0;i<4;i++)     //分别写入高四位和低四位
  346.    {
  347.     if(content&0x80)   
  348.     {
  349.      Set_STD();
  350.     }
  351.     else
  352.     {
  353.      Clr_STD();
  354.     }
  355.     Set_SCLK();
  356.     Delay_1(1);
  357.     Clr_SCLK();
  358.     Delay_1(1);
  359.     content<<=1;
  360.    }
  361.    Clr_STD();
  362.    for(i=0;i<4;i++)        //写入4个0
  363.    {
  364.     Set_SCLK();
  365.     Delay_1(1);
  366.     Clr_SCLK();
  367.     Delay_1(1);
  368.    }
  369. }
  370. Clr_CS();
  371. Delay_1(1);
  372. }
  373. uint8 const tab5[]={
  374. /*-- 宽度x高度=128x64 --*/
  375. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  376. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  377. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  378. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  379. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  380. 0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x80,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,
  381. 0x00,0x00,0x00,0x00,0x0C,0x43,0x01,0x80,0x00,0x7F,0xFF,0xF0,0x00,0x00,0x00,0x00,
  382. 0x00,0x00,0x00,0x00,0x19,0xFF,0x07,0x00,0x07,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,
  383. 0x00,0x00,0x00,0x01,0x3F,0xFC,0x1E,0x00,0x1F,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,
  384. 0x00,0x00,0x00,0x01,0xBF,0xFF,0xFC,0x00,0x7F,0xFC,0x00,0x7F,0xC0,0x00,0x00,0x00,
  385. 0x00,0x00,0x00,0x01,0xFF,0xFF,0xF0,0x00,0xFF,0xC0,0x00,0x0F,0xE0,0x00,0x00,0x00,
  386. 0x00,0x00,0x00,0x01,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xFC,0x01,0xF0,0x00,0x00,0x00,
  387. 0x00,0x00,0x00,0x01,0xDF,0xFF,0xC0,0x07,0xFF,0xFF,0xFF,0x80,0xF0,0x00,0x00,0x00,
  388. 0x00,0x00,0x00,0x03,0xFF,0xFF,0x00,0x0F,0xFF,0xFF,0xFF,0xE0,0x38,0x00,0x00,0x00,
  389. 0x00,0x00,0x00,0x07,0xFF,0xF8,0x00,0x1F,0xFF,0xF0,0x03,0xF8,0x38,0x00,0x00,0x00,
  390. 0x00,0x00,0x00,0x07,0xFF,0xE0,0x00,0x3F,0xFF,0xFF,0xC0,0x7C,0x18,0x00,0x00,0x00,
  391. 0x00,0x00,0x00,0x04,0x7F,0xF0,0x00,0x3F,0xFF,0xFF,0xF8,0x1E,0x08,0x00,0x00,0x00,
  392. 0x00,0x00,0x00,0x01,0xFF,0xF8,0x00,0x7F,0xFF,0xFF,0xFE,0x0F,0x08,0x00,0x00,0x00,
  393. 0x00,0x00,0x00,0x0F,0xFF,0xFC,0x00,0xFF,0xFF,0xFF,0xFF,0x87,0x08,0x00,0x00,0x00,
  394. 0x00,0x00,0x00,0x1F,0xFF,0xFE,0x00,0xFF,0xFF,0xFF,0xFF,0x83,0x88,0x00,0x00,0x00,
  395. 0x00,0x00,0x00,0x3F,0xFF,0xFE,0x01,0xFF,0xFF,0xFF,0xFF,0xC3,0x88,0x00,0x00,0x00,
  396. 0x00,0x00,0x00,0x7F,0xFF,0xFE,0x01,0xFF,0xFF,0xFF,0xFF,0xE1,0x88,0x00,0x00,0x00,
  397. 0x00,0x00,0x00,0xFF,0xFF,0xFE,0x03,0xFF,0xFF,0xFF,0xFF,0xE1,0x88,0x00,0x00,0x00,
  398. 0x00,0x00,0x01,0xFF,0xFF,0xFE,0x03,0xFF,0xFF,0xFF,0xFF,0xF1,0x88,0x00,0x00,0x00,
  399. 0x00,0x00,0x01,0xFF,0xFF,0xFE,0x03,0xFF,0xFF,0xFF,0xFF,0xF3,0x08,0x00,0x00,0x00,
  400. 0x00,0x00,0x01,0xFF,0xFF,0xFF,0x07,0xFF,0xFF,0xFF,0xFF,0xF2,0x10,0x00,0x00,0x00,
  401. 0x00,0x00,0x01,0xFF,0xFF,0xFF,0x8F,0xFF,0xFF,0xFF,0xFF,0xF0,0x20,0x00,0x00,0x00,
  402. 0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,
  403. 0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x70,0x00,0x00,0x00,0x00,
  404. 0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x70,0x00,0x00,0x00,0x00,
  405. 0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x70,0x00,0x00,0x00,0x00,
  406. 0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0x7F,0x20,0x00,0x00,0x00,0x00,
  407. 0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xBF,0xFF,0x7F,0x20,0x00,0x00,0x00,0x00,
  408. 0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xDF,0xFF,0x7E,0x20,0x00,0x00,0x00,0x00,
  409. 0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xDF,0xFF,0x3E,0x40,0x00,0x00,0x00,0x00,
  410. 0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xCF,0xFF,0x3C,0x40,0x00,0x00,0x00,0x00,
  411. 0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xCF,0xFE,0x38,0x40,0x00,0x00,0x00,0x00,
  412. 0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,0x8F,0xFE,0x38,0x40,0x00,0x00,0x00,0x00,
  413. 0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF,0x8F,0xFE,0x30,0x40,0x00,0x00,0x00,0x00,
  414. 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x1F,0x7C,0x20,0x40,0x00,0x00,0x00,0x00,
  415. 0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFE,0x1E,0x78,0x00,0x40,0x00,0x00,0x00,0x00,
  416. 0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFE,0x1E,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
  417. 0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xDA,0x3C,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
  418. 0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xF2,0x30,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
  419. 0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xF1,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  420. 0x00,0x00,0x00,0x00,0x00,0xFE,0x7F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  421. 0x00,0x00,0x00,0x00,0x00,0x7C,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  422. 0x00,0x00,0x00,0x00,0x00,0x78,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  423. 0x00,0x00,0x00,0x00,0x00,0x72,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  424. 0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  425. 0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  426. 0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  427. 0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  428. 0x00,0x00,0x00,0x00,0x01,0x40,0x04,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  429. 0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  430. 0x00,0x00,0x00,0x00,0x02,0x0C,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  431. 0x00,0x00,0x00,0x00,0x02,0x40,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  432. 0x00,0x00,0x00,0x00,0x0C,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  433. 0x00,0x00,0x00,0x00,0x38,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  434. 0x00,0x00,0x00,0x0F,0xE2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  435. 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  436. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  437. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  438. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
  439. };
  440. //=================================================================
  441. //函数名:   int main (void)
  442. //函数功能: 主函数,用于测试,无实际意义
  443. //入口参数: 无
  444. //出口参数:无
  445. //=================================================================
  446. int main (void)
  447. {
  448. uint8 const tab[]={"中华人名共和国"};
  449. Delay_1(0x1fffff);
  450. Lcd_IO_Inti();       //初始化
  451. Lcd_Inti();
  452. while(1)
  453. {
  454.    clear();
  455.    lat_disp (0x00,0x00);
  456.    Delay_1(0x1fffff);
  457.    set_position(0,0);    //显示汉字
  458.    send_str(tab);
  459.    set_position(1,0);
  460.    send_str(tab);
  461.    set_position(2,0);
  462.    send_str(tab);
  463.    Delay_1(0x1fffff);
  464.    clear_point(0,1);     //清除一点  
  465.    Delay_1(0x1fffff);
  466.    con_disp (0xff,0xff,0x8c,0x80,2,16);   //区域反白显示
  467.    Delay_1(0x6fffff);
  468.    con_disp_line(2);        //行反白显示
  469.    Delay_1(0x6fffff);
  470.    clear_line(1);            //清除一行
  471.    Delay_1(0x6fffff);
  472.    clear();
  473.    Delay_1(0x1fffff);
  474.    lat_disp (0xcc,0xcc);     //显示点阵
  475.    Delay_1(0x1fffff);
  476.    clear();
  477.    lat_disp (0x00,0x00);
  478.    Delay_1(0x1fffff);
  479.    clear();
  480.    lat_disp (0xff,0x00);    //显示点阵
  481.    Delay_1(0x1fffff);
  482.    clear();
  483.    send_disp(tab5);         //显示图像
  484.    Delay_1(0x6fffff);
  485. }
  486.     return 0;
  487. }
复制代码



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表