當前位置: 首頁>>代碼示例>>C++>>正文


C++ ADC_GetResetCalibrationStatus函數代碼示例

本文整理匯總了C++中ADC_GetResetCalibrationStatus函數的典型用法代碼示例。如果您正苦於以下問題:C++ ADC_GetResetCalibrationStatus函數的具體用法?C++ ADC_GetResetCalibrationStatus怎麽用?C++ ADC_GetResetCalibrationStatus使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ADC_GetResetCalibrationStatus函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ADC_Initialize

/**
  * @brief ADC初始化
	* @param none
  * @retval none
  * @note  初始化PA.00為ADC1_CH0,單次轉換,軟件觸發ADC轉換
  */ 
void ADC_Initialize(void)
{
	ADC_InitTypeDef ADC_InitStructure;
	GPIO_InitTypeDef GPIO_InitStructure;
	
	/* 使能GPIOA,ADC1,AFIO時鍾 */
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_ADC1, ENABLE);

	/* 設置ADCCLK分頻因子 ADCCLK = PCLK2/6,即 72MHz/6 = 12MHz */
	RCC_ADCCLKConfig(RCC_PCLK2_Div6);

	/* 配置 PA.00 (ADC1_IN0) 作為模擬輸入引腳 */
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
	GPIO_Init(GPIOA, &GPIO_InitStructure);

	ADC_DeInit(ADC1);  //將ADC1設為缺省值
	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轉換
	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;					//ADC數據右對齊
	ADC_InitStructure.ADC_NbrOfChannel = 1;									//規則轉換通道數目
	ADC_Init(ADC1, &ADC_InitStructure);										//根據ADC_InitStruct初始化ADC

	ADC_Cmd(ADC1, ENABLE);	//使能ADC1

	ADC_ResetCalibration(ADC1);	//複位ADC校準寄存器
	while(ADC_GetResetCalibrationStatus(ADC1));	//等待複位校準結束
	ADC_StartCalibration(ADC1);	 //開啟AD校準
	while(ADC_GetCalibrationStatus(ADC1));	 //等待校準結束 
}
開發者ID:gongyuzicong,項目名稱:2.4g_controler,代碼行數:38,代碼來源:adc.c

示例2: ADC1_Mode_Config

/* 函數名:ADC1_Mode_Config*/
static void ADC1_Mode_Config(void)
{
	DMA_InitTypeDef DMA_InitStructure;
	ADC_InitTypeDef ADC_InitStructure;
	
	/* DMA channel1 configuration */
	DMA_DeInit(DMA1_Channel1);
	DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;	 //ADC地址
	DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADC_ConvertedValue;//內存地址
	DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
	DMA_InitStructure.DMA_BufferSize = 4;//開辟4個儲存空間
	DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;//外設地址固定
	DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;  //內存地址遞增使能
	DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;	//半字 16位
	DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
	DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;		//循環傳輸
	DMA_InitStructure.DMA_Priority = DMA_Priority_High;//高優先級
	DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
	DMA_Init(DMA1_Channel1, &DMA_InitStructure);
	
	/* Enable DMA channel1 */
	DMA_Cmd(DMA1_Channel1, ENABLE);
	
	/* ADC1 configuration */
	
	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;	//獨立ADC模式
	ADC_InitStructure.ADC_ScanConvMode = ENABLE ; 	 //禁止掃描模式,掃描模式用於多通道采集
	ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;	//開啟連續轉換模式,即不停地進行ADC轉換
	ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;	//不使用外部觸發轉換
	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; 	//采集數據右對齊
	ADC_InitStructure.ADC_NbrOfChannel = 4;	 	//要轉換的通道數目1
	ADC_Init(ADC1, &ADC_InitStructure);
	
	/*配置ADC時鍾,為PCLK2的8分頻,即9Hz*/
	RCC_ADCCLKConfig(RCC_PCLK2_Div8); 
	/*ADCx,通道編號,掃描順序,采樣周期 */ 
	ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_1Cycles5);//電池電壓
	ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 2, ADC_SampleTime_1Cycles5);//轉把
	ADC_RegularChannelConfig(ADC1, ADC_Channel_5, 3, ADC_SampleTime_1Cycles5);//左電機電流
	ADC_RegularChannelConfig(ADC1, ADC_Channel_6, 4, ADC_SampleTime_1Cycles5);//右電機電流
	
	/* Enable ADC1 DMA */
	ADC_DMACmd(ADC1, ENABLE);
	
	/* Enable ADC1 */
	ADC_Cmd(ADC1, ENABLE);
	
	/*複位校準寄存器 */   
	ADC_ResetCalibration(ADC1);
	/*等待校準寄存器複位完成 */
	while(ADC_GetResetCalibrationStatus(ADC1));
	
	/* ADC校準 */
	ADC_StartCalibration(ADC1);
	/* 等待校準完成*/
	while(ADC_GetCalibrationStatus(ADC1));
	
	/* 由於沒有采用外部觸發,所以使用軟件觸發ADC轉換 */ 
	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
