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


C++ ADC_RegularChannelConfig函數代碼示例

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


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

示例1: Get_Adc

u16 Get_Adc(u8 ch)
{
	ADC_RegularChannelConfig(ADC1,ch,1,ADC_SampleTime_239Cycles5);
	
	ADC_SoftwareStartConvCmd(ADC1,ENABLE);
	
	while(!ADC_GetFlagStatus(ADC1,ADC_FLAG_EOC));
	
	return ADC_GetConversionValue(ADC1);
}
開發者ID:CQUT-AC,項目名稱:AC_Project_Flower,代碼行數:10,代碼來源:adc.c

示例2: readADC1

uint16_t readADC1(uint8_t channel)
{
  ADC_RegularChannelConfig(ADC1, channel, 1, ADC_SampleTime_7Cycles5);
  // Start the conversion
  ADC_SoftwareStartConvCmd(ADC1, ENABLE);
  // Wait until conversion completion
  while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET);
  // Get the conversion value
  return ADC_GetConversionValue(ADC1);
}
開發者ID:Laurenceb,項目名稱:Dactyl,代碼行數:10,代碼來源:adc.c

示例3: ADC_Config

/**************************************************************/
//程 序 名: ADC_Config()
//開 發 者: chenhonglin
//入口參數: 無
//功能說明: ADC配置
//**************************************************************/
void ADC_Config(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;
	ADC_InitTypeDef ADC_InitStructure;

	RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE);
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 ;   // PC2 -> AD_SIG1  PC3-> AD_SIG2
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
	GPIO_Init(GPIOC, &GPIO_InitStructure);


	//ADC1 configuration
	//select continuous conversion mode
	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
	//We will convert multiple channels
	ADC_InitStructure.ADC_ScanConvMode = ENABLE;
	//we will convert one time
	ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;//
	//select no external triggering
	ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
	//right 12-bit data alignment in ADC data register
	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
	//2 channels conversion
	ADC_InitStructure.ADC_NbrOfChannel = 2;
	//load structure values to control and status registers
	ADC_Init(ADC1, &ADC_InitStructure);

	//configure each channel
	ADC_RegularChannelConfig(ADC1, ADC_Channel_12, 1, ADC_SampleTime_41Cycles5);
	ADC_RegularChannelConfig(ADC1, ADC_Channel_13, 2, ADC_SampleTime_41Cycles5);
	//Enable ADC1
	ADC_Cmd(ADC1, ENABLE);
	//enable DMA for ADC
	ADC_DMACmd(ADC1, ENABLE);
	//Enable ADC1 reset calibration register
	ADC_ResetCalibration(ADC1);
	//Check the end of ADC1 reset calibration register
	while (ADC_GetResetCalibrationStatus(ADC1));
	//Start ADC1 calibration
	ADC_StartCalibration(ADC1);
	//Check the end of ADC1 calibration
	while (ADC_GetCalibrationStatus(ADC1));
}
開發者ID:sunzhongmeng,項目名稱:ufun-demo,代碼行數:49,代碼來源:ADC.c

示例4: Touch_ADC1_Configuration

/**************************************************************************************
 Func: 四線觸摸端口配置
 Time: 2014-6-18
 Ver.: V1.0
 Note;
**************************************************************************************/
void Touch_ADC1_Configuration(void)
{
	ADC_InitTypeDef  ADC_InitStructure;
	ADC_DeInit(ADC1);  //將外設 ADC1 的全部寄存器重設為缺省值
	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;	//ADC工作模式:ADC1和ADC2工作在獨立模式
	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數據右對齊
	ADC_InitStructure.ADC_NbrOfChannel =TOUCH_ADC_CHN;	//順序進行規則轉換的ADC通道的數目
	ADC_Init(ADC1, &ADC_InitStructure);	//根據ADC_InitStruct中指定的參數初始化外設ADCx的寄存器
	ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_239Cycles5);
	ADC_RegularChannelConfig(ADC1, ADC_Channel_15, 2, ADC_SampleTime_239Cycles5);
	ADC_Cmd(ADC1, ENABLE);	   //使能指定的ADC1
	ADC_ResetCalibration(ADC1);	  //複位指定的ADC1的校準寄存器
	while(ADC_GetResetCalibrationStatus(ADC1));	//獲取ADC1複位校準寄存器的狀態,設置狀態則等待
	ADC_StartCalibration(ADC1);		//開始指定ADC1的校準狀態
	while(ADC_GetCalibrationStatus(ADC1));		//獲取指定ADC1的校準程序,設置狀態則等待
}
開發者ID:RTOS-Developers,項目名稱:TRTOS,代碼行數:25,代碼來源:Touch_Driver.c

