// 工作模式配置 ----------------------------------------------------------------
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfChannel = 8;
ADC_Init(ADC1, &ADC_InitStructure);
// 采样顺序及时间配置 ----------------------------------------------------------
ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 1, ADC_SampleTime_71Cycles5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_5, 2, ADC_SampleTime_71Cycles5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_6, 3, ADC_SampleTime_71Cycles5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_7, 4, ADC_SampleTime_71Cycles5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 5, ADC_SampleTime_71Cycles5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_15, 6, ADC_SampleTime_71Cycles5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_8, 7, ADC_SampleTime_71Cycles5);
ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 8, ADC_SampleTime_71Cycles5);
//间断模式配置------------------------------------------------------------------
ADC_DiscModeCmd(ADC1);
ADC_DiscModeChannelCountConfig(ADC1,1);
//------------------------------------------------------------------------------
//ADC_DMA_Set(ADC1); // 开启 DMA
ADC_TempSensorVrefintCmd(); // 使能温度传感器和 Vrefint通道
ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE); // 开转换完成中断
ADC_Cmd_Set(ADC1); // 启动 ADC
ADC_ResetCalibration(ADC1); // 初始化校准寄存器
while(ADC_GetResetCalibrationStatus(ADC1));
ADC_StartCalibration(ADC1); // 校准
while(ADC_GetCalibrationStatus(ADC1));
配置如下,但是不知道如果读取???? |