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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)中斷測量速度的程序帶仿真文件

          單片機(jī)中斷測量速度的程序帶仿真文件

          作者: 時間:2016-12-02 來源:網(wǎng)絡(luò) 收藏

          void ddelay(uint k)
          {
          uint i,j;
          for(i=0;i {
          for(j=0;j<60;j++)
          {;}
          }
          }
          /**********寫指令到LCD子函數(shù)************/

          void WriteCommandLCM(uchar WCLCM,uchar BusyC)
          {
          if(BusyC)lcd_wait();
          DATAPORT=WCLCM;
          LCM_RS=0; /* 選中指令寄存器*/
          LCM_RW=0; // 寫模式
          LCM_EN=1;
          _nop_();
          _nop_();
          _nop_();
          LCM_EN=0;

          }

          /**********寫數(shù)據(jù)到LCD子函數(shù)************/

          void WriteDataLCM(uchar WDLCM)
          {
          lcd_wait( ); //檢測忙信號
          DATAPORT=WDLCM;
          LCM_RS=1; /* 選中數(shù)據(jù)寄存器 */
          LCM_RW=0; // 寫模式
          LCM_EN=1;
          _nop_();
          _nop_();
          _nop_();
          LCM_EN=0;
          }

          /***********lcd內(nèi)部等待函數(shù)*************/

          void lcd_wait(void)
          {
          DATAPORT=0xff; //讀LCD前若單片機(jī)輸出低電平,而讀出LCD為高電平,則沖突,Proteus仿真會有顯示邏輯黃色
          LCM_EN=1;
          LCM_RS=0;
          LCM_RW=1;
          _nop_();
          _nop_();
          _nop_();
          while(DATAPORT&BUSY)
          { LCM_EN=0;
          _nop_();
          _nop_();
          LCM_EN=1;
          _nop_();
          _nop_();
          }
          LCM_EN=0;

          }

          /**********LCD初始化子函數(shù)***********/
          void initLCM( )
          {
          DATAPORT=0;
          ddelay(15);
          WriteCommandLCM(0x38,0); //三次顯示模式設(shè)置,不檢測忙信號
          ddelay(5);
          WriteCommandLCM(0x38,0);
          ddelay(5);
          WriteCommandLCM(0x38,0);
          ddelay(5);

          WriteCommandLCM(0x38,1); //8bit數(shù)據(jù)傳送,2行顯示,5*7字型,檢測忙信號
          WriteCommandLCM(0x08,1); //關(guān)閉顯示,檢測忙信號
          WriteCommandLCM(0x01,1); //清屏,檢測忙信號
          WriteCommandLCM(0x06,1); //顯示光標(biāo)右移設(shè)置,檢測忙信號
          WriteCommandLCM(0x0c,1); //顯示屏打開,光標(biāo)不顯示,不閃爍,檢測忙信號
          }

          /****顯示指定坐標(biāo)的一個字符子函數(shù)****/

          void DisplayOneChar(uchar X,uchar Y,uchar DData)
          {
          Y&=1;
          X&=15;
          if(Y)X|=0x40; //若y為1(顯示第二行),地址碼+0X40
          X|=0x80; //指令碼為地址碼+0X80
          WriteCommandLCM(X,0);
          WriteDataLCM(DData);
          }

          /*******顯示指定坐標(biāo)的一串字符子函數(shù)*****/

          void DisplayListChar(uchar X,uchar Y,uchar *DData)
          {
          uchar ListLength=0;
          Y&=0x01;
          X&=0x0f;
          while(X<16)
          {
          DisplayOneChar(X,Y,DData[ListLength]);
          ListLength++;
          X++;
          }
          }


          void display()
          {

          STR();
          DisplayListChar(0,0,str0);
          DisplayListChar(0,1,str1);
          }


          上一頁 1 2 下一頁

          關(guān)鍵詞: 單片機(jī)中斷測量速

          評論


          技術(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); })();