示例5: readADC1

u16 readADC1(u8 channel) 
{ 
    /* Start the conversion */
    ADC_RegularChannelConfig(ADC1, channel, 1, ADC_SampleTime_1Cycles5);
    /* Wait until conversion completion */
    ADC_SoftwareStartConvCmd(ADC1, ENABLE);
    /* Get the conversion value */
    while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); 
    return ADC_GetConversionValue(ADC1); 
}
開發者ID:MBARM,項目名稱:MatchboxARM,代碼行數:10,代碼來源:main.c

示例6: ad_init

void ad_init() {
	RCC_PeriphClockCmd(RCC_ADC1, ENABLE);
	RCC_PeriphClockCmd(RCC_GPIOC, ENABLE);
	
	init_GPIO(GPIOC, GPIO_Pin_0, GPIO_Mode_AN, GPIO_Fast_Speed, GPIO_OType_PP, GPIO_PuPd_NOPULL);
	initCommon_ADC(ADC_Mode_Independent, ADC_Prescaler_Div2, ADC_DMAAccessMode_Disabled, ADC_TwoSamplingDelay_5Cycles);
	init_ADC(ADC_Resolution_12b, DISABLE, ENABLE, ADC_ExternalTrigConvEdge_None, ADC_ExternalTrigConv_T1_CC1, ADC_DataAlign_Right, 1);
	ADC_Cmd(ADC1,ENABLE);
	ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_144Cycles);
}
開發者ID:linilss,項目名稱:Sound-system-DAT290,代碼行數:10,代碼來源:grundsystem.c

示例7: Get_Adc

void Get_Adc(uint8_t ch)
{
	//清空最近一次ADC轉換的結果
	ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_55Cycles5);
	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
	while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC ));//等待轉換結束
	g_usAdcValue = ADC_GetConversionValue(ADC1);
	sum_Adc=sum_Adc+g_usAdcValue;
	g_usAdcValue=0;
}
開發者ID:Jeansfirm,項目名稱:glexer_HDPLC_COAXIAL,代碼行數:10,代碼來源:main.c

示例8: adc

static uint16_t adc( void )
{
    ADC_RegularChannelConfig( ADC1, ADC_CHANNEL, 1, ADC_SampleTime_239Cycles5 );
    ADC_SoftwareStartConvCmd( ADC1, ENABLE );
    while ( ADC_GetFlagStatus( ADC1, ADC_FLAG_EOC ) != SET )
        ;
    uint16_t res;
    res = ADC_GetConversionValue( ADC1 );
    return res;
}
開發者ID:glockwork,項目名稱:dfu,代碼行數:10,代碼來源:task_adc.c

