//设置优先级 NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;//先占优先级0级 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //从优先级0级 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); TIM_Cmd(TIM1,...
void TIM1_Config(void) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE); // 使能TIM1时钟 // TIM1 中断优先级配置 NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreempti...
128. if (TIMx == TIM1) irq = TIM1_UP_IRQn; 129. else if (TIMx == TIM2) irq = TIM2_IRQn; 130. else if (TIMx == TIM3) irq = TIM3_IRQn; 131. else if (TIMx == TIM4) irq = TIM4_IRQn; 132. else if (TIMx == TIM5) irq = TIM5_IRQn; 133. else if (TIMx =...
128. if (TIMx == TIM1) irq = TIM1_UP_IRQn; 129. else if (TIMx == TIM2) irq = TIM2_IRQn; 130. else if (TIMx == TIM3) irq = TIM3_IRQn; 131. else if (TIMx == TIM4) irq = TIM4_IRQn; 132. else if (TIMx == TIM5) irq = TIM5_IRQn; 133. else if (TIMx =...
NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQChannel;//TIM1_UP_IRQn;NVIC_InitStructure.NVIC_...
UP_IRQn;129.elseif(TIMx == TIM2) irq =TIM2_IRQn;130.elseif(TIMx == TIM3) irq =TIM3_IRQn;131.elseif(TIMx == TIM4) irq =TIM4_IRQn;132.elseif(TIMx == TIM5) irq =TIM5_IRQn;133.elseif(TIMx == TIM6) irq =TIM6_DAC_IRQn;134.elseif(TIMx == TIM7) irq =TIM7_IRQn...
GPIO_InitStrUCtUre.GPIO_Mode = GPIO_Mode_OUt_PP; NVIC_InitStrUCtUre.NVIC_IRQChanneI = TIM1_UP_IRQn; GPIO_InitStrUCtUre.GPIO_SPeed = GPIO_SPeed_50MH z; NVIC_InitStrUCtUre.NVIC_IRQChanneIPreemPtiOnPriority = 0; GPIO_Init(GPIOC, & GPIO」nitStructure); NVIC_InitStrUCtUre.NVIC_IRQChanneISUbPriOri...
? ? NVIC_EnableIRQ(TIM1_UP_IRQn);? ? TIM_ITConfig( TIM1, TIM_IT_Update, ENABLE );} /*-...
1.利用中断时,main函数中要有除中断外主要运行的函数,while(1)里面是空也可以,但是前提是有这个主函数运行的东西。 2.利用TIM1 进行定时器中断优先级编写时,NVIC_IRQChannel 要选择TIM1_UP_IRQn,同时相应中断服务函数也要改变名称void TIM1_UP_IRQHandler(void) //maybe TIM1与其他TIM进入中断时 其他地方 写的...
NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQn;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority ...