<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁(yè) > 光電顯示 > 設(shè)計(jì)應(yīng)用 > 液晶顯示源程序代碼及相關(guān)注釋

          液晶顯示源程序代碼及相關(guān)注釋

          作者: 時(shí)間:2012-04-15 來(lái)源:網(wǎng)絡(luò) 收藏

          **************************************************
          *yj.c
          *連線圖:
          * DB0---DPROT.0 DB4---DPROT.4 RS-------------P2.5
          * DB1---DPROT.1 DB5---DPROT.5 RW-------------P2.6
          * DB2---DPROT.2 DB6---DPROT.6 E--------------P2.7
          * DB3---DPROT.3 DB7---DPROT.7 VLCD接10K可調(diào)電阻到GND*
          *80C51的晶振頻率為12MHz
          *程序
          ***************************************************/
          #include reg51.h
          #include

          #include

          #define DPORT P0
          #define uchar unsigned char
          sbit RS = P2^5;
          sbit RW = P2^6;
          sbit E = P2^7;

          uchar Xpos; //列方向地址指針
          uchar Ypos; //行方向地址指針


          #define NoDisp 0
          #define NoCur 1
          #define CurNoFlash 2
          #define CurFlash 3
          /*延時(shí)程序
          由Delay參數(shù)確定延遲時(shí)間
          */

          void LcdWcn(uchar);
          void LcdWc(uchar);
          void WriteChar(uchar);
          void LcdPos();
          void LcdWd(uchar);
          void LcdWdn(uchar);


          void mDelay(unsigned int Delay)
          { unsigned int i;
          for(;Delay>0;Delay--)
          { for(i=0;i124;i++)
          {;}
          }
          }

          /*光標(biāo)設(shè)置命令
          Cur 為設(shè)定光標(biāo)參數(shù)
          */
          void SetCur(uchar Cur)
          { switch(Cur)
          { case 0x0:
          { LcdWc(0x08); //關(guān)顯示
          break;
          }
          case 0x1:
          { LcdWc(0x0c); //開顯示但無(wú)光標(biāo)
          break;
          }
          case 0x2:
          { LcdWc(0x0e); //開顯示有光標(biāo)但不閃爍
          break;
          }
          case 0x3:
          { LcdWc(0x0f); //開顯示有光標(biāo)且閃爍
          break;
          }
          default: break;
          }
          }
          /*清屏命令
          */
          void ClrLcd()
          { LcdWc(0x01);
          }
          /*在指定的行與列顯示
          */
          void WriteChar(uchar c)
          { LcdPos();
          LcdWd(c);
          }
          /*正常讀寫操作之前檢測(cè)LCD控制器
          */
          void WaitIdle()
          { uchar tmp;
          DPORT=0xff;
          RS=0;
          RW=1;
          E=1;
          _nop_();
          for(;;)
          { tmp=DPORT;
          tmp=0x80;
          if(tmp==0)
          break;
          }
          E=0;
          }

          /*不檢測(cè)忙的寫字符子程序
          */
          void LcdWdn(uchar c)
          {
          RS=1;
          RW=0;
          DPORT=c; //寫入待寫字符
          E=1;
          _nop_();


          上一頁(yè) 1 2 下一頁(yè)

          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();