示例9: ADC1_MODE_Config

 void ADC1_MODE_Config(void)
{

  DMA_InitTypeDef DMA_InitStructure;					//定義一個DMA結構體變量
  ADC_InitTypeDef ADC_InitStructure;					//定義一個ADC結構體變量

  DMA_DeInit(DMA1_Channel1);		  //開啟DMA1的第一通道
  DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;
  DMA_InitStructure.DMA_MemoryBaseAddr=(uint32_t)&ADC_ConvertedValue;
  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;	//DMA的轉換模式為SRC模式,由外設搬移到內存
  DMA_InitStructure.DMA_BufferSize = 1; //DMA緩存大小,1個
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;	//接收一次數據後,設備地址禁止後移
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;	//關閉接收一次數據後,目標內存地址後移
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;  //定義外設數據寬度為16位
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;  //DMA搬移數據尺寸,HalfWord就是為16位
  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;   //轉換模式,循環緩存模式。
  DMA_InitStructure.DMA_Priority = DMA_Priority_High;	//DMA優先級高
  DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;		  //M2M模式禁用
  DMA_Init(DMA1_Channel1, &DMA_InitStructure);          
  /* Enable DMA1 channel1 */
  DMA_Cmd(DMA1_Channel1, ENABLE);

  ADC_TempSensorVrefintCmd(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 = 1;
  ADC_Init(ADC1, &ADC_InitStructure);

  /* ADC1 regular channel14 configuration */ 
  ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 1, ADC_SampleTime_239Cycles5);

  /* 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:cquxutao,項目名稱:Competition,代碼行數:55,代碼來源:adc.c

示例10: 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;
  DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&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);

  DMA_ITConfig(DMA1_Channel1,DMA_IT_TC,ENABLE);
  /* Enable DMA channel1 */
  DMA_Cmd(DMA1_Channel1, DISABLE);
     
  /* ADC1 configuration */
  ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;	//獨立模式 每個ADC獨立工作
  ADC_InitStructure.ADC_ScanConvMode = ENABLE;				 //使用掃描模式  scan位設置
  ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;	// cont位設置 連續轉換模式
  ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;	;//EXTSEL 選擇啟動規則通道組轉換的外部事件 設置成有軟件控製
  ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;	//數據對齊 由軟件置位和清楚   這裏設置成右對齊
  ADC_InitStructure.ADC_NbrOfChannel = 1;		//規則通道序列長度 這些位由軟件定義在規則通道轉換序列中的通道數目 1個轉換 指定由多少個通道被轉換
  ADC_Init(ADC1, &ADC_InitStructure);

  /* ADC1 regular channel11 configuration */ 
  ADC_RegularChannelConfig(ADC1, ADC_Channel_9, 1, ADC_SampleTime_55Cycles5);	//轉換時間是55.5個周期

  /* 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:YANGXINZHE,項目名稱:1.5FLY,代碼行數:55,代碼來源:ADC.c

示例11: Get_Adc

u16 Get_Adc(u8 ch)   
{
  //éè?????¨ADCμ?1??ò×éí¨μà£?ò???DòáD£?2é?ùê±??
  ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_239Cycles5 );	//ADC1,ADCí¨μà,2é?ùê±???a239.5?ü?ú	  			    
  
  ADC_SoftwareStartConvCmd(ADC1, ENABLE);		//ê1?ü???¨μ?ADC1μ?èí?t×a?????ˉ1|?ü	
  
  while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC ));//μè′y×a???áê?
  
  return ADC_GetConversionValue(ADC1);	//·μ??×??üò?′?ADC11??ò×éμ?×a???á1?
}
開發者ID:li77leprince,項目名稱:Laparoscopic,代碼行數:11,代碼來源:adc_dma.c

示例12: Get_Adc

u16 Get_Adc(u8 ch)   
{
  	//設置指定ADC的規則組通道,一個序列,采樣時間
	ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_239Cycles5 );	//ADC1,ADC通道,采樣時間為239.5周期	  			    
  
	ADC_SoftwareStartConvCmd(ADC1, ENABLE);		//使能指定的ADC1的軟件轉換啟動功能	
	 
	while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC ));//等待轉換結束

	return ADC_GetConversionValue(ADC1);	//返回最近一次ADC1規則組的轉換結果
}
開發者ID:SxxSxx,項目名稱:Slave_basketball_arm_controller,代碼行數:11,代碼來源:BSP.c

示例13: main

int main(void)
{
    static unsigned int led_state = 0;

    RCC_ClocksTypeDef clockinfo;
    RCC_GetClocksFreq(&clockinfo);
    // regardless of clock speed this gives us 1000 ticks per second
    SysTick_Config(clockinfo.SYSCLK_Frequency / 1000);
    int blink_speed_ms = 400;

    setup_gpios();
    setup_adc();
    setup_usart();
    setup_button_irqs();

    kkputs("hello karl...\n");
    uint64_t lasttime = millis();
    while (1) {
        if (millis() - blink_speed_ms > lasttime) {
            if (led_state & 1) {
                switch_leds_on();
                kkputs("O");
            } else {
                switch_leds_off();
                kkputs("o");
            }
            led_state ^= 1;
            GPIO_TOGGLE(GPIOC, GPIO_Pin_3);
            lasttime = millis();
        }

        if (button_pressed) {
            button_pressed = 0;
            kkputs("button was pressed!\n");
            blink_speed_ms >>= 1;
            if (blink_speed_ms <= 50) {
                blink_speed_ms = 1000;
            }
        }

        // start and wait for adc to convert...
        ADC_RegularChannelConfig(ADC1, ADC_Channel_5, 1, ADC_SampleTime_192Cycles);
        ADC_SoftwareStartConv(ADC1);
        while (ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0)
            ;

        uint16_t pot_val = ADC_GetConversionValue(ADC1);
        if (pot_val > 0x700) {
            GPIO_HIGH(GPIOA, GPIO_Pin_4);
        } else {
            GPIO_LOW(GPIOA, GPIO_Pin_4);
        }
    }
}
開發者ID:TuniLame,項目名稱:stm32-linux,代碼行數:54,代碼來源:main.c

示例14: configureADC_Temp

void configureADC_Temp(void)
{
    uint32_t ch_index;

    /* Enable ADC clock & SYSCFG */
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);

    /* Enable the internal connection of Temperature sensor and with the ADC channels*/
    ADC_TempSensorVrefintCmd(ENABLE);

    /* Wait until ADC + Temp sensor start */
    T_StartupTimeDelay = 1024;
    while (T_StartupTimeDelay--);

    /* Setup ADC common init struct */
    ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div4;
    ADC_CommonInit(&ADC_CommonInitStructure);


    /* Initialise the ADC1 by using its init structure */
    ADC_StructInit(&ADC_InitStructure);
    ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;	          // Set conversion resolution to 12bit
    ADC_InitStructure.ADC_ScanConvMode = ENABLE;	                          // Enable Scan mode (single conversion for each channel of the group)
    ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;			  // Disable Continuous conversion
    ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConvEdge_None; // Disable external conversion trigger
    ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;                  // Set conversion data alignement to right
    ADC_InitStructure.ADC_NbrOfConversion = ADC_CONV_BUFF_SIZE;             // Set conversion data alignement to ADC_CONV_BUFF_SIZE
    ADC_Init(ADC1, &ADC_InitStructure);

    /* ADC1 regular Temperature sensor channel16 and internal reference channel17 configuration */

    for (ch_index = 1; ch_index <= MAX_TEMP_CHNL; ch_index++) {
        ADC_RegularChannelConfig(ADC1, ADC_Channel_16, ch_index,
                                 ADC_SampleTime_384Cycles);
    }

    ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 17, ADC_SampleTime_384Cycles);
    ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 18, ADC_SampleTime_384Cycles);
    ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 19, ADC_SampleTime_384Cycles);
    ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 20, ADC_SampleTime_384Cycles);
}
開發者ID:powenko,項目名稱:STM32L152C-Discovery-SampleCode,代碼行數:41,代碼來源:main.c

