tim配置如下 TIM_TimeBaseStructure.TIM_Period = 250;//自动重装值 TIM_TimeBaseStructure.TIM_Prescaler = 179;//予分频 TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Down;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); TIM_ARRPreloadConfig(TIM3,ENABLE); //允许重装 TIM_Period //TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE);//允许更新中断 TIM_SelectOutputTrigger(TIM3,TIM_TRGOSource_Enable);//更新输出 trgo TIM_Cmd(TIM3, ENABLE); //TIM3 运行
AD配置如下 ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC1,ADC2独立工作 ADC_InitStructure.ADC_ScanConvMode = ENABLE; //多信道工作 ADC_InitStructure.ADC_ContinuousConvMode = DISABLE ; //单次转换 ENABLE; ADC_InitStructure.ADC_ExternalTrigConv =ADC_ExternalTrigConv_T3_TRGO ;//触发源 ADC_ExternalTrigConv_T3_TRGO ;ADC_ExternalTrigConv_None ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //数据右对齐 ADC_InitStructure.ADC_NbrOfChannel = 6;//指定规则通道数 ADC_Init(ADC1, &ADC_InitStructure); //初始化
ad总是无法启动,郁闷
|