開發者ID:FrankEos,項目名稱:BlanceMoto,代碼行數:61,代碼來源:assignment2.c

示例3: adc_init

void adc_init() {
	ADC_InitTypeDef ADC_InitStructure;

	RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 , ENABLE);

	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
	ADC_InitStructure.ADC_ScanConvMode = DISABLE;
	ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
	ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
	ADC_InitStructure.ADC_NbrOfChannel = 1;
	ADC_Init(ADC1, &ADC_InitStructure);

	ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 1, ADC_SampleTime_239Cycles5);

	ADC_TempSensorVrefintCmd(ENABLE);

	ADC_Cmd(ADC1, ENABLE);

	ADC_ResetCalibration(ADC1);
	while(ADC_GetResetCalibrationStatus(ADC1));

	ADC_StartCalibration(ADC1);
	while(ADC_GetCalibrationStatus(ADC1));

	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
開發者ID:spacerace,項目名稱:HY-MiniSTM32V,代碼行數:27,代碼來源:main.c

示例4: __ADC_Init

static void __ADC_Init(void)
{
	ADC_InitTypeDef ADC_InitStructure;
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
  ADC_InitStructure.ADC_ScanConvMode = ENABLE;
  ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
  ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
  ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;	
  ADC_InitStructure.ADC_NbrOfChannel = (USE_ADC_PB0 + USE_ADC_PB1 + USE_ADC_PA4 + USE_ADC_PC0); //Change
	ADC_Init(ADC1, &ADC_InitStructure);
	#if (USE_ADC_PB0 == 1)
	ADC_RegularChannelConfig(ADC1, ADC_Channel_8, 1, ADC_SampleTime_55Cycles5);
	#endif
	#if (USE_ADC_PB1 == 1)
	ADC_RegularChannelConfig(ADC1, ADC_Channel_9, 2, ADC_SampleTime_55Cycles5);
	#endif
	#if (USE_ADC_PA4 == 1)
	ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 3, ADC_SampleTime_55Cycles5);
	#endif
	#if (USE_ADC_PC0 == 1)
	ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 4, ADC_SampleTime_55Cycles5);
	#endif
	ADC_DMACmd(ADC1, ENABLE);
	ADC_Cmd(ADC1, ENABLE);
	ADC_ResetCalibration(ADC1);
	while(ADC_GetResetCalibrationStatus(ADC1));
	ADC_StartCalibration(ADC1);
	while(ADC_GetCalibrationStatus(ADC1));
	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
開發者ID:NguyenTrongThinh,項目名稱:HapticDevice,代碼行數:32,代碼來源:AMES_ACS712.c

示例5: Accel_ADC_Configuration

/**
 * @brief Initializes the ADC used by the Accelerometer.
 * @retval None
 */
void Accel_ADC_Configuration() {
  ADC_InitTypeDef ADC_InitStructure;

  ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
  ADC_InitStructure.ADC_ScanConvMode = ENABLE;
  ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
  ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
  ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
  ADC_InitStructure.ADC_NbrOfChannel = 3;
  ADC_Init(ADC1, &ADC_InitStructure);

  /* ADC1 regular channel 10, 11, 12 configuration */ 
  ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_55Cycles5);
  ADC_RegularChannelConfig(ADC1, ADC_Channel_11, 2, ADC_SampleTime_55Cycles5);
  ADC_RegularChannelConfig(ADC1, ADC_Channel_12, 3, ADC_SampleTime_55Cycles5);

  /* Enable ADC1 DMA */
  ADC_DMACmd(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));
     
  /* Start ADC1 Software Conversion */ 
  ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
