请问定时器5中断为啥进不去了,谢谢!!!

2019-08-22 14:18发布

void TIM5_Int_Init(u16 arr,u16 psc)
{
    TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
 NVIC_InitTypeDef NVIC_InitStructure;  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE); //?±??????  TIM_TimeBaseStructure.TIM_Period = arr; 
 TIM_TimeBaseStructure.TIM_Prescaler =psc; 
 TIM_TimeBaseStructure.TIM_ClockDivision = 0; 
 TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;  
 TIM_TimeBaseInit(TIM5, &TIM_TimeBaseStructure); 
 
 TIM_ITConfig(TIM5,TIM_IT_Update,ENABLE ); //  NVIC_InitStructure.NVIC_IRQChannel = TIM5_IRQn;  //
 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;  
 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;  //
 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 
 NVIC_Init(&NVIC_InitStructure);   TIM_Cmd(TIM5, ENABLE);  
       
}

void TIM5_IRQHandler(void)   //TIM3????
{
 if (TIM_GetITStatus(TIM5, TIM_IT_Update) != RESET) 
  {
  TIM_ClearITPendingBit(TIM5, TIM_IT_Update  );  
  LED0=!LED0;
  }
}
请问中断为啥进不去了,谢谢!!!!!!!!!!!!!!!!!!!!!!!









友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。