tiM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM9,ENABLE); ///
TIM_TimeBaseInitStructure.TIM_Period = arr; //
TIM_TimeBaseInitStructure.TIM_Prescaler=psc; //
TIM_TimeBaseInitStructure.TIM_CounterMode=TIM_CounterMode_Up; //
TIM_TimeBaseInitStructure.TIM_ClockDivision=TIM_CKD_DIV1;
TIM_TimeBaseInit(TIM9,&TIM_TimeBaseInitStructure);//
TIM_ITConfig(TIM9,TIM_IT_Update,ENABLE); //
TIM_Cmd(TIM9,ENABLE); //ʹÄܶ¨Ê±4
NVIC_InitStructure.NVIC_IRQChannel=TIM1_BRK_TIM9_IRQn; //
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);//
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1; //
NVIC_InitStructure.NVIC_IRQChannelSubPriority=2; //
NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
NVIC_Init(&NVIC_InitStructure);
使能了啊!TIM_Cmd(TIM9,ENABLE);
一周热门 更多>