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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > ARM7學(xué)習(xí)---LPC2103 Time0定時(shí)器練習(xí)

          ARM7學(xué)習(xí)---LPC2103 Time0定時(shí)器練習(xí)

          作者: 時(shí)間:2016-11-10 來源:網(wǎng)絡(luò) 收藏
          繼續(xù)學(xué)習(xí)ARM7,練習(xí)了下LPC2103的內(nèi)部定時(shí)器T0,定時(shí)1S,讓LED閃爍。具體測(cè)試程序如下:

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

          /**************ARM7(LPC2103)練習(xí)程序**************************/
          /*************************************************************/
          /*****File Function : Time0測(cè)試程序 *****/
          /*****Program Author : ZhengWen(ClimberWin) *****/
          /*****MCU : LPC2103F 外部11.0592M晶振 *****/
          /*****Compile Date : 2010/02/13 *****/
          /*****Edition Info : V1.0 *****/
          /*************************************************************/
          //編譯環(huán)境 KEIL for ARM
          //LED1-LED7 接在P0.8-P0.15
          //功能:使用內(nèi)部定時(shí)器0,讓LED閃爍。

          #include
          #define uchar unsigned char
          #define uint unsigned int

          void Timer0_Init(void);
          void __irq IRQ_Timer0 (void);

          /*************定時(shí)器0中斷程序****************/
          void __irq IRQ_Timer0 (void)
          {
          static uchar ledtemp=0x00;
          ledtemp=~ledtemp;
          if(ledtemp==0x00) IO0SET=(1<<8);
          if(ledtemp==0xff) IO0CLR=(1<<8);
          T0IR = 0x01;// 清除中斷標(biāo)志
          VICVectAddr = 0x00;// 通知VIC中斷處理結(jié)束
          }
          /***********定時(shí)器0初始化程序**************/
          void Timer0_Init(void)
          {

          T0PR = 99; // 設(shè)置定時(shí)器0分頻為100分頻,得110592Hz
          T0MCR = 0x03; // 匹配通道0匹配中斷并復(fù)位T0TC
          T0MR0 = 110592;// 比較值(1S定時(shí)一次)
          T0TCR = 0x01; //定時(shí)器計(jì)數(shù)器和預(yù)分頻計(jì)數(shù)器使能

          VICIntSelect = 0x00;// 所有中斷通道設(shè)置為IRQ中斷
          VICVectCntl0 = 0x20|4 ;// 向量IRQ slot 使能 | 中斷號(hào)
          VICVectAddr0 = (unsigned long)IRQ_Timer0;// 設(shè)置中斷服務(wù)程序地址
          VICIntEnable = (1 << 0x04);// 使能定時(shí)器0中斷
          }

          int main(void)
          {

          IO0DIR=0x0000ff00; //配置P0.8-P0.15為輸出
          IO0SET=0x0000ff00; //配置P0.8-P0.15初始值為高
          Timer0_Init(); //初始化定時(shí)器0
          while(1); //等待進(jìn)入中斷程序

          }



          關(guān)鍵詞: ARM7LPC2103Time0定時(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); })();