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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > AVR單片機(jī)從左到右LED流水燈C語(yǔ)言程序

          AVR單片機(jī)從左到右LED流水燈C語(yǔ)言程序

          作者: 時(shí)間:2016-11-30 來源:網(wǎng)絡(luò) 收藏
          AVR單片機(jī)第一個(gè)實(shí)驗(yàn),從左到右的LED流水燈C語(yǔ)言程序,編程環(huán)境是WinAVR,8MHZ晶振。

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

          #include <avr/io.h>//相關(guān)庫(kù)

          #include

          typedef unsigned int uint;

          typedef unsigned char uchar;

          uchar const tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};

          void main(void)//主函數(shù)

          {

          PORTB=0xff;//PB口輸出為高電平

          DDRB=0xff;//高PB口為輸出

          uchar a;//定義變量

          while(1)//無限循環(huán)

          {

          for(a=0;a<8;a++)

          {

          PORTB=tab[a];//流水燈十六進(jìn)制數(shù)組

          _delay_ms(500);//調(diào)用庫(kù)中的延時(shí)函數(shù)

          }

          }

          }



          關(guān)鍵詞: AVR單片機(jī)LED流水

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