简体   繁体   中英

How to config TIMER in TIM_BASE for stm32f746NG_Discovery by Keil?

我想使用stm32f746NG_Discovery板的timer8,但我不知道如何配置它。任何人都有一个简单的keil代码,好吗?

Tim 8 configure update interrupt

__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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM