这篇教程C++ ADC_RegularChannelConfig函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADC_RegularChannelConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ ADC_RegularChannelConfig函数的具体用法?C++ ADC_RegularChannelConfig怎么用?C++ ADC_RegularChannelConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADC_RegularChannelConfig函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Get_Adcu16 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,
示例2: readADC1uint16_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,
示例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,
示例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,
示例5: readADC1u16 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,
示例6: ad_initvoid 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,
示例7: Get_Adcvoid 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,
示例8: adcstatic 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,
示例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,
示例10: ADC1_Mode_Configstatic 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,
示例11: Get_Adcu16 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); // C++ ADC_ResetCalibration函数代码示例 C++ ADC_Init函数代码示例
|