開發者ID:zwasson,項目名稱:project-blox,代碼行數:39,代碼來源:blox_accel.c

示例6: fft_ADC_Init

void fft_ADC_Init(void)
{ 	
	ADC_InitTypeDef ADC_InitStructure; 
	GPIO_InitTypeDef GPIO_InitStructure;
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_ADC1,ENABLE);	 
 
//	RCC_ADCCLKConfig(RCC_PCLK2_Div6);                                  
	RCC_ADCCLKConfig(RCC_PCLK2_Div8);                                   
	                       
	GPIO_InitStructure.GPIO_Pin  = GPIO_Pin_1 | GPIO_Pin_2;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;		               
	GPIO_Init(GPIOC, &GPIO_InitStructure);	

	ADC_DeInit(ADC1);                                                

	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);	                              
 
	ADC_Cmd(ADC1, ENABLE);	                                           
	ADC_ResetCalibration(ADC1);	                                       
	while(ADC_GetResetCalibrationStatus(ADC1));	                        
	ADC_StartCalibration(ADC1);		                                 
	while(ADC_GetCalibrationStatus(ADC1));		                        
	ADC_SoftwareStartConvCmd(ADC1, ENABLE);		                       
}				  
開發者ID:elvislili,項目名稱:rgbledcube,代碼行數:30,代碼來源:ADC.c

示例7: my_random_ADC_Init

/*
      Function £º
			  Initialize ADC function 
	    Parameters£º

	    Return values£º

*/
static my_random_ADC_Init(void)
{
 	ADC_InitTypeDef ADC_InitStructure;
 
    //The following are ADC1's registers settings 
  	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;//AD module will select as independent mode 
  	ADC_InitStructure.ADC_ScanConvMode = ENABLE;//auto scan mode has been enable 
  	ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;//Continuous convertion mode is enable 
  	ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;//Not external trigger interrupt function  
  	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;//data align to right 
  	ADC_InitStructure.ADC_NbrOfChannel = 1;//initialize ADC channel into 1 
  	ADC_Init(ADC1, &ADC_InitStructure);//Build ADC1 settings 
  	//PA0 & ADC1 related channel is 0
  	ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_55Cycles5);
	  //USE ADC1
  	ADC_Cmd(ADC1, ENABLE);
  	//Reset ADC1's regiters  
  	ADC_ResetCalibration(ADC1);
    //Wait until the reset has been done  	
  	while(ADC_GetResetCalibrationStatus(ADC1));
  	//Start the calibration for ADC1 
  	ADC_StartCalibration(ADC1);
  	//Wait until ADC1 calibration has been done  	
  	while(ADC_GetCalibrationStatus(ADC1));
    //Convert to use ADC1 
  	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
開發者ID:bangbh81,項目名稱:MbedTLS-Test,代碼行數:35,代碼來源:Random.c

示例8: InitADC

void InitADC(void) {
	ADC_InitTypeDef adc;

	RCC_ADCCLKConfig(RCC_PCLK2_Div6);

	adc.ADC_Mode = ADC_Mode_Independent;
	adc.ADC_NbrOfChannel = 1;
	adc.ADC_ScanConvMode = DISABLE;
	adc.ADC_DataAlign = ADC_DataAlign_Right;
	adc.ADC_ContinuousConvMode = ENABLE;
	adc.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
	ADC_Init(AN_ADCx, &adc);

	ADC_RegularChannelConfig(AN_ADCx, AN_CHx, 1, ADC_SampleTime_7Cycles5);
	ADC_Cmd(AN_ADCx, ENABLE);

	ADC_ResetCalibration(AN_ADCx);

	while (ADC_GetResetCalibrationStatus(AN_ADCx)) {};
	ADC_StartCalibration(AN_ADCx);

	while (ADC_GetCalibrationStatus(AN_ADCx));
	ADC_SoftwareStartConvCmd(AN_ADCx,ENABLE);


}
開發者ID:mkdxdx,項目名稱:stm32f100_mgdet,代碼行數:26,代碼來源:main.c

示例9: adcInit

