STM32f030xx的定时器中断,无法写寄存器。下面是我的配置:
RCC_APB1PeriphResetCmd(RCC_APB1Periph_
tiM3, ENABLE);
TIM_TimeBaseInitStructure.TIM_Prescaler = 2;
TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInitStructure.TIM_Period = 999;
TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseInit(TIMx,&TIM_TimeBaseInitStructure);
NAVI_InitStructure.NVIC_IRQChannel = IRQn;
NAVI_InitStructure.NVIC_IRQChannelPriority = 0;
NAVI_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NAVI_InitStructure);
TIM_ITConfig(TIMx,TIM_IT_Update,ENABLE);
TIM_Cmd(TIMx,ENABLE);
调试时发现,能进入TIM_TimeBaseInit(TIMx,&TIM_TimeBaseInitStructure)里面,传过去的值也是我设置的值,但是进行就是写不了寄存器,寄存器的值全部是0.有人知道是什么原因吗?有大神出来为小弟解答疑惑么?谢谢啦
一周热门 更多>