这篇教程C++ ADC_SoftwareStartConv函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADC_SoftwareStartConv函数的典型用法代码示例。如果您正苦于以下问题:C++ ADC_SoftwareStartConv函数的具体用法?C++ ADC_SoftwareStartConv怎么用?C++ ADC_SoftwareStartConv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADC_SoftwareStartConv函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: temperature_MeasureValue/** * @brief Initializes the temperature sensor and its related ADC. * @param None * @retval the float value of temperature measured in Celsius. */float temperature_MeasureValue(void){ /* Raw value of temperature sensor voltage converted from ADC1_IN16 */ uint16_t v_refint; /* Raw value of VREFINT converted from ADC1_INT17 */ uint16_t v_sensor; /* select ADC1_IN16 to sample sensor voltage value*/ ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 1, ADC_SampleTime_28Cycles); /* start one ADC conversion */ ADC_SoftwareStartConv(ADC1); /* wait unitl ECO bit is set, sample finished */ while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); ADC_ClearFlag(ADC1, ADC_FLAG_EOC); /* Read the value from ADC_DR*/ v_sensor = ADC_GetConversionValue(ADC1); /* select ADC1_IN16 to sample reference voltage value*/ ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 1, ADC_SampleTime_28Cycles); /* start one ADC conversion */ ADC_SoftwareStartConv(ADC1); /* wait unitl ECO bit is set, sample finished */ while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); ADC_ClearFlag(ADC1, ADC_FLAG_EOC); /* Read the value from ADC_DR*/ v_refint = ADC_GetConversionValue(ADC1); /* * measured_sensor_voltage = actual_reference_voltage * sampled_sensor_voltage / sampled_reference_voltage_value * temperature = (measured_sensor_voltage - sensor_voltage_at_25) / AVG_SLOPE + 25 */ return (VREFINT_VOLTAGE_V / v_refint * v_sensor - TEMPERATURE_V25) * 1000 / AVG_SLOPE + 25;}
开发者ID:headyin,项目名称:Wireless-Board-Orientation-Control-System-ARM-Micro-Processor-Lab-,代码行数:38,
示例2: ubasic_get_adc/*---------------------------------------------------------------------------*/int ubasic_get_adc(int ch){ int var = 0xff; switch(ch){ case 1: if (ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET) { var = 0xff; } else { var = ADC_GetConversionValue(ADC1) & 0x00ff; ADC_SoftwareStartConv(ADC1); } break; case 2: if (ADC_GetFlagStatus(ADC2, ADC_FLAG_EOC) == RESET) { var = 0xff; } else { var = ADC_GetConversionValue(ADC2) & 0x00ff; ADC_SoftwareStartConv(ADC2); } break; case 3: if (ADC_GetFlagStatus(ADC3, ADC_FLAG_EOC) == RESET) { var = 0xff; } else { var = ADC_GetConversionValue(ADC3) & 0x00ff; ADC_SoftwareStartConv(ADC3); } break; default: var = 0xff; break; } return var;}
开发者ID:mizuki-tohru,项目名称:stm32f4-console,代码行数:35,
示例3: _ADC_Initvoid _ADC_Init(void) {ADC_InitTypeDef ADC_InitStructure;ADC_CommonInitTypeDef ADC_CommonInitStruct; //Enabling ADC clockRCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC2, ENABLE);//ADC common init configuration for Multi mode ADC ADC_CommonInitStruct.ADC_Mode = ADC_DualMode_RegSimult; ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; //ADC_DMAAccessMode_Disabled; ADC_DMAAccessMode_1; ADC_DMAAccessMode_2; ADC_DMAAccessMode_3 ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div2; //ADC_Prescaler_Div2; ADC_Prescaler_Div4; ADC_Prescaler_Div6; ADC_Prescaler_Div8 ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; //ADC_TwoSamplingDelay_5Cycles - i tak dalej po 1 do 20 cykli ADC_CommonInit(&ADC_CommonInitStruct); //ADC1 configuration ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; //Timer ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_Rising; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_Init(ADC1,&ADC_InitStructure); //ADC2 configuration ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; //Timer ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_Rising; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_Init(ADC2,&ADC_InitStructure);//Regular channels config ADC_RegularChannelConfig(ADC1,ADC_Channel_9,1,ADC_SampleTime_144Cycles); ADC_RegularChannelConfig(ADC2,ADC_Channel_2,1,ADC_SampleTime_144Cycles);//DMA for Multi mode ADC ADC_MultiModeDMARequestAfterLastTransferCmd(ENABLE); //Activating continuous mode ADC_ContinuousModeCmd(ADC1, ENABLE); ADC_ContinuousModeCmd(ADC2, ENABLE);//Enabling ADC ADC_Cmd(ADC1, ENABLE); ADC_Cmd(ADC2, ENABLE); ADC_SoftwareStartConv(ADC1); ADC_SoftwareStartConv(ADC2);}
开发者ID:OlendAr,项目名称:PodstawyPrzetwarzaniaSygnalow,代码行数:53,
示例4: adc_readuint16_t adc_read(uint8_t channel){ uint16_t vref; ADC_RegularChannelConfig(ADC1, ADC_Channel_Vrefint, 0, ADC_SampleTime_384Cycles); ADC_SoftwareStartConv(ADC1); while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); vref=ADC_GetConversionValue(ADC1); ADC_RegularChannelConfig(ADC1, channel, 0, ADC_SampleTime_384Cycles); ADC_SoftwareStartConv(ADC1); while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); return ADC_GetConversionValue(ADC1)*6840/vref; // magic number to get millivolts}
开发者ID:zbanks,项目名称:hackboard,代码行数:13,
示例5: getTemp_celcius// fill this infloat getTemp_celcius() { ADC_SoftwareStartConv(ADC1); while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); ADC_ClearFlag(ADC1, ADC_FLAG_EOC); return ((ADC1->DR * 3000.0/4096.0) - 760)/2.5 + 25;}
开发者ID:cmtm,项目名称:microP,代码行数:8,
示例6: mainint main(void){//init: DAC_DeInit(); init_GPIOA(); init_GPIOC(); init_GPIOD(); init_DMA1(); init_DMA2(); init_TIM2(); init_TIM3(); init_TIM4(); init_TIM6(); init_ADC3(); init_DAC(); init_filter(&ap_1); init_filter(&ap_2); init_filter(&ap_3); init_filter(&ap_4); ap_filter_coefs(&ap_1); ap_filter_coefs(&ap_2); ap_filter_coefs(&ap_3); ap_filter_coefs(&ap_4); ADC_SoftwareStartConv(ADC3); while (1) { counter++; }}
开发者ID:3spds,项目名称:stm32f4,代码行数:29,
示例7: main/** * @brief Main program. * @param None * @retval None */void main(void){ /* CLK configuration -------------------------------------------*/ CLK_Config(); /* ADC configuration -------------------------------------------*/ ADC_Config(); /* DMA configuration -------------------------------------------*/ DMA_Config(); /* TIM1 configuration -------------------------------------------*/ TIM1_Config(); /* Enable ADC1 DMA requests*/ ADC_DMACmd(ADC1, ENABLE); /* Enable TIM1 DMA requests*/ TIM1_DMACmd(TIM1_DMASource_Update, ENABLE); /* Start ADC1 Conversion using Software trigger*/ ADC_SoftwareStartConv(ADC1); while (1) {}}
开发者ID:avr-master,项目名称:Healty_Beck,代码行数:31,
示例8: sampleADCchar sampleADC(void){ char res = 0x0; CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE); ADC_DeInit(ADC1); ADC_VrefintCmd(ENABLE); delay_10us(3); ADC_Cmd(ADC1, ENABLE); ADC_Init(ADC1, ADC_ConversionMode_Single, ADC_Resolution_6Bit, ADC_Prescaler_1); ADC_SamplingTimeConfig(ADC1, ADC_Group_SlowChannels, ADC_SamplingTime_9Cycles); ADC_ChannelCmd(ADC1, ADC_Channel_0, ENABLE); delay_10us(3); ADC_SoftwareStartConv(ADC1); while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0); res = (char)ADC_GetConversionValue(ADC1); ADC_VrefintCmd(DISABLE); ADC_DeInit(ADC1); /* disable SchmittTrigger for ADC_Channel_24, to save power */ //ADC_SchmittTriggerConfig(ADC1, ADC_Channel_24, DISABLE); CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE); ADC_ChannelCmd(ADC1, ADC_Channel_0, DISABLE); return res;}
开发者ID:david1mdavis,项目名称:SnapOnControls,代码行数:33,
示例9: ADC_Config/** * @brief Configures the ADC1 channel5. * @param None * @retval None */void ADC_Config(void){ /* Enable The HSI (16Mhz) */ RCC_HSICmd(ENABLE); /* Enable the GPIOF or GPIOA Clock */ RCC_AHBPeriphClockCmd(IDD_MEASUREMENT_GPIO_CLK, ENABLE); /* Configure PF.11 (ADC Channel11) or PA.05 (ADC Channe5) in analog mode */ GPIO_InitStructure.GPIO_Pin = IDD_MEASUREMENT_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(IDD_MEASUREMENT_GPIO, &GPIO_InitStructure); /* Check that HSI oscillator is ready */ while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET); /* ADC1 Configuration ------------------------------------------------------*/ /* Enable ADC1 clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); #ifdef USE_STM32L152D_EVAL /* Select ADC Bank channel */ ADC_BankSelection(ADC1, ADC_Bank_B);#endif ADC_StructInit(&ADC_InitStructure); ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_Init(ADC1, &ADC_InitStructure); /* ADC1 regular channel5 or channel1 configuration */ ADC_RegularChannelConfig(ADC1, IDD_MEASUREMENT_ADC_CHANNEL, 1, ADC_SampleTime_192Cycles); /* Define delay between ADC1 conversions */ ADC_DelaySelectionConfig(ADC1, ADC_DelayLength_Freeze); /* Enable ADC1 Power Down during Delay */ ADC_PowerDownCmd(ADC1, ADC_PowerDown_Idle_Delay, ENABLE); /* Enable ADC1 */ ADC_Cmd(ADC1, ENABLE); /* Wait until ADC1 ON status */ while (ADC_GetFlagStatus(ADC1, ADC_FLAG_ADONS) == RESET) { } /* Start ADC1 Software Conversion */ ADC_SoftwareStartConv(ADC1); /* Wait until ADC Channel 5 or 1 end of conversion */ while (ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET) { }}
开发者ID:Amna2013,项目名称:stm32-test,代码行数:65,
示例10: vhADC_initADC/*-----------------------------------------------------------* @brief Function Name : vhADC_initADC* @brief Description : Initializes ADC*/void vhADC_initADC(void){ /* ADC Common initialization */ ADC_CommonInitTypeDef ADC_CommonInitStructure; ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div6; // 84MHz / prescaler(6) = 14MHz (max 30 OR 36... idk) ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStructure); ADC_InitTypeDef ADC_InitStructure; ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = ENABLE; // Enable, because we want to measure more than 1 channel ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_RisingFalling; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 2; ADC_Init(ADC1, &ADC_InitStructure); /* ADCx regular channel configuration */ ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_28Cycles); ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 2, ADC_SampleTime_28Cycles); /* Enable DMA request after last transfer (Single-ADC mode) */ ADC_DMARequestAfterLastTransferCmd(ADC1, ENABLE); /* Enable ADCx DMA */ ADC_DMACmd(ADC1, ENABLE); /* Enable ADCx */ ADC_Cmd(ADC1, ENABLE); ADC_SoftwareStartConv(ADC1);}
开发者ID:bharathvu,项目名称:AUTOPILOT-1,代码行数:39,
示例11: ADC_AcquireDatavoid ADC_AcquireData(){ /* Enable ADC clock */ //RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); /* Enable ADC1 */ //ADC_Cmd(ADC1, ENABLE); /* Wait until the ADC1 is ready */ //while(ADC_GetFlagStatus(ADC1, ADC_FLAG_ADONS) == RESET); /* Disable DMA mode for ADC1 */ ADC_DMACmd(ADC1, DISABLE); ADC_DMA_init(); /* Enable DMA mode for ADC1 */ ADC_DMACmd(ADC1, ENABLE); // /* Clear global flag for DMA transfert complete */// clearADCDMA_TransferComplete(); /* Start ADC conversion */ ADC_SoftwareStartConv(ADC1);}
开发者ID:tarasii,项目名称:BMP085,代码行数:26,
|