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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 試驗數(shù)碼管上顯示數(shù)字( 單片機(jī)直接實現(xiàn)位選 共陰極)

          試驗數(shù)碼管上顯示數(shù)字( 單片機(jī)直接實現(xiàn)位選 共陰極)

          作者: 時間:2016-12-01 來源:網(wǎng)絡(luò) 收藏

          位定義

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

          #include
          #include
          #define uint unsigned int
          #define uchar unsigned char
          sbit LSA=P2^2;
          sbit LSB=P2^3;
          sbit LSC=P2^4;
          uchar code num[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
          void delay(uint z)
          {
          uint x,y;
          for(x=z;x>0;x--)
          {
          for(y=0;y<113;y++)
          {
          }
          }
          }
          void main()
          {
          while(1)
          {
          LSA=0;
          LSB=0;
          LSC=0;
          P0=num[6];
          delay(2);
          LSA=1;
          LSB=0;
          LSC=0;
          P0=num[6];
          delay(2);
          }
          }


          //讓八個數(shù)碼管全部亮并且從0~9循環(huán)

          #include
          #include
          #define uint unsigned int
          #define uchar unsigned char
          uchar num;
          uchar wnum=0x00;
          uchar code dbit[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//段選,選擇要顯示的數(shù)字
          //uchar code wnum[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdF,0xbF,0x7F};//八位數(shù)碼管
          void delay(uint z)
          {
          uint x,y;
          for(x=z;x>0;x--)
          {
          for(y=0;y<113;y++)
          {
          }
          }
          }
          void main()
          {
          P1=wnum;
          while(1)
          {
          for(num=0;num<10;num++)
          {
          P0=dbit[num];
          delay(500);
          }
          }
          }


          上一頁 1 2 下一頁

          評論


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