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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > LPC1768之系統(tǒng)滴答定時器

          LPC1768之系統(tǒng)滴答定時器

          作者: 時間:2016-11-19 來源:網(wǎng)絡(luò) 收藏
          滴答定時器可作為實時系統(tǒng)的滴答時鐘。MDK新建工程完成后,添加core_me.h到工程,static __INLINE uint32_t SysTick_Config(uint32_t ticks),在core_m3.h文件中。初始化時候調(diào)用即可。然后直接添加定時器中斷處理函數(shù)即可。

          本文引用地址:http://www.ex-cimer.com/article/201611/318496.htm
          /*	  *	main.c:  the main file *	NXP --> LPC1768**   *	Author	:	light					*	Date	:	2012-4-16  **/#includevolatile uint32_t msTicks;                            /* counts 1ms timeTicks *//*----------------------------------------------------------------------------SysTick_Handler*----------------------------------------------------------------------------*//Descriptions			:SysTick interrupt handleparameters			:NoneReturned value		:None*/void SysTick_Handler(void) {msTicks++;                        /* increment counter necessary in Delay() */}/*------------------------------------------------------------------------------delays number of tick Systicks (happens every 1 ms)*------------------------------------------------------------------------------*/__INLINE static void Delay (uint32_t dlyTicks) {uint32_t curTicks;	  curTicks = msTicks;	    // 獲取當(dāng)前值while ((msTicks - curTicks) < dlyTicks);	  //等待,即延時}/Descriptions			:Function that initializes LEDsparameters			:NoneReturned value		:None*/void DelayMs(unsigned int m){int i,j;for(i=m;i>0;i--){for(j=3000;j>0;j--);}}/Descriptions			:Function that initializes LEDsparameters			:NoneReturned value		:None*/void LedInit(void) {// PINSEL4,PINSEL5 設(shè)定P2.0 -- P2.32 端口功能(00,01,10,11)LPC_PINCON->PINSEL4 = 0XFC000000;			// p2.0--p2.13設(shè)置為IO LPC_PINCON->PINMODE4 = 0XFC000000;			// p2.0--p2.13設(shè)置為上拉電阻使能LPC_GPIO2->FIODIR = 0X000000FF;	 		// p2.0--p2.7設(shè)置為輸出}/Descriptions			:Function that LED onparameters			:n , which led is onReturned value		:None*/void LedNOn(unsigned int n){LPC_GPIO2->FIOSET = (1<FIOCLR = (1<=0;loc--){LedNOn(loc);Delay(1000);LedNOff(loc);Delay(1000);}}}



          評論


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