Hi,
For ADC measurement, there is two ways : continous conversion mode that needs DMA, and single conversion mode. 
With the second solution, you have to configure and calibrate the ADC, and then to launch a conversion when needed, while with the first solution, the DMA updates automatically the memory with the converted value.
For the DMA solution, you can take a look to the "ADC1_DMA" example from the ST library examples.
Foth the single conversion solution, you can find hereafter a program example for the extension Primer "Cx_ADC1" signal acquisition.
Initialization :
/*******************************************************************************
* Function Name  : ADConverter_Init
* Description    : Initialize ADC for measuring.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
void ADConverter_Init( void )
    {
    ADC_InitTypeDef  ADC_InitStructure;
    GPIO_InitTypeDef GPIO_InitStructure;
    
    // Enable PORT clock 
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
    
    /* Configure pin as analog input ---------------*/
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
    GPIO_Init(GPIO_C, &GPIO_InitStructure);
    
    /* Enable ADC1 clock */
    RCC_APB2PeriphClockCmd( RCC_APB2Periph_ADC1, ENABLE );
    /* ADC1 Configuration ------------------------------------------------------*/
    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        = 1; 
    ADC_Init( ADC1, &ADC_InitStructure );
    /* ADC1 Regular Channel 14 */
    ADC_RegularChannelConfig( ADC1, ADC_Channel_14,  1, ADC_SampleTime_239Cycles5);
    /* Enable ADC1 external trigger conversion */
    ADC_ExternalTrigConvCmd( ADC1, ENABLE );  
    /* Enable ADC1  */
    ADC_Cmd(ADC1, ENABLE);
    /* Enable ADC1 reset calibaration register */   
    ADC_ResetCalibration(ADC1);
    /* Check the end of ADC1 reset calibration register */
    while(ADC_GetResetCalibrationStatus(ADC1));
    /* Start ADC1 calibaration */
    ADC_StartCalibration(ADC1);
    /* Check the end of ADC1 calibration */
    while(ADC_GetCalibrationStatus(ADC1));   
    }
Acquisition :
/*******************************************************************************
* Function Name  : Get_Measure
* Description    : Get the ADC value.
* Input          : None.
* Output         : Value in points from 0 to 4096.
* Return         : None.
*******************************************************************************/
u16 Get_Measure()
    {
    // Start ADC1 Software Conversion
    ADC_SoftwareStartConvCmd( ADC1, ENABLE );
 
     // Wait for end of conversion
    while (ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET);
        
    // Return the conversion value
    return (ADC_GetConversionValue(ADC1));
    }
Yves
					Last edited by yrt (2009-11-23 08:04:24)