我想使用stm32f746NG_Discovery板的timer8,但不知道如何配置。谁有简单的keil代码?
6vl6ewon1#
tim8配置更新中断
__HAL_RCC_TIM8_CLK_ENABLE(); TIM8 -> PSC = 999; TIM8 -> ARR = SystemCoreClock / ((TIM8 -> PSC + 1) * freq) - 1; TIM8 -> EGR |= TIM_EGR_UG; if(TIM8 -> SR & TIM_SR_UIF) TIM8 -> SR = ~(TIM_SR_UIF); TIM8 -> DIER |= TIM_DIER_UIE; TIM8 -> CR1 = TIM_CR1_CEN; NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn);
1条答案
按热度按时间6vl6ewon1#
tim8配置更新中断