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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > AVR讀鍵盤語句用switch

          AVR讀鍵盤語句用switch

          作者: 時間:2016-11-24 來源:網(wǎng)絡 收藏
          #include <avr/io.h>

          int main(void)

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

          {
          DDRD &= ~(1 << 6);//設置為輸入
          DDRD &= ~(1 << 3);//設置為輸入
          DDRD &= ~(1 << 7);//設置為輸入
          PORTD |= (1 << 6);//打開上啦電阻
          PORTD |= (1 << 7);//打開上啦電阻
          DDRA |= (1 << 3);//設置為輸出
          DDRB |= (1 << 0);//設置為輸出
          DDRB |= (1 << 1);//設置為輸出
          PORTA &= ~(1 << 3);//關蜂鳴器

          while(1)
          {

          switch(PIND & 0b11000000)
          {
          case 0b10000000:
          {
          PORTB |= (1 << 0);
          PORTA |= (1 << 3);
          break;
          }
          case 0b01000000:
          {
          PORTB |= (1 << 1);
          break;
          }
          default:
          {
          PORTA &= ~(1 << 3);
          PORTB = 0;
          }
          }
          }

          }



          評論


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