SHARE
TWEET

timer_stm32

2andnot Apr 22nd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     //настройка таймера
  2.     RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
  3.     TIM2->PSC = 800;//пределитель
  4.     TIM2->ARR = 10;//до какого числа считаем
  5.     TIM2->CNT = 0;//с какого числа начинаем отсчет
  6.     TIM2->DIER |= TIM_DIER_UIE;//
  7.     TIM2->CR1|=(TIM_CR1_CEN|TIM_CR1_ARPE|TIM_CR1_URS);
  8.     NVIC_SetPriority(TIM2_IRQn, (1<<__NVIC_PRIO_BITS)-1);//установка приоритета прерывания
  9.     NVIC_EnableIRQ(TIM2_IRQn);//включение прерывания
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top