03-06-2017 02:43 AM
Good afternoon~ I have some troubles.Could anybody in the forum can help me?
When the timer interrupt,it chose timer overflowing interrupt while it didn’t spill over and enter into interrupting the service function. I would like to ask the following questions: Does timer overflowing interrupt enter into interrupting the service function before time-delay? Or time-delay befor interrupting the service function? void TIM5_Int_Init(u32 psc,u32 arr) { TIM_TimeBaseInitTypeDef TIM_TimeBaseInitstruct; NVIC_InitTypeDef NVIC_Initstruct; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5,ENABLE); //使能TIM5时钟 TIM_TimeBaseInitstruct.TIM_Prescaler=psc; //时钟预分频 TIM_TimeBaseInitstruct.TIM_Period=arr; //设置自动重装载值 TIM_TimeBaseInitstruct.TIM_CounterMode=TIM_CounterMode_Up; //向上计数模式 TIM_TimeBaseInitstruct.TIM_ClockDivision=TIM_CKD_DIV1; //不太清除这个的作用 TIM_TimeBaseInit(TIM5,&TIM_TimeBaseInitstruct); TIM_ITConfig(TIM5,TIM_IT_Update,ENABLE); //定时器中断使能 NVIC_Initstruct.NVIC_IRQChannelPreemptionPriority=2; //设置抢占优先级为2 NVIC_Initstruct.NVIC_IRQChannelSubPriority=2; //设置副优先级为2 NVIC_Initstruct.NVIC_IRQChannel=TIM5_IRQn; //TIM5中断通道 NVIC_Initstruct.NVIC_IRQChannelCmd=ENABLE; //TIM5中断通道使能 NVIC_Init(&NVIC_Initstruct); TIM_Cmd(TIM5,ENABLE); //TIM5时钟使能 } This is initialize function when my timer interrupted.
All you suggestions will be appreciated!
Wishes!
03-07-2017 08:55 AM
Hello,
Could you show your code?
Adam.