欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 3103|回復(fù): 1
收起左側(cè)

12864中文測(cè)試 (帶字庫(kù))

[復(fù)制鏈接]
ID:71259 發(fā)表于 2014-12-30 00:51 | 顯示全部樓層 |閱讀模式
  1. #include <REG51.H>
  2. #include <intrins.h>
  3. #define uint unsigned int
  4. #define uchar unsigned char
  5. //延時(shí)子程序模塊
  6. //**********************************************
  7. void mdelay(uint delay)
  8. { uint i;
  9.   for(;delay>0;delay--)
  10.      {for(i=0;i<80;i++) //1ms延時(shí).
  11.          {;}
  12.      }
  13. }

  14. //************************************************

  15. void show();   //液晶顯示程序
  16. //****************************************
  17. //12864液晶顯示部分子程序模塊
  18. //****************************************
  19. sbit rs  = P2^0;
  20. sbit rw  = P2^1;
  21. sbit e   = P2^2;
  22. #define lcddata P0
  23. sbit busy=P0^7;   //lcd busy bit
  24. void wr_d_lcd(uchar content);
  25. void wr_i_lcd(uchar content);
  26. void clrram_lcd (void);
  27. void init_lcd(void);
  28. void busy_lcd(void);
  29. void rev_row_lcd(uchar row);
  30. void rev_co_lcd(uchar row,uchar col,uchar mode);
  31. void clr_lcd(void);
  32. void wr_co_lcd(uchar row,uchar col,uchar lcddata1,uchar lcddtta2);
  33. void wr_row_lcd(uchar row,char *p);
  34. //**********************************
  35. //液晶初始化
  36. //**********************************
  37. void init_lcd(void)
  38. {
  39. wr_i_lcd(0x06);  /*光標(biāo)的移動(dòng)方向*/
  40. wr_i_lcd(0x0c);  /*開顯示,關(guān)游標(biāo)*/
  41. }
  42. //***********************************
  43. //填充液晶DDRAM全為空格
  44. //**********************************
  45. void clrram_lcd (void)
  46. {
  47. wr_i_lcd(0x30);
  48. wr_i_lcd(0x01);
  49. }
  50. //***********************************
  51. //對(duì)液晶寫數(shù)據(jù)
  52. //content為要寫入的數(shù)據(jù)
  53. //***********************************
  54. void wr_d_lcd(uchar content)
  55. {
  56. busy_lcd();
  57. rs=1;
  58.     rw=0;
  59. lcddata=content;
  60. e=1;
  61. ;
  62. e=0;
  63. }
  64. //********************************
  65. //對(duì)液晶寫指令
  66. //content為要寫入的指令代碼
  67. //*****************************
  68. void wr_i_lcd(uchar content)
  69. {
  70. busy_lcd();
  71. rs=0;
  72.     rw=0;
  73. lcddata=content;
  74. e=1;
  75. ;
  76. e=0;
  77. }
  78. //********************************
  79. //液晶檢測(cè)忙狀態(tài)
  80. //在寫入之前必須執(zhí)行
  81. //********************************
  82. void busy_lcd(void)
  83. {
  84.   lcddata=0xff;
  85.   rs=0;
  86.   rw=1;
  87.   e =1;
  88.   while(busy==1);
  89.   e =0;
  90. }
  91. //********************************
  92. //指定要顯示字符的坐標(biāo)
  93. //*******************************
  94. void gotoxy(unsigned char y, unsigned char x)
  95. {
  96. if(y==1)
  97.   wr_i_lcd(0x80|x);
  98. if(y==2)
  99.         wr_i_lcd(0x90|x);
  100. if(y==3)
  101.   wr_i_lcd((0x80|x)+8);
  102. if(y==4)
  103.         wr_i_lcd((0x90|x)+8);
  104. }
  105. //**********************************
  106. //液晶顯示字符串程序
  107. //**********************************
  108. void print(uchar *str)
  109. {
  110. while(*str!='\0')
  111. {
  112.   wr_d_lcd(*str);
  113.   str++;
  114. }
  115. }

  116. //***************************************
  117. //液晶顯示主程序模塊
  118. //***************************************
  119. void show()  
  120. {

  121.   gotoxy(1,0);
  122.   print("歡迎光臨銳志電子");
  123.     mdelay(200);            
  124.   gotoxy(2,0);
  125.   print("【銳志電子】");
  126.   mdelay(200);                 //掃描延時(shí)

  127. gotoxy(3,0);
  128.   print("WWWwwwwwwwwwww");
  129.   mdelay(200);                 //掃描延時(shí)
  130. gotoxy(4,0);
  131.   print("12864 液晶測(cè)試");
  132.   mdelay(200);                 //掃描延時(shí)
  133. }


  134. //************************************
  135. //主程序
  136. //*************************************
  137. main()
  138. {

  139. init_lcd();
  140. clrram_lcd();

  141. while(1)
  142. {  
  143.       
  144.             show();                //液晶顯示數(shù)據(jù)
  145.             
  146.    }  

  147. }

復(fù)制代碼


回復(fù)

使用道具 舉報(bào)

ID:73187 發(fā)表于 2015-2-3 17:22 | 顯示全部樓層
不知樓主可否有興趣弄串行的
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表