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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > AVR128的程序——定時(shí)器

          AVR128的程序——定時(shí)器

          作者: 時(shí)間:2016-11-22 來源:網(wǎng)絡(luò) 收藏
          #include
          #include
          #define uchar unsigned char
          #define uint unsigned int
          void timer1_init(void);
          uchar temp=0x01;
          void main(void)
          {
          uchar i,temp;
          DDRA = 0XFF;
          PORTA = 0XFF;
          DDRC = 0XFF;
          PORTC = 0XFF;
          DDRF |= 0X0E;
          PORTF |= 0X0E;
          PORTF &= 0xF8;
          DDRB |= 0X10;
          PORTB |= 0X10;
          timer1_init();
          SEI();
          while(1);
          }
          void timer1_init(void)
          {
          TCNT1H = 0xE1;
          TCNT1L = 0x7C;
          TCCR1A = 0x00;
          TCCR1B = 0x05;
          TIMSK = 0x04;
          }
          #pragma interrupt_handler timer1_ovf_isr:15
          void timer1_ovf_isr(void)
          {
          TCNT1H = 0xE1;
          TCNT1L = 0x7C;
          PORTA=temp;
          temp<<=1;
          if(temp==0x00)
          temp=0x01;
          }


          關(guān)鍵詞: AVR128定時(shí)

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