// --------------------------------------------------------------------------
void adcInit(const UINT8 ui8_reference, const UINT8 ui8_prescaler)
{
	ADC_InitTypeDef adc;

	// suppress compiler complaints
	(void)ui8_reference;

	// configure ADC clock (must not exceed 14MHz)
	RCC_ADCCLKConfig(prescaler_reg[ui8_prescaler]);
	RCC_APB2PeriphClockCmd(ADC_RCC, ENABLE);

	// reset current settings
	ADC_DeInit(ADC_PERIPH);
	
	ADC_StructInit(&adc);
	adc.ADC_Mode = ADC_Mode_Independent;
	adc.ADC_ScanConvMode = DISABLE;
	adc.ADC_ContinuousConvMode = DISABLE;
	adc.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
	adc.ADC_DataAlign = ADC_DataAlign_Right;
	adc.ADC_NbrOfChannel = 1;
	ADC_Init(ADC_PERIPH, &adc);
	ADC_Cmd(ADC_PERIPH, ENABLE);

	// perform calibration, not needed but it don't hurt
	ADC_ResetCalibration(ADC_PERIPH);
  	WAIT_FOR(ADC_GetResetCalibrationStatus(ADC_PERIPH));
	ADC_StartCalibration(ADC_PERIPH);
	WAIT_FOR(ADC_GetCalibrationStatus(ADC_PERIPH));
}
開發者ID:obeny,項目名稱:ehal-stm32,代碼行數:31,代碼來源:adc_march.c

示例10: USART1_IRQHandler

/*******************************************************************************
* Function Name  : USART1_IRQHandler
* Description    : This function handles USART1 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USART1_IRQHandler(void)
{	

	USART_ClearITPendingBit(USART1, USART_IT_RXNE);
	
   if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
   {
	   	Rx_Buffer[data]=USART_ReceiveData(USART1);
			
		Usart_Putnum(Rx_Buffer[data]);

		if(Rx_Buffer[data]==1){
			/* Enable ADC1 DMA */
		    ADC_DMACmd(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));
		 
		    /* Start ADC1 Software Conversion */ 
		    ADC_SoftwareStartConvCmd(ADC1, ENABLE);
		}

		else if(Rx_Buffer[data]==2)
			 ADC_Cmd(ADC1, DISABLE);
		else if(Rx_Buffer[data]==3)
		Usart_Putnum(TIM_GetCounter(TIM4));
		
	
   }

   
	//{	
		//Rx_Buffer[data]=data;
		//data++;
		//USART_ClearITPendingBit(USART1, USART_IT_RXNE);
		/*Rx_Buffer[data]=USART_ReceiveData(USART1);
		
		Usart_Putnum(Rx_Buffer[data]);
		data++;*/
		/*
		if(Rx_Buffer[data]==1)
		Usart_Putnum(10);
		else if(Rx_Buffer[data]==2)
		Usart_Putnum(20);
		*/
	
    
	
	
}
開發者ID:JinhoAndyPark,項目名稱:ARM,代碼行數:67,代碼來源:stm32f10x_it.c

示例11: ADC_Configuration

void ADC_Configuration(void)
{
  ADC_InitTypeDef  ADC_InitStructure;
  RCC_ADCCLKConfig(RCC_PCLK2_Div6);                                    // PCLK2 is the APB2 clock, ADCCLK = PCLK2/6 = 60/6 = 10MHz
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);                 // Enable ADC1 clock so that we can talk to it
  ADC_DeInit(ADC1);                                                    // Put everything back to power-on defaults

  ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;                   // ADC2 not depenedent on ADC1
  ADC_InitStructure.ADC_ScanConvMode = DISABLE;                        // Disable the scan conversion so we do one at a time
  ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;                  // Don't do contimuous conversions - do them on demand
  ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;  // Start conversin by software, not an external trigger
  ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;               // Conversions are 12 bit - put them in the lower 12 bits of the result
  ADC_InitStructure.ADC_NbrOfChannel = 1;                              // How many channels would be used by the sequencer
  ADC_Init(ADC1, &ADC_InitStructure);
  ADC_Cmd(ADC1, ENABLE);

  ADC_ResetCalibration(ADC1);                                           // Enable ADC1 reset calibaration register
  while(ADC_GetResetCalibrationStatus(ADC1));                           // Check the end of ADC1 reset calibration register
  ADC_StartCalibration(ADC1);                                           // Start ADC1 calibaration
  while(ADC_GetCalibrationStatus(ADC1));                                // Check the end of ADC1 calibration
  ADC_TempSensorVrefintCmd(ENABLE);                                     // enable Vrefint and Temperature sensor

  GPIO_InitTypeDef  GPIO_InitStructure;
  GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_0;                           // Pin #0
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_AIN;                        // as analog input
  GPIO_Init(GPIOB, &GPIO_InitStructure);                                // for Port B

}
開發者ID:pola14225,項目名稱:diy-tracker,代碼行數:28,代碼來源:adc.cpp