示例15: ADC3_Mode_Config

static void ADC3_Mode_Config()
{
	ADC_InitTypeDef  ADC_InitStructure;
	DMA_InitTypeDef DMA_InitStructure;
	ADC_DeInit(ADC1);  //將外設 ADC1 的全部寄存器重設為缺省值
	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;	//ADC工作模式:ADC1和ADC2工作在獨立模式
	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數據右對齊
	ADC_InitStructure.ADC_NbrOfChannel =ADC_CHN;	//順序進行規則轉換的ADC通道的數目
	ADC_Init(ADC1, &ADC_InitStructure);	//根據ADC_InitStruct中指定的參數初始化外設ADCx的寄存器
	ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_239Cycles5);
	ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 2, ADC_SampleTime_239Cycles5);
	ADC_RegularChannelConfig(ADC1, ADC_Channel_2, 3, ADC_SampleTime_239Cycles5);
	ADC_Cmd(ADC1, ENABLE);	   //使能指定的ADC1
	ADC_ResetCalibration(ADC1);	  //複位指定的ADC1的校準寄存器
	while(ADC_GetResetCalibrationStatus(ADC1));	//獲取ADC1複位校準寄存器的狀態,設置狀態則等待
	ADC_StartCalibration(ADC1);		//開始指定ADC1的校準狀態
	while(ADC_GetCalibrationStatus(ADC1));		//獲取指定ADC1的校準程序,設置狀態則等待
	
	

	DMA_DeInit(DMA1_Channel1);   //將DMA的通道1寄存器重設為缺省值
	DMA_InitStructure.DMA_PeripheralBaseAddr =  (u32)&ADC1->DR;  //DMA外設ADC基地址
	DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADCDMA_Value[0][0];  //DMA內存基地址
	DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;  //內存作為數據傳輸的目的地
	DMA_InitStructure.DMA_BufferSize = ADC_BUFSize*ADC_CHN;  //DMA通道的DMA緩存的大小
	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; //數據寬度為16位
	DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;  //工作在循環緩存模式
	DMA_InitStructure.DMA_Priority = DMA_Priority_High; //DMA通道 x擁有高優先級 
	DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;  //DMA通道x沒有設置為內存到內存傳輸
	DMA_Init(DMA1_Channel1, &DMA_InitStructure);  //根據DMA_InitStruct中指定的參數初始化DMA的通道
	ADC_SoftwareStartConvCmd(ADC1, ENABLE);
	DMA_Cmd(DMA1_Channel1, ENABLE); 
	DMA_ITConfig(DMA1_Channel1, DMA_IT_TC, ENABLE);
	ADC_DMACmd(ADC1, ENABLE);	
}
開發者ID:RTOS-Developers,項目名稱:TRTOS,代碼行數:41,代碼來源:ADC_Driver.c


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