在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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>

            新聞中心

            我的ARM編程技巧---積累

            作者: 時(shí)間:2016-11-26 來源:網(wǎng)絡(luò) 收藏

            ********************************************************************
            **************系統(tǒng)時(shí)鐘的配置RCC_Configuration**********************
            ********************************************************************
            ********************************************************************
            ********************************************************************
            void RCC_Configuration(void)
            {

            RCC_DeInit();

            RCC_HSEConfig(RCC_HSE_ON);

            HSEStartUpStatus = RCC_WaitForHSEStartUp();
            if(HSEStartUpStatus == SUCCESS)
            {

            RCC_HCLKConfig(RCC_SYSCLK_Div1);

            RCC_PCLK2Config(RCC_HCLK_Div1);

            RCC_PCLK1Config(RCC_HCLK_Div2);

            FLASH_SetLatency(FLASH_Latency_2);

            FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
            */
            RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);

            RCC_PLLCmd(ENABLE);

            while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
            {
            }

            RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

            while(RCC_GetSYSCLKSource() != 0x08)
            {
            }
            }
            *****************//初始化獨(dú)立看門狗******************************
            ********************************************************************
            ********************************************************************
            ********************************************************************
            void IWDG_Configuration(void)
            {


            //是能或者失能對寄存器IWDG_PR和IWDG_RLR
            IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);


            //選定工作頻率
            IWDG_SetPrescaler(IWDG_Prescaler_32);


            //設(shè)置重裝載值
            IWDG_SetReload(230);


            //按照重裝載器的值重裝載IWDG計(jì)數(shù)器的值-----------此動(dòng)作相當(dāng)于“喂狗”
            IWDG_ReloadCounter();


            //使能IWDG
            IWDG_Enable();
            }
            / *******************
            /
            TIM_DeInit(TIM1);//將外設(shè)TIMx寄存器重設(shè)為缺省值
            //2、基礎(chǔ)設(shè)置

            TIM1_TimeBaseStructure.TIM_Prescaler = 0x0; //預(yù)分頻,此值+1為分頻的除數(shù)得到計(jì)數(shù)周期;
            TIM1_TimeBaseStructure.TIM_Period = 0xFFFF;//計(jì)數(shù)周期(即當(dāng)計(jì)數(shù)值達(dá)到“計(jì)數(shù)值”時(shí),剛好用時(shí)一個(gè)計(jì)數(shù)周期)
            TIM1_TimeBaseStructure.TIM_ClockDivision = 0x0;//時(shí)鐘因子
            TIM1_TimeBaseStructure.TIM_RepetitionCounter = 0x0;
            TIM1_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //計(jì)數(shù)器模式
            //TIM_CounterMode_Dowm向下計(jì)數(shù)
            //TIM_CounterMode_CenterAligned1 中心對齊方式1
            // TIM_CounterMode_CenterAligned2 中心對齊方式2
            // TIM_CounterMode_CenterAligned3 中心對齊方式3

            TIM_TimeBaseInit(TIM1,&TIM1_TimeBaseStructure);
            // 3、輸出通道設(shè)置

            TIM1_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2;
            //TIM_OCMode_Timing輸出比較時(shí)間模式(輸出引腳凍結(jié)無效)
            //TIM_OCMode_Active 輸出比較主動(dòng)模式(匹配時(shí)設(shè)置輸出引腳為有效電平,當(dāng)計(jì)數(shù)值為比較/捕獲寄存器值相同時(shí),強(qiáng)制輸出為高平)TIM_OCMode_Inactive; 輸出比較非主動(dòng)模式 (匹配時(shí)設(shè)置輸出引腳為無效電平,當(dāng)計(jì)數(shù)值為比較/捕獲寄存器值相同時(shí),強(qiáng)制輸出為低電平)
            //TIM_OCMode_Toggle 輸出比較觸發(fā)模式(翻轉(zhuǎn)。當(dāng)計(jì)數(shù)值與比較/捕獲寄存器值相同時(shí),翻轉(zhuǎn)輸出引腳的電平)
            //TIM_OCMode_PWM1向上計(jì)數(shù)時(shí),當(dāng)TIMx_CNT < TIMx_CCR*時(shí),輸出電平有效,否則為無效,
            //向下計(jì)數(shù)時(shí),當(dāng)TIMx_CNT > TIMx_CCR*時(shí),輸出電平無效,否則為有效
            //TIM_OCMode_PWM2 ;與PWM1模式相反

            TIM1_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
            TIM1_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
            TIM1_OCInitStructure.TIM_Pulse = CCR1_Val;
            TIM1_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
            TIM1_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
            TIM1_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
            TIM1_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;

            TIM_OC1Init(TIM1,&TIM1_OCInitStructure);

            TIM1_OCInitStructure.TIM_Pulse = CCR2_Val;
            TIM_OC2Init(TIM1,&TIM1_OCInitStructure);

            TIM1_OCInitStructure.TIM_Pulse = CCR3_Val;
            TIM_OC3Init(TIM1,&TIM1_OCInitStructure);


            TIM1_BDTRInitStructure.TIM_OSSRState = TIM_OSSRState_Enable;
            TIM1_BDTRInitStructure.TIM_OSSIState = TIM_OSSIState_Enable;
            TIM1_BDTRInitStructure.TIM_LOCKLevel = TIM_LOCKLevel_1;
            TIM1_BDTRInitStructure.TIM_DeadTime = 0x75;
            TIM1_BDTRInitStructure.TIM_Break = TIM_Break_Enable;
            TIM1_BDTRInitStructure.TIM_BreakPolarity = TIM_BreakPolarity_High;
            TIM1_BDTRInitStructure.TIM_AutomaticOutput = TIM_AutomaticOutput_Enable;

            TIM_BDTRConfig(TIM1,&TIM1_BDTRInitStructure);


            TIM_Cmd(TIM1,ENABLE);


            TIM_CtrlPWMOutputs(TIM1,ENABLE);


            上一頁 1 2 下一頁

            關(guān)鍵詞: ARM編程技

            評論


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

            關(guān)閉