дедуктивный метод + опыт поколений. Ну еще шина земли может быть
плохонькая. прога
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
//##########################################################################//
// // /* ADC1 Periph clock enable */
//**************************************************************************//
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); //
//--------------------------- //
// nitialize ADC structure */ //
ADC_StructInit(&ADC_InitStructure); //
//**************************************************************************//
// Configure the ADC1 in continuous mode with resolut equal to 12 bits //
//==========================================================================//
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Upward; //
ADC_Init(ADC1, &ADC_InitStructure); //
//--------------------------------------------------------------------------//
//=======================================================================//
ADC_DeInit(ADC1); //
//=======================================================================//
// Включим канал №1
//-----------------------------------------------------------------------//
ADC_ChannelConfig(ADC1, ADC_Channel_1 , ADC_SampleTime_239_5Cycles); //
//-----------------------------------------------------------------------//
ADC_GetCalibrationFactor(ADC1); //
//-----------------------------------------------------------------------//
ADC_Cmd(ADC1, ENABLE)