中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > STM32學(xué)習(xí)筆記—SysTick定時(shí)器

        STM32學(xué)習(xí)筆記—SysTick定時(shí)器

        作者: 時(shí)間:2013-01-24 來(lái)源:網(wǎng)絡(luò) 收藏

        void SysTick_Configuration(void)

        {

        /* Select AHB clock(HCLK) as SysTick clock source 設(shè)置AHB時(shí)鐘為SysTick時(shí)鐘*/

        SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);

        /* Set SysTick Priority to 3 設(shè)置SysTicks中斷搶占優(yōu)先級(jí) 3, 從優(yōu)先級(jí)0*/

        NVIC_SystemHandlerPriorityConfig(SystemHandler_SysTick, 3, 0);

        /* SysTick interrupt each 1ms with HCLK equal to 72MHz 每1ms發(fā)生一次SysTick中斷*/

        SysTick_SetReload(72000);

        /* Enable the SysTick Interrupt */

        SysTick_ITConfig(ENABLE);

        }

        延時(shí)函數(shù),需要延時(shí)處調(diào)用:

        view plaincopy to clipboardprint?

        void Delay(u32 nTime)

        {

        /* Enable the SysTick Counter 允許SysTick計(jì)數(shù)器*/

        SysTick_CounterCmd(SysTick_Counter_Enable);

        TimingDelay = nTime;

        while(TimingDelay != 0)

        ; //等待計(jì)數(shù)至0

        /* Disable the SysTick Counter 禁止SysTick計(jì)數(shù)器*/

        SysTick_CounterCmd(SysTick_Counter_Disable);

        /* Clear the SysTick Counter 清零SysTick計(jì)數(shù)器*/

        SysTick_CounterCmd(SysTick_Counter_Clear);

        }

        void Delay(u32 nTime)

        {

        /* Enable the SysTick Counter 允許SysTick計(jì)數(shù)器*/

        SysTick_CounterCmd(SysTick_Counter_Enable);

        TimingDelay = nTime;

        while(TimingDelay != 0)

        ; //等待計(jì)數(shù)至0

        /* Disable the SysTick Counter 禁止SysTick計(jì)數(shù)器*/

        SysTick_CounterCmd(SysTick_Counter_Disable);

        /* Clear the SysTick Counter 清零SysTick計(jì)數(shù)器*/

        SysTick_CounterCmd(SysTick_Counter_Clear);

        }

        中斷函數(shù),定時(shí)器減至零時(shí)調(diào)用,放在stm32f10x_it.c文件中

        view plaincopy to clipboardprint?

        void SysTickHandler(void)

        {

        TimingDelay--;

        }

        塵埃粒子計(jì)數(shù)器相關(guān)文章:塵埃粒子計(jì)數(shù)器原理

        上一頁(yè) 1 2 下一頁(yè)

        評(píng)論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