用TIM1 的TIM_TRGOSource_Update触发ADC,发现我需要的
TIM_TimeBaseStructure.TIM_Prescaler = 48-1;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
设置不能实现,只有 TIM_TimeBaseStructure.TIM_Period = 50000-1;起作用
void TIM1_Config(void)
{
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
TIM_DeInit(TIM1);
TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
TIM_OCStructInit(&TIM_OCInitStructure);
//Time base configuration
TIM_TimeBaseStructure.TIM_Period = 50000-1;
TIM_TimeBaseStructure.TIM_Prescaler = 48-1;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
TIM_SelectOutputTrigger(TIM1, TIM_TRGOSource_Update);
TIM_Cmd(TIM1, DISABLE);
} |