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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 28BYJ-48步進電機加ULN2003驅(qū)動的51單片機的代碼

          28BYJ-48步進電機加ULN2003驅(qū)動的51單片機的代碼

          作者: 時間:2016-11-28 來源:網(wǎng)絡 收藏
          #include
          #define uint unsigned int
          #define ucher unsigned char
          unsigned char code ZZ[8]={0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08};//28BYJ-48正時鐘旋轉(zhuǎn)相序表
          unsigned char code FZ[8]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};//28BYJ-48逆時鐘旋轉(zhuǎn)相序表
          void delay(unsigned int n)//毫秒級延時
          {
          unsigned int i,j;
          for(j=n;j>0;j--)
          for(i=112;i>0;i--);
          }
          void BGdelay(unsigned int n)//步進延時
          {
          unsigned int i;
          for(n;n>0;n--)
          for(i=96;i>0;i--);
          }
          void main(void)//入口函數(shù)
          {
          unsigned int i;
          delay(500);
          while(1)
          {
          for(i=0;i<8;i++) //旋轉(zhuǎn)45度
          {
          P1=FZ[i];
          BGdelay(1);
          }
          }
          }


          評論


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