开t3定时100uS中断, 在中断中改变IO状态,示波器测试50uS中断,奇怪。
放上程序:
/* -----------------------------------------------------------------------
TIM3CLK = 24 MHz, Prescaler = 23, TIM3 counter clock = 24 MHz / 24 = 1Mhz
TIM3 ARR Register = 100 => TIM3 Frequency = TIM3 counter clock / (ARR + 1)
TIM3 Frequency = 10K
Timer 的计数方式是 0 ---> TIM_Period ----> 0
----------------------------------------------------------------------- */
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
/* TIM3 clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
/* Time base configuration */
TIM_TimeBaseStructure.TIM_Period = 100;
TIM_TimeBaseStructure.TIM_Prescaler = 23;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
TIM_ARRPreloadConfig(TIM3, ENABLE);
/* TIM3 DISABLE counter */
TIM_Cmd(TIM3, ENABLE); //TIM3 enable counter , TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE); |