//TIME2初始化
。。。
/* TIMERS clock enable */
RCC_APB1PeriphClock_Enable(RCC_APB1PERIPH_TIMER2|RCC_APB1PERIPH_TIMER3,ENABLE);
/* TIMER2 configuration */
TIMER_DeInit(TIMER2);
TIM_TimeBaseStructure.TIMER_Prescaler = 0;
TIM_TimeBaseStructure.TIMER_CounterMode = TIMER_COUNTER_UP;
TIM_TimeBaseStructure.TIMER_Period = 65535;
TIM_TimeBaseStructure.TIMER_ClockDivision = TIMER_CDIV_DIV1;
TIMER_BaseInit(TIMER2,&TIM_TimeBaseStructure);
/* Auto-reload preload enable */
//TIMER_CARLPreloadConfig(TIMER2,DISABLE);
/* Clear the UPDATE Interrupt flag an Enable the UPDATE Interrupt Request */
TIMER_ClearIntBitState(TIMER2,TIMER_INT_UPDATE);
TIMER_INTConfig(TIMER2,TIMER_INT_UPDATE,ENABLE);
/* TIMER enable counter*/
TIMER_Enable( TIMER2, ENABLE );
。。。
//TIME2初始化结束
void TIM2_IRQHandler(void)
{
if(TIMER_GetIntBitState(TIMER2,TIMER_INT_UPDATE)==ENABLE)
{
TIMER_Enable( TIMER2, DISABLE );
TIMER_ClearIntBitState(TIMER2,TIMER_INT_UPDATE);
}
}
上面配置好TIME2之后。为什么在TIME2计数满后没有停止计数?一直在循环计数.
|