示例12: sensor_init

void sensor_init(void)
{
    // 0. Run clocks
    RCC_AHBPeriphClockCmd(SENSORS_DMA_RCC, ENABLE);
    RCC_APB2PeriphClockCmd(SENSORS_ADC_RCC, ENABLE);

    // 1. Init ADC
    ADC_Init(SENSORS_ADC, &_adc);

    // 2. Init DMA for writing measures directly to array
    DMA_Init(SENSORS_DMA, &_dma); // SENSORS_ADC is on DMA1 channel 1

    // 3. Setup SENSORS_ADC to send DMA requests
    ADC_DMACmd(SENSORS_ADC, ENABLE);

    // 4. Enable DMA
    DMA_Cmd(SENSORS_DMA, ENABLE);

    // 5. Enable ADC
    ADC_Cmd(SENSORS_ADC, ENABLE);

    // 6. Calibrate ADC
    ADC_ResetCalibration(SENSORS_ADC);
    while(ADC_GetResetCalibrationStatus(SENSORS_ADC));;;

    ADC_StartCalibration(SENSORS_ADC);
    while(ADC_GetCalibrationStatus(SENSORS_ADC));;;
}
開發者ID:webconn,項目名稱:CereMotor,代碼行數:28,代碼來源:sensors.c

示例13: TEMP_Init

void TEMP_Init()			//單次,單通道
{
	ADC_InitTypeDef ADC_InitStructure;
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_ADC1,ENABLE);
	RCC_ADCCLKConfig(RCC_PCLK2_Div6);			//ADC時鍾 = 72M/6 = 12M;
	
	
	//ADC_初始化
	ADC_DeInit(ADC1);
	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);

	ADC_TempSensorVrefintCmd(ENABLE);	//使能內部溫度傳感器(或參考電壓)//======
	ADC_Cmd(ADC1,ENABLE);

	//校準
	ADC_ResetCalibration(ADC1);
	while(ADC_GetResetCalibrationStatus(ADC1));
	ADC_StartCalibration(ADC1);
	while(ADC_GetCalibrationStatus(ADC1));
}
開發者ID:chenghongyao,項目名稱:gitprogram,代碼行數:27,代碼來源:temp.c

示例14: main

int main(void) {
  GPIO_InitTypeDef GPIO_InitStructure;
  TIM_TimeBaseInitTypeDef TIM_InitStructure;
  ADC_InitTypeDef ADC_InitStructure;
  NVIC_InitTypeDef NVIC_InitStructure;

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOA | RCC_APB2Periph_ADC1, ENABLE);
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);

  GPIO_StructInit(&GPIO_InitStructure);
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  GPIO_Init(GPIOC, &GPIO_InitStructure);

  GPIO_StructInit(&GPIO_InitStructure);
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  TIM_TimeBaseStructInit(&TIM_InitStructure);
  TIM_InitStructure.TIM_Prescaler = 10000;
  TIM_InitStructure.TIM_Period = 100;
  TIM_InitStructure.TIM_CounterMode = TIM_CounterMode_Up;
  TIM_TimeBaseInit(TIM3, &TIM_InitStructure);

  TIM_SelectOutputTrigger(TIM3, TIM_TRGOSource_Update);

  ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
  ADC_InitStructure.ADC_ScanConvMode = DISABLE;
  ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
  ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T3_TRGO;
  ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
  ADC_InitStructure.ADC_NbrOfChannel = 1;
  ADC_Init(ADC1, &ADC_InitStructure);

  ADC_RegularChannelConfig(ADC1, ADC_Channel_6, 1, ADC_SampleTime_55Cycles5);
  ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE);
  ADC_ExternalTrigConvCmd(ADC1, ENABLE);

  NVIC_InitStructure.NVIC_IRQChannel = ADC1_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);

  ADC_Cmd(ADC1, ENABLE);

  while(ADC_GetResetCalibrationStatus(ADC1));
  ADC_StartCalibration(ADC1);
  while(ADC_GetCalibrationStatus(ADC1));

  TIM_Cmd(TIM3, ENABLE);

  if (SysTick_Config(SystemCoreClock / 1000))
    while (1);

  while(1);
}
開發者ID:rummanwaqar,項目名稱:STM32VL_Examples,代碼行數:59,代碼來源:main.c

示例15: ADC1_Mode_Config

/* 函數名:ADC1_Mode_Config
 * 描述  :配置ADC1的工作模式為MDA模式
 *
 *             使用 DMA1 的通道 1,數據從 ADC 外設的數據寄存器(ADC1_DR_Address)
 *         轉移到內存(ADC_ConvertedValue 變量),內存、外設地址都固定,每次傳輸的
 *         數據大小為半字(16 位),使用 DMA 循環傳輸模式。
 *
 * 輸入  : 無
 * 輸出  :無
 * 調用  :內部調用
 */
static void ADC1_Mode_Config(void)
{
	DMA_InitTypeDef DMA_InitStructure;
	ADC_InitTypeDef ADC_InitStructure;
	
	/* DMA channel1 configuration */
	DMA_DeInit(DMA1_Channel1);

	/* ADC_DR 數據寄存器保存了 ADC 轉換後的數值,以它作為 DMA 的傳輸源地址 */
	DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;	 //ADC1_DR規則寄存器的地址,查RM0008 STM32F10x參考手冊

	DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADC_ConvertedValue;//ADC_ConvertedValue的內存地址
	DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
	DMA_InitStructure.DMA_BufferSize = 1;
	DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;//外設地址固定
	DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;  //內存地址固定
	DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;	//半字
	DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
	DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;		//循環傳輸
	DMA_InitStructure.DMA_Priority = DMA_Priority_High;
	DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
	DMA_Init(DMA1_Channel1, &DMA_InitStructure);
	
	/* Enable DMA channel1 */
	DMA_Cmd(DMA1_Channel1, ENABLE);
	
	/* ADC1 configuration */	
	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;	//獨立ADC模式
	ADC_InitStructure.ADC_ScanConvMode = DISABLE ; 	 //禁止掃描模式,掃描模式用於多通道采集
	ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;	//開啟連續轉換模式,即不停地進行ADC轉換
	ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;	//不使用外部觸發轉換
	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; 	//采集數據右對齊
	ADC_InitStructure.ADC_NbrOfChannel = 1;	 	//要轉換的通道數目1
	ADC_Init(ADC1, &ADC_InitStructure);
	
	/*配置ADC時鍾,為PCLK2的8分頻,即9Hz*/
	RCC_ADCCLKConfig(RCC_PCLK2_Div8); 
	/*配置ADC1的通道7為55.	5個采樣周期,序列為1 */ 
	ADC_RegularChannelConfig(ADC1, ADC_Channel_7, 1, ADC_SampleTime_55Cycles5);
	
	/* Enable ADC1 DMA */
	ADC_DMACmd(ADC1, ENABLE);
	
	/* Enable ADC1 */
	ADC_Cmd(ADC1, ENABLE);
	
	/*複位校準寄存器 */   
	ADC_ResetCalibration(ADC1);
	/*等待校準寄存器複位完成 */
	while(ADC_GetResetCalibrationStatus(ADC1));
	
	/* ADC校準 */
	ADC_StartCalibration(ADC1);
	/* 等待校準完成*/
	while(ADC_GetCalibrationStatus(ADC1));
	
	/* 由於沒有采用外部觸發,所以使用軟件觸發ADC轉換 */ 
	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
開發者ID:vcheung,項目名稱:STM32,代碼行數:70,代碼來源:adc.c


注:本文中的ADC_GetResetCalibrationStatus函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。