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

          新聞中心

          51單片機lcd1602

          作者: 時間:2016-11-13 來源:網(wǎng)絡 收藏
          {

          Uchar i;

          for (i=0;i<16;i++)
          {

          本文引用地址:http://www.ex-cimer.com/article/201611/316333.htm

          DispOneChar(i,1,dd++);

          dd &= 0x7f;
          if (dd<32) dd=32;
          }
          }

          // 顯示光標定位
          void LocateXY( char posx,char posy)
          {

          Uchar temp;

          temp = posx & 0xf;
          posy &= 0x1;
          if ( posy )temp |= 0x40;
          temp |= 0x80;
          LcdWriteCommand(temp,0);
          }

          // 按指定位置顯示數(shù)出一個字符
          void DispOneChar(Uchar x,Uchar y,Uchar Wdata)
          {
          LocateXY( x, y ); // 定位顯示地址
          LcdWriteData( Wdata ); // 寫字符
          }

          // 初始化程序, 必須按照產(chǎn)品資料介紹的初始化過程進行
          void LcdReset( void ) {

          LcdWriteCommand( 0x38, 0); // 顯示模式設置(不檢測忙信號)
          Delay5Ms();
          LcdWriteCommand( 0x38, 0); // 共三次
          Delay5Ms();
          LcdWriteCommand( 0x38, 0);
          Delay5Ms();

          LcdWriteCommand( 0x38, 1); // 顯示模式設置(以后均檢測忙信號)
          LcdWriteCommand( 0x08, 1); // 顯示關閉
          LcdWriteCommand( 0x01, 1); // 顯示清屏
          LcdWriteCommand( 0x06, 1); // 顯示光標移動設置
          LcdWriteCommand( 0x0c, 1); // 顯示開及光標設置
          }

          // 寫控制字符子程序: E=1 RS=0 RW=0

          void LcdWriteCommand( Uchar CMD,Uchar AttribC ) {

          if (AttribC) while( Lcd1602StatusPort & Busy ); // 檢測忙信號?
          Lcd1602CmdPort = CMD;
          }

          // 當前位置寫字符子程序: E =1 RS=1 RW=0
          void LcdWriteData( char dataW ) {

          while( Lcd1602StatusPort & Busy ); // 檢測忙信號
          Lcd1602WdataPort = dataW;
          }

          // 短延時
          void Delay5Ms(void)
          {
          Uint i = 5552;
          while(i--);
          }

          //長延時
          void Delay400Ms(void)
          {
          Uchar i = 5;
          Uint j;
          while(i--)
          {
          j=7269;
          while(j--);
          };
          }



          關鍵詞: 51單片機lcd160

          評論


          技術專區(qū)

          關閉
          看屁屁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); })();