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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)數(shù)據(jù)采集常用算法

          單片機(jī)數(shù)據(jù)采集常用算法

          作者: 時(shí)間:2016-11-26 來源:網(wǎng)絡(luò) 收藏
          u8 TPAD_Init()

          {
          u16 buf[10];
          u16 temp;
          u8 j,i;
          for(i=0;i<10;i++)//10次采樣

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

          {
          buf[i]=TPAD_Get_Val();
          delay_ms(10);
          }
          for(i=0;i<9;i++)//升序排列

          {
          for(j=i+1;j<10;j++)
          {
          if(buf[i]>buf[j])//

          {
          temp=buf[i];
          buf[i]=buf[j];
          buf[j]=temp;
          }
          }
          }
          temp=0;
          for(i=2;i<8;i++)temp+=buf[i];//ÈÖмäµÄ8¸öÊý¾Ý½øÐÐƽ¾ù
          tpad_default_val=temp/6;
          return 0;
          }



          評論


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