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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 單片機PID控制算法的最簡單程序

          單片機PID控制算法的最簡單程序

          作者: 時間:2016-12-01 來源:網(wǎng)絡 收藏
          這個程序應用在51單片機上的

          /*************定義全局變量*****************/
          uchar Kp,Ti,Td
          int Set_speed;

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

          /*************PID初始化函數(shù)***************/
          void PID_init(void){
          Serror=0;
          FError=0;
          Kp=30;
          Ti=500;
          Td=10;
          }

          int PID_control(int Now_speed)
          {
          int Error,Serror,result;
          Error=Now_speed-Set_speed;
          Serror=Serror+Error;
          result=(Kp*Error+Kp*0.05/Ti*Serror+Kp*Td/0.05*(Error-FError));
          FError=Error;
          //對占空比進行限幅處理
          if(result<10)
          {result=0;} else
          if(result>1000)
          {result=1000;}
          return result;
          }



          關鍵詞: 單片機PID控制算

          評論


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