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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 51單片機(jī)做的傳送機(jī)(輸送機(jī))計(jì)數(shù)器

          51單片機(jī)做的傳送機(jī)(輸送機(jī))計(jì)數(shù)器

          作者: 時(shí)間:2016-11-30 來(lái)源:網(wǎng)絡(luò) 收藏
          弟弟自己做了個(gè)傳送機(jī)輸送機(jī)),裝水泥省了不少勁,贊!!美中不足的是要一邊裝水泥還要一邊數(shù)著裝了多少袋,有時(shí)數(shù)忘了還要重?cái)?shù)。于是把這個(gè)計(jì)數(shù)的任務(wù)交給了我。

          我用單片機(jī)結(jié)合數(shù)碼管做了一個(gè),也捎帶著復(fù)習(xí)下去年學(xué)的單片機(jī).在stc89c52單片機(jī)的P3.7管腳接一個(gè)行程開關(guān),作為計(jì)數(shù)的開關(guān),用單片機(jī)的P1.0-P1.7接一個(gè)共陽(yáng)數(shù)碼管,作為00-99計(jì)數(shù)的十位數(shù)顯示,用單片機(jī)的P0.0-P0.7接一個(gè)共陽(yáng)數(shù)碼管,作為00-99計(jì)數(shù)的個(gè)位數(shù)顯示。做出后效果不錯(cuò),下面是c程序源碼:

          #include

          unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,

          0x6d,0x7d,0x07,0x7f,0x6f};

          unsigned char Count;

          void delay1s(void)

          { unsigned char m,n,k;
          for(k=100;k>0;k--)
          for(m=30;m>0;m--)
          for(n=248;n>0;n--);
          }
          void delay10ms(void)
          {
          unsigned char i,j;
          for(i=20;i>0;i--)
          for(j=248;j>0;j--);
          }
          void main(void)
          {
          Count=0;
          P0=table[Count/10];
          P1=table[Count];
          while(1)
          { if(P3_7==0)
          {
          delay10ms();
          if(P3_7==0)
          { Count++;
          if(Count==100)
          {
          Count=0;
          }
          P1=table[Count/10];
          P0=table[Count%10];
          while(P3_7==0);
          delay1s();
          /* 延時(shí)1秒,兩袋水泥間隔大于1秒,避免出現(xiàn)誤動(dòng)作 */
          }
          }
          }
          }

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





          評(píng)論


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