个人感觉 这个芯片的AD转化不准确!
CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE)
ADC_DeInit(ADC1);
/* Initialize and configure ADC1 */
ADC_Init(ADC1, ADC_ConversionMode_Single,
ADC_Resolution_12Bit, ADC_Prescaler_1);
ADC_SamplingTimeConfig(ADC1, ADC_Group_SlowChannels,
ADC_SamplingTime_384Cycles);
/* Enable ADC1 Channel 10*/
ADC_ChannelCmd(ADC1,ADC_Channel_10, ENABLE);
//ADC1->SQR[regindex] |= (uint8_t)(ADC_Channels);
//ADC_ITConfig(ADC1, ADC_IT_EOC, DISABLE);
ADC_VrefintCmd(ENABLE);
ADC_Cmd(ADC1, ENABLE);这是AD的初始化
这是主程序所用的内容:
ADC_SoftwareStartConv(ADC1);
//delay(1000);
while(ADC_GetFlagStatus(ADC1,ADC_FLAG_EOC) == 0 );
j=ADC_GetConversionValue(ADC1);
if(j>0x00FF)
{
ADC_ClearFlag(ADC1,ADC_FLAG_EOC);
start_work( );
//ADC_ClearITPendingBit(ADC1, ADC_IT_EOC);
}