AnsweredAssumed Answered

Timer interrupt Handler

Question asked by rahimi.meysam on Apr 17, 2015
Latest reply on Apr 20, 2015 by Chris T
Hello.
I have Using One of the example Program that port UCOS on STM32F4 Devices.
I have One problem. When I activate Timer in one the tasks, The Timer is Working in a right way(example is on the blinking LED). but i want to add some code in its interrupt service routin. i cant find where todo that?
here is the code that activate timer 2 and its interrupt service routine(that i used).

static void timer_init(void)
{
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
  TIM_TimeBaseInitTypeDef timerInitStructure;
  NVIC_InitTypeDef NVIC_InitStructure;
  /* Enable the TIM2 gloabal Interrupt */
  
  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 5;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 10;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
  
  
  timerInitStructure.TIM_Prescaler = 40000;
  timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
  timerInitStructure.TIM_Period = 5000;
  timerInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
  timerInitStructure.TIM_RepetitionCounter = 0;
  TIM_TimeBaseInit(TIM2, &timerInitStructure);
  TIM_Cmd(TIM2, ENABLE);
}

Thank you for your answers..

Outcomes