在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > STM32F107VCT6的通用定時器配置

            STM32F107VCT6的通用定時器配置

            作者: 時間:2016-11-10 來源:網(wǎng)絡(luò) 收藏
            將TIM2的周期配置成0.2ms。
            定時器周期公式:(1+TIM_Prescaler )/72M)*(1+TIM_Period )

            #define NVIC_Priority_Timer2 1

            本文引用地址:http://www.biyoush.com/article/201611/317515.htm

            unsigned int Period_TIM2 = 14400;

            void TIM2_Init_Config(void)
            {
            TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
            NVIC_InitTypeDef NVIC_InitStructure;

            RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);

            NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
            NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = NVIC_Priority_Timer2;
            NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
            NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
            NVIC_Init(&NVIC_InitStructure);

            /*
            * (1+TIM_Prescaler )/72M)*(1+TIM_Period )=((1+0)/72M)*(1+14400-1) = 0.2ms //5K采樣速度
            */
            TIM_TimeBaseStructure.TIM_Period = Period_TIM2 - 1;
            TIM_TimeBaseStructure.TIM_Prescaler = 0;
            TIM_TimeBaseStructure.TIM_ClockDivision = 0;
            TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
            TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);

            TIM_ClearFlag(TIM2, TIM_FLAG_Update);

            TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
            TIM2->CNT = 0;
            TIM_Cmd(TIM2, ENABLE);
            }

            stm32f10x_it.c文件中

            void TIM2_IRQHandler(void)
            {
            if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
            {
            TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

            //添加處理代碼
            }
            }




            關(guān)鍵詞: STM32F107VCT6通用定時器配

            評論


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

            關(guān)閉