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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)程序-利用C52庫函數(shù)實(shí)現(xiàn)左右流水燈

          單片機(jī)程序-利用C52庫函數(shù)實(shí)現(xiàn)左右流水燈

          作者: 時(shí)間:2016-12-02 來源:網(wǎng)絡(luò) 收藏
          本程序所用的原理圖下載:點(diǎn)這里,單片機(jī)芯片使用的stc89c52;找到流水燈部分的原理圖即可.這是一整個(gè)單片機(jī)開發(fā)板的電路圖其他的忽略

          下面是程序源代碼:
          /***********左右流水燈**************/
          /**
          *功能:利用C52庫函數(shù)實(shí)現(xiàn)左右流水燈
          * 方法一:goto 語句實(shí)現(xiàn)之
          * 方法二: 順序?qū)崿F(xiàn)之
          * 方法三: 順序和goto語句實(shí)現(xiàn)之
          *日期:2013-06-16-09:00-09:40
          *備注:程序已通過調(diào)試
          **/
          /*********AT89C52-RC MCU*************/
          /***********HL-1 開發(fā)板***********/
          #include
          #include
          typedef unsigned int uint;
          typedef unsigned char uchar;
          void delay(uint xms)
          {
          uint x, y;
          for(x = xms; x > 0; x--)
          for(y = 110; y > 0; y--);
          }
          /**********方法1************/
          /*
          void main(void)
          {

          uchar temp, temp1, i;
          /******流水燈向左流動(dòng)********/
          /*
          loop1: while(1)
          {
          P1 = 0xfe;
          for(i = 0; i < 7; i++)
          {
          temp = P1;
          temp = _crol_(temp, 1);
          P1 = temp;
          delay(200);
          }
          goto loop;
          }
          /******流水燈向右流動(dòng)********/
          /*
          loop: while(1)
          {
          P1 = 0x7f;
          for(i = 0; i < 7; i++)
          {
          temp1 = P1;
          temp1 = cror_(temp1, 1);
          P1 = temp1;
          delay(200);
          }
          goto loop1;
          }
          }
          */
          /**********方法2************/
          /*
          void main(void)
          {
          uchar temp, i;
          P1 = 0xfe;
          while(1)
          {
          P1 = 0xfe;
          temp = P1;
          /******流水燈向左流動(dòng)********/
          /*
          for(i = 0; i < 7; i++)
          {
          temp = _crol_(temp, 1);
          P1 = temp;
          delay(200);
          }
          /******流水燈向右流動(dòng)********/
          /*
          P1 = 0x7f;
          temp = P1;
          for(i = 0; i < 7; i++)
          {
          temp = _cror_(temp, 1);
          P1 = temp;
          delay(200);
          }
          }
          }
          */
          /**********方法3***********/
          void main(void)
          {
          uchar temp, i;
          while(1)
          {
          P1 = 0xfe;
          temp = P1;
          /******流水燈向左流動(dòng)********/
          for(i = 0; i < 7; i++)
          {
          temp = _crol_(temp, 1);
          P1 = temp;
          delay(200);
          if(i >= 7)
          goto loop;
          }
          /******流水燈向右流動(dòng)********/
          loop: P1 = 0x7f;
          temp = P1;
          for(i = 0; i < 7; i++)
          {
          temp = _cror_(temp, 1);
          P1 = temp;
          delay(200);
          }
          }
          }


          評論


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