刚入门的新手请教定时器设置。查看例程看不是很明白,以下设置是多久中断一次?如果我想改为5秒中断一次该如何调整?
/* Compute the prescaler value */
PrescalerValue = (uint16_t) ((SystemCoreClock ) / 32000000) - 1;//配置频率为32M
/* Time base configuration */
TIM_TimeBaseStructure.TIM_Period = 10;
TIM_TimeBaseStructure.TIM_Prescaler = 0;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
/* Prescaler configuration */
TIM_PrescalerConfig(TIM2, PrescalerValue, TIM_PSCReloadMode_Immediate);//每次UPdate重新初始化计数器
-----------------------------------------------------------------------
|