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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > stc單片機用數碼管顯示i love you(鍵盤版)

          stc單片機用數碼管顯示i love you(鍵盤版)

          作者: 時間:2016-12-01 來源:網絡 收藏


          本文引用地址:http://www.ex-cimer.com/article/201612/324242.htm#include<stc12c5a.h>
          #define uchar unsigned char
          #define uint unsigned int
          uchar led[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
          uchar key[3]={0xfe,0xfd,0xfb};
          unsigned char get()
          {
          uchar x,y,lie,i;
          x=0;y=0;
          for(i=0;i<3;i++)
          {
          P1=key[i];
          lie=P1&0x38;
          if(lie!=0x38)
          {
          x=i+1;
          switch(lie)
          {
          case 0x30:{y=1;}break;
          case 0x28:{y=2;}break;
          case 0x18:{y=3;}break;
          default:{x=0;}break;
          }
          break;
          }
          }
          if(x!=0)
          return (3*(x-1)+y);
          else return 0;
          }
          void main()
          {
          uchar play,i;
          P2M0=0xff;
          P2M1=0x00;
          P1M0=0xff;
          P1M1=0x00;
          while(1)
          {
          play=get();
          switch(play)
          {
          case 1:
          {
          P2=led[1];
          P0=0x07;
          for(i=0;i<100;i++);
          }break;
          case 2:
          {
          P2=0x38;
          P0=0x0e;
          for(i=0;i<100;i++);
          P0=0x0f;
          P2=0x3f;
          P0=0x0d ;
          for(i=0;i<100;i++);
          P0=0x0f;
          P2=0x3e;
          P0=0x0b;
          for(i=0;i<100;i++);
          P0=0x0f;
          P2=0x79;
          P0=0x07;
          for(i=0;i<100;i++);
          }break;
          case 3:
          {
          P2=0x6e;
          P0=0x0d;
          for(i=0;i<100;i++);
          P0=0x0f;
          P2=0x3f;
          P0=0x0b;
          for(i=0;i<100;i++);
          P0=0x0f;
          P2=0x3e;
          P0=0x07;
          for(i=0;i<100;i++);
          }break;
          default :{P2=led[0];}break;
          }
          }
          }


          評論


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