日本a√视频在线,久久青青亚洲国产,亚洲一区欧美二区,免费g片在线观看网站

        <style id="k3y6c"><u id="k3y6c"></u></style>
        <s id="k3y6c"></s>
        <mark id="k3y6c"></mark>
          
          

          <mark id="k3y6c"></mark>

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 51單片機(jī)程序——按鍵控制數(shù)碼管變化

          51單片機(jī)程序——按鍵控制數(shù)碼管變化

          作者: 時(shí)間:2016-11-23 來(lái)源:網(wǎng)絡(luò) 收藏
          #include
          #define uint unsigned int
          #define uchar unsigned char
          #define dula P0
          #define wela P1
          sbit key=P3^2;
          unsigned char code DuanMa[]={0xff,0xc0,0xf9,0xa4,0xb0,
          0x99,0x92,0x82,0xf8,
          0x80,0x90,0x88,0x83,
          0xa7,0xa1,0x86,0x8e};
          uchar num;
          void delay(uint z)
          {
          uint x,y;
          for(x=z;x>0;x--)
          for(y=110;y>0;y--);
          }
          void main()
          {
          while(1)
          {
          if(key==0) //延遲再判斷,確保按鍵確實(shí)被按下
          {
          delay(5);
          if(key==0)
          {
          num++;
          if(num==17)
          num=0;
          }
          while(!key);  //同理,判斷鍵盤(pán)確實(shí)已經(jīng)松開(kāi)
          delay(5);
          while(!key);
          }
          wela=0xff; //位選都打開(kāi),8位數(shù)碼管都顯示
          dula=DuanMa[num]; //送段碼
          }
          }


          評(píng)論


          技術(shù)專(zhuān)區(qū)

          關(guān)閉