这篇教程C++ ADC_DeInit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADC_DeInit函数的典型用法代码示例。如果您正苦于以下问题:C++ ADC_DeInit函数的具体用法?C++ ADC_DeInit怎么用?C++ ADC_DeInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADC_DeInit函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: 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,
示例2: ADC_Configurationstatic void ADC_Configuration(void){ ADC_InitTypeDef ADC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 , ENABLE);// ADC1 configuration ADC_DeInit(ADC1); ADC_InitStructure.ADC_Mode = ADC_Mode_RegSimult; ADC_InitStructure.ADC_ScanConvMode = ENABLE; ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_CC2; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfChannel = 3; ADC_Init(ADC1, &ADC_InitStructure); // ADC1 channel sequence ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_28Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 2, ADC_SampleTime_28Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_8, 3, ADC_SampleTime_28Cycles5); // ADC2 configuration ADC_DeInit(ADC2); ADC_InitStructure.ADC_Mode = ADC_Mode_RegSimult; ADC_InitStructure.ADC_ScanConvMode = ENABLE; ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfChannel = 3; ADC_Init(ADC2, &ADC_InitStructure); // ADC2 channel sequence ADC_RegularChannelConfig(ADC2, ADC_Channel_2, 1, ADC_SampleTime_28Cycles5); ADC_RegularChannelConfig(ADC2, ADC_Channel_3, 2, ADC_SampleTime_28Cycles5); ADC_RegularChannelConfig(ADC2, ADC_Channel_17, 3, ADC_SampleTime_28Cycles5); // Enable ADC1 ADC_Cmd(ADC1, ENABLE); // Calibrate ADC1 ADC_ResetCalibration(ADC1); while(ADC_GetResetCalibrationStatus(ADC1)); ADC_StartCalibration(ADC1); while(ADC_GetCalibrationStatus(ADC1)); // Enable ADC1 external trigger ADC_ExternalTrigConvCmd(ADC1, ENABLE); ADC_TempSensorVrefintCmd(ENABLE); // Enable ADC2 ADC_Cmd(ADC2, ENABLE); // Calibrate ADC2 ADC_ResetCalibration(ADC2); while(ADC_GetResetCalibrationStatus(ADC2)); ADC_StartCalibration(ADC2); while(ADC_GetCalibrationStatus(ADC2)); // Enable ADC2 external trigger ADC_ExternalTrigConvCmd(ADC2, ENABLE); }
开发者ID:nongxiaoming,项目名称:MiniQuadcopter,代码行数:59,
示例3: ADC_Supply/** * @brief Read ADC1 * @caller several functions * @param None * @retval ADC value */ u16 ADC_Supply(void){ uint8_t i; uint16_t res;/* Enable ADC clock */ CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);/* de-initialize ADC */ ADC_DeInit(ADC1);/*ADC configuration ADC configured as follow: - Channel VREF - Mode = Single ConversionMode(ContinuousConvMode disabled) - Resolution = 12Bit - Prescaler = /1 - sampling time 9 */ ADC_VrefintCmd(ENABLE); delay_10us(3); ADC_Cmd(ADC1, ENABLE); ADC_Init(ADC1, ADC_ConversionMode_Single, ADC_Resolution_12Bit, ADC_Prescaler_1); ADC_SamplingTimeConfig(ADC1, ADC_Group_FastChannels, ADC_SamplingTime_9Cycles); ADC_ChannelCmd(ADC1, ADC_Channel_Vrefint, ENABLE); delay_10us(3);/* initialize result */ res = 0; for(i=8; i>0; i--) {/* start ADC convertion by software */ ADC_SoftwareStartConv(ADC1);/* wait until end-of-covertion */ while( ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == 0 );/* read ADC convertion result */ res += ADC_GetConversionValue(ADC1); } /* de-initialize ADC */ 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_Vrefint, DISABLE); return (res>>3);}
开发者ID:david1mdavis,项目名称:SnapOnControls,代码行数:62,
示例4: fdi_adc_power_downvoid fdi_adc_power_down(void) { ADC_Cmd(ADC1, DISABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, DISABLE); ADC_DeInit(); DMA_DeInit(DMA2_Stream0); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, DISABLE); }
开发者ID:denisbohm,项目名称:firefly-ice-firmware,代码行数:7,
示例5: ADC1_Configvoid ADC1_Config(void){ ADC_InitTypeDef ADC_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; /* Enable GPIO ports B */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); /* ADC1 Periph clock enable */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); /* Configure Pin & Port as input push-pull for ADC channel 1 usage */ GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_PIN_ADCin1; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_Init(GPIO_PORT_ADCin1, &GPIO_InitStructure); /* Reset ADC to default values */ ADC_DeInit(); /* ADC1 Configuration */ ADC_StructInit(&ADC_InitStructure); ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_Init(ADC1, &ADC_InitStructure); ADC_Cmd(ADC1, ENABLE);}
开发者ID:siorpaes,项目名称:stm32-boilerplate,代码行数:35,
示例6: gpdrive_deinitvoid gpdrive_deinit(void) { if (!m_init_done) { return; } m_init_done = false; timer_thd_stop = true; while (timer_thd_stop) { chThdSleepMilliseconds(1); } TIM_DeInit(TIM1); TIM_DeInit(TIM12); ADC_DeInit(); DMA_DeInit(DMA2_Stream4); nvicDisableVector(ADC_IRQn); dmaStreamRelease(STM32_DMA_STREAM(STM32_DMA_STREAM_ID(2, 4))); // Restore pins palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING); palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(GPIO_AF_TIM1) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUDR_FLOATING);}
开发者ID:vedderb,项目名称:bldc,代码行数:28,
示例7: adc_configurevoid adc_configure(){ ADC_InitTypeDef ADC_init_structure; //Structure for adc confguration GPIO_InitTypeDef GPIO_initStructre; //Structure for analog input pin //Clock configuration RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1,ENABLE);//The ADC1 is connected the APB2 peripheral bus thus we will use its clock source RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOCEN,ENABLE);//Clock for the ADC port!! Do not forget about this one ;) //Analog pin configuration GPIO_initStructre.GPIO_Pin = GPIO_Pin_0;//The channel 10 is connected to PC0 GPIO_initStructre.GPIO_Mode = GPIO_Mode_AN; //The PC0 pin is configured in analog mode GPIO_initStructre.GPIO_PuPd = GPIO_PuPd_NOPULL; //We don't need any pull up or pull down GPIO_Init(GPIOC,&GPIO_initStructre);//Affecting the port with the initialization structure configuration //ADC structure configuration ADC_DeInit(); ADC_init_structure.ADC_DataAlign = ADC_DataAlign_Right;//data converted will be shifted to right ADC_init_structure.ADC_Resolution = ADC_Resolution_12b;//Input voltage is converted into a 12bit number giving a maximum value of 4096 ADC_init_structure.ADC_ContinuousConvMode = ENABLE; //the conversion is continuous, the input data is converted more than once ADC_init_structure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;// conversion is synchronous with TIM1 and CC1 (actually I'm not sure about this one :/) ADC_init_structure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;//no trigger for conversion ADC_init_structure.ADC_NbrOfConversion = 1;//I think this one is clear :p ADC_init_structure.ADC_ScanConvMode = DISABLE;//The scan is configured in one channel ADC_Init(ADC1,&ADC_init_structure);//Initialize ADC with the previous configuration //Enable ADC conversion ADC_Cmd(ADC1,ENABLE); //Select the channel to be read from ADC_RegularChannelConfig(ADC1,ADC_Channel_10,1,ADC_SampleTime_144Cycles);}
开发者ID:Kaeblo,项目名称:tempsens,代码行数:26,
示例8: AD_Resetstatic void AD_Reset(){ ADC_InitTypeDef ADC_InitStructure; ADC_DeInit(ADC1); /* ADC configuration ------------------------------------------------------*/ ADC_InitStructure.ADC_Mode = ADC_Mode_RegInjecSimult; //ADC_Mode_RegSimult; ADC_InitStructure.ADC_ScanConvMode = ENABLE; 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_ExternalTrigConvCmd(ADC1, ENABLE); ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_239Cycles5); ADC_ClearITPendingBit(ADC1, ADC_IT_EOC); ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE); /* enable and calibrate ADCs */ ADC_Enable(ADC1);}
开发者ID:Farewellly,项目名称:STM32,代码行数:27,
示例9: ADC_Icc_Init/** * @brief ADC_Icc(ADC_24 of ADC_0~27) initialization * @caller main and ADC_Icc_Test * @param None * @retval None */ void ADC_Icc_Init(void){/* Enable ADC clock */ CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, ENABLE);/* de-initialize ADC */ ADC_DeInit(ADC1); /* ADC configured as follow: - NbrOfChannel = 1 - ADC_Channel_24 - Mode = Single ConversionMode(ContinuousConvMode disabled) - Resolution = 12Bit - Prescaler = /1 - sampling time 159 */ /* Enable ADC1 */ ADC_Cmd(ADC1, ENABLE); ADC_Init(ADC1, ADC_ConversionMode_Single,ADC_Resolution_12Bit, ADC_Prescaler_1); ADC_SamplingTimeConfig(ADC1, ADC_Group_FastChannels, ADC_SamplingTime_9Cycles); ADC_ChannelCmd(ADC1, ADC_Channel_24, ENABLE);/* disable SchmittTrigger for ADC_Channel_24, to save power */ ADC_SchmittTriggerConfig(ADC1, ADC_Channel_24, DISABLE);/* a short time of delay is required after enable ADC */ delay_10us(3); }
开发者ID:Montanari9,项目名称:TreinamentoSTM8L,代码行数:36,
示例10: SEN0159initvoid SEN0159init(){ //Clock configuration RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1,ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOCEN,ENABLE); // pin configuration GPIO_InitTypeDef GPIO_initStructre; GPIO_initStructre.GPIO_Pin = GPIO_Pin_0;//channel 10 is connected to PC0 GPIO_initStructre.GPIO_Mode = GPIO_Mode_AN; GPIO_initStructre.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOC,&GPIO_initStructre); // adc configuration ADC_InitTypeDef ADC_init_structure; ADC_DeInit(); ADC_init_structure.ADC_DataAlign = ADC_DataAlign_Right; ADC_init_structure.ADC_Resolution = ADC_Resolution_12b; ADC_init_structure.ADC_ContinuousConvMode = DISABLE; //ADC_init_structure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; ADC_init_structure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_init_structure.ADC_NbrOfConversion = 1; ADC_init_structure.ADC_ScanConvMode = DISABLE; ADC_Init(ADC1,&ADC_init_structure); //Enable ADC conversion ADC_Cmd(ADC1,ENABLE); //Select the channel to be read from ADC_RegularChannelConfig(ADC1,ADC_Channel_10,1,ADC_SampleTime_480Cycles);}
开发者ID:Nilvero,项目名称:SysWbud1,代码行数:31,
示例11: Initialize_ADCvoid Initialize_ADC(void){ ADC_InitTypeDef ADC_InitStruct; GPIO_InitTypeDef GPIO_InitStruct; GPIO_StructInit(&GPIO_InitStruct); GPIO_InitStruct.GPIO_Pin = 0x01; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOC, &GPIO_InitStruct); ADC_DeInit(); ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStruct.ADC_Resolution = ADC_Resolution_12b; ADC_InitStruct.ADC_ContinuousConvMode = ENABLE; ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; ADC_InitStruct.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStruct.ADC_NbrOfConversion = 1; ADC_InitStruct.ADC_ScanConvMode = DISABLE; ADC_Init(ADC1, &ADC_InitStruct); ADC_Cmd(ADC1, ENABLE); ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_144Cycles); //InitializeTimer(); }
开发者ID:NoahPena,项目名称:Mic-Effects-Project,代码行数:30,
示例12: fft_ADC_Initvoid 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,
示例13: ADC1_Configvoid ADC1_Config(void){ ADC_InitTypeDef ADC_InitStructure; ADC_DeInit(ADC1); //将外设 ADC1 的全部寄存器重设为缺省值 /* ADC1 configuration ------------------------------------------------------*/ ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC1独立工作模式 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 = 2; //顺序进行规则转换的ADC通道的数目 ADC_Init(ADC1, &ADC_InitStructure); //根据ADC_InitStruct中指定的参数初始化外设ADCx的寄存器 ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_239Cycles5 ); //ADC1,ADC通道3,规则采样顺序值为1,采样时间为239.5周期 ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 2, ADC_SampleTime_239Cycles5); ADC_DMACmd(ADC1, ENABLE);//使能ADC1模块DMA /* Enable ADC1 */ ADC_Cmd(ADC1, ENABLE); //使能指定的ADC1 /* Enable ADC1 reset calibaration register */ ADC_ResetCalibration(ADC1); //重置指定的ADC1的校准寄存器 /* Check the end of ADC1 reset calibration register */ while(ADC_GetResetCalibrationStatus(ADC1)); //获取ADC1重置校准寄存器的状态,设置状态则等待 /* Start ADC1 calibaration */ ADC_StartCalibration(ADC1); //开始指定ADC1的校准状态 /* Check the end of ADC1 calibration */ while(ADC_GetCalibrationStatus(ADC1)); //获取指定ADC1的校准程序,设置状态则等待 /* Start ADC1 Software Conversion */ ADC_SoftwareStartConvCmd(ADC1, ENABLE); //使能指定的ADC1的软件转换启动功能}
开发者ID:andyzhao365,项目名称:GuodianBeijingGuangyuACIntoDCDetectionDevice,代码行数:30,
示例14: adcSetupvoid adcSetup(void){ ADC_DeInit(); RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); ADC_CommonInitStruct.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div8; ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStruct); ADC_InitStruct.ADC_Resolution = ADC_Resolution_12b; ADC_InitStruct.ADC_ScanConvMode = DISABLE; ADC_InitStruct.ADC_ContinuousConvMode = ENABLE; ADC_InitStruct.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStruct.ADC_NbrOfConversion = 1; ADC_Init(ADC1, &ADC_InitStruct); // ADC1 Configuration, ADC_Channel_TempSensor is actual channel 16 ADC_RegularChannelConfig(ADC1, ADC_Channel_TempSensor, 1, ADC_SampleTime_144Cycles); // Enable internal temperature sensor ADC_TempSensorVrefintCmd(ENABLE); // Enable ADC conversion ADC_Cmd(ADC1, ENABLE);}
开发者ID:rmursh,项目名称:MicroP-ECSE426,代码行数:30,
示例15: ADCInitvoid ADCInit(){ ADC_InitTypeDef ADC_InitStructure; ADC_StructInit(&ADC_InitStructure); ADC_CommonInitTypeDef adc_init; ADC_CommonStructInit(&adc_init); /* разрешаем тактирование AЦП1 */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); /* сбрасываем настройки АЦП */ ADC_DeInit(); ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; /* АЦП1 и АЦП2 работают независимо */ adc_init.ADC_Mode = ADC_Mode_Independent; adc_init.ADC_Prescaler = ADC_Prescaler_Div2; /* выключаем scan conversion */ ADC_InitStructure.ADC_ScanConvMode = DISABLE; /* Не делать длительные преобразования */ ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; /* Начинать преобразование программно, а не по срабатыванию триггера */ ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConvEdge_None; /* 12 битное преобразование. результат в 12 младших разрядах результата */ ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; /* инициализация */ ADC_CommonInit(&adc_init); ADC_Init(ADC1, &ADC_InitStructure); /* Включаем АЦП1 */ ADC_Cmd(ADC1, ENABLE); // настройка канала ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_15Cycles);}
开发者ID:Olvar-ag,项目名称:RESET,代码行数:32,
示例16: main/** * @brief Main program. * @param None * @retval None */int main(void){ /* Configure System clocks -----------------------------------------------*/ RCC_Configuration(); /* Configure GPIO ports --------------------------------------------------*/ GPIO_Configuration(); USART_Configuration(); /* Output a message on Hyperterminal using printf function */ printf("/n/rADC different test: /n/r"); ADC_Configuration(); while(ADC_GetBitState(ADC_FLAG_EOC) != SET); ADCConvertedValue = ADC_GetConversionValue(); printf("/n/rThe original data %d/n/r",ADCConvertedValue); ADC_DeInit(&ADC_InitStructure); ADC_OVERConfiguration(); while(ADC_GetBitState(ADC_FLAG_EOC) != SET); ADCConvertedValue_OVER = ADC_GetConversionValue(); printf("/n/rOversampling data %d/n/r",ADCConvertedValue_OVER); while (1) { }}
开发者ID:eeinz,项目名称:trochili,代码行数:34,
示例17: 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,
示例18: adcInitvoid adcInit(void){ /* * Note: This function initializes only ADC2, and only for single channel, single conversion mode. No DMA, no interrupts, no bells or whistles. */ /* Note that this de-initializes registers for all ADCs (ADCx) */ ADC_DeInit(); /* Define ADC init structures */ ADC_InitTypeDef ADC_InitStructure; ADC_CommonInitTypeDef ADC_CommonInitStructure; /* Populates structures with reset values */ ADC_StructInit(&ADC_InitStructure); ADC_CommonStructInit(&ADC_CommonInitStructure); /* enable ADC clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC2, ENABLE); /* init ADCs in independent mode, div clock by two */ ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2; /* HCLK = 168MHz, PCLK2 = 84MHz, ADCCLK = 42MHz (when using ADC_Prescaler_Div2) */ ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStructure); /* Init ADC2: 12bit, single-conversion. For Arduino compatibility set 10bit */ analogReadResolution(12); /* Enable ADC2 */ ADC_Cmd(ADC2, ENABLE);}
开发者ID:CarlosRDomin,项目名称:crazyflie-firmware,代码行数:33,
示例19: Adc1_Multi_Init//初始化ADC1//这里采用多通道连续采样,并用DMA1的通道传送//我们默认将开启通道4~7//相应管脚PA4~7void Adc1_Multi_Init(void){ ADC_InitTypeDef ADC_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |RCC_APB2Periph_ADC1 , ENABLE ); //使能ADC1通道时钟 RCC_ADCCLKConfig(RCC_PCLK2_Div6); //设置ADC分频因子6 72M/6=12,ADC最大时间不能超过14M //PA1 作为模拟通道输入引脚 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; //模拟输入引脚 GPIO_Init(GPIOA, &GPIO_InitStructure); ADC_DeInit(ADC1); //复位ADC1,将外设 ADC1 的全部寄存器重设为缺省值 ADC_InitStructure.ADC_Mode = ADC_Mode_RegSimult; //ADC工作模式:ADC1同步规则组模式 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 = 4; //顺序进行规则转换的ADC通道的数目 ADC_Init(ADC1, &ADC_InitStructure); //根据ADC_InitStruct中指定的参数初始化外设ADCx的寄存器 ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 1, ADC_SampleTime_239Cycles5 ); ADC_RegularChannelConfig(ADC1, ADC_Channel_5, 2, ADC_SampleTime_239Cycles5 ); ADC_RegularChannelConfig(ADC1, ADC_Channel_6, 3, ADC_SampleTime_239Cycles5 ); ADC_RegularChannelConfig(ADC1, ADC_Channel_7, 4, ADC_SampleTime_239Cycles5 ); // 开启ADC的DMA支持(要实现DMA功能,还需独立配置DMA通道等参数) ADC_DMACmd(ADC1, ENABLE);}
开发者ID:devinzhang91,项目名称:Health-Box,代码行数:37,
示例20: ADC_Configurationvoid 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,
示例21: RCC_AHB1PeriphClockCmdvoid Battery::initialize(){ GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); ADC_InitTypeDef ADC_InitStructure; ADC_CommonInitTypeDef ADC_CommonInitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC|RCC_APB2Periph_ADC1, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOCEN,ENABLE); ADC_DeInit(); ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div4; ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStructure); 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); ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_112Cycles); ADC_Cmd(ADC1, ENABLE); ADC_DMACmd(ADC1,DISABLE);}
开发者ID:taniho0707,项目名称:nucleo_mouse,代码行数:35,
示例22: 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,
示例23: Adc_Initvoid Adc_Init(void){ GPIO_InitTypeDef GPIO_InitStructure; ADC_InitTypeDef ADC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_ADC1,ENABLE); GPIO_InitStructure.GPIO_Pin=GPIO_Pin_1; GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AIN; GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz; GPIO_Init(GPIOA,&GPIO_InitStructure); RCC_ADCCLKConfig(RCC_PCLK2_Div6); ADC_DeInit(ADC1); ADC_InitStructure.ADC_ContinuousConvMode=DISABLE; ADC_InitStructure.ADC_DataAlign=ADC_DataAlign_Right; ADC_InitStructure.ADC_ExternalTrigConv=ADC_ExternalTrigConv_None; ADC_InitStructure.ADC_Mode=ADC_Mode_Independent; ADC_InitStructure.ADC_ScanConvMode=DISABLE; ADC_InitStructure.ADC_NbrOfChannel=1; ADC_Init(ADC1, &ADC_InitStructure); ADC_Cmd(ADC1,ENABLE); ADC_ResetCalibration(ADC1);//使能复位校准 while(ADC_GetResetCalibrationStatus(ADC1)); ADC_StartCalibration(ADC1);//开启ad校准 while(ADC_GetCalibrationStatus(ADC1)); }
开发者ID:CQUT-AC,项目名称:AC_Project_Flower,代码行数:30,
示例24: adc_setupvoid adc_setup(){ static int setup_complete = 0; ADC_InitTypeDef adc_init; GPIO_InitTypeDef gpio_init; if(setup_complete){ return; } // Enable clock for ADC & GPIOC RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); // Initialize GPIOC GPIO_StructInit(&gpio_init); gpio_init.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | / GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5; gpio_init.GPIO_Mode = GPIO_Mode_AN; gpio_init.GPIO_Speed = GPIO_Speed_2MHz; GPIO_Init(GPIOC, &gpio_init); // Initialize ADC1 ADC_DeInit(ADC1); ADC_StructInit(&adc_init); ADC_Init(ADC1, &adc_init); //ADC_GetCalibrationFactor(ADC1); ADC_TempSensorVrefintCmd(ENABLE); ADC_Cmd(ADC1, ENABLE); while(ADC_GetFlagStatus(ADC1, ADC_FLAG_RCNR)); while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_ADONS)); setup_complete++;}
开发者ID:zbanks,项目名称:hackboard,代码行数:34,
示例25: ADC_Configuration/** * @brief Configures the ADC. * @param None * @retval None */void ADC_Configuration(void){ ADC_InitTypeDef ADC_InitStructure; // Structure to initialize the ADC // Configure ADC1 on channel 1 ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; ADC_InitStructure.ADC_ScanConvMode = DISABLE; // One channel only ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; // Conversion on PWM rising edge only ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; // Timer 1 CC1 ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfChannel = 1; // Initialise and enable ADC1 ADC_DeInit( ADC1 ); //Set ADC registers to default values ADC_Init( ADC1, &ADC_InitStructure ); ADC_RegularChannelConfig( ADC1, ADC_Channel_10, 1, ADC_SampleTime_71Cycles5); // Start transferts ADC_ExternalTrigConvCmd( ADC1, ENABLE ); // Enable ADC1 external trigger ADC_DMACmd( ADC1, ENABLE ); //Enable ADC1 DMA ADC_Cmd( ADC1, ENABLE ); //Enable ADC1 // Enable JEOC interrupt //ADC_ITConfig(ADC1, ADC_IT_JEOC, ENABLE); // Calibrate ADC1 ADC_ResetCalibration( ADC1 ); while ( ADC_GetResetCalibrationStatus(ADC1) ) {} //Check the end of ADC1 reset calibration register ADC_StartCalibration( ADC1 ); while ( ADC_GetCalibrationStatus(ADC1) ) {} //Check the end of ADC1 calibration}
开发者ID:yohan-m,项目名称:STM32-embedded-reception,代码行数:36,
示例26: ADC_DeInitvoid InternalTempSensor::initTempSensor(){ temp = 0; calibration = 0; ADC_DeInit(); ADC_InitTypeDef ADC_InitStruct; ADC_CommonInitTypeDef ADC_CommonInitStruct; RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); ADC_CommonInitStruct.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div8; ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStruct); ADC_InitStruct.ADC_Resolution = ADC_Resolution_12b; ADC_InitStruct.ADC_ScanConvMode = DISABLE; ADC_InitStruct.ADC_ContinuousConvMode = ENABLE; ADC_InitStruct.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStruct.ADC_NbrOfConversion = 1; ADC_Init(ADC1, &ADC_InitStruct); ADC_RegularChannelConfig(ADC1, ADC_Channel_TempSensor, 1, ADC_SampleTime_144Cycles); ADC_TempSensorVrefintCmd(ENABLE); ADC_Cmd(ADC1, ENABLE);}
开发者ID:r00li,项目名称:RhomeV3,代码行数:31,
示例27: adc_initvoid adc_init(void) { ADC_InitTypeDef ADC_InitStructure; ADC_DeInit(ADC1); //复位ADC1,将外设 ADC1 的全部寄存器重设为缺省值 ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC工作模式:ADC1和ADC2工作在独立模式 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数据右对齐 ADC_InitStructure.ADC_NbrOfChannel = 1; //顺序进行规则转换的ADC通道的数目 ADC_Init(ADC1, &ADC_InitStructure); //根据ADC_InitStruct中指定的参数初始化外设ADCx的寄存器 ADC_Cmd(ADC1, ENABLE); //使能指定的ADC1 ADC_ResetCalibration(ADC1); //使能复位校准 while(ADC_GetResetCalibrationStatus(ADC1)); //等待复位校准结束 ADC_StartCalibration(ADC1); //开启AD校准 while(ADC_GetCalibrationStatus(ADC1)); //等待校准结束// ADC_SoftwareStartConvCmd(ADC1, ENABLE); //使能指定的ADC1的软件转换启动功能}
开发者ID:SxxSxx,项目名称:Slave_basketball_arm_controller,代码行数:26,
示例28: RCC_APB2PeriphClockCmdvoid U_ADC::ADCInit(uint8_t ADC_Channel, uint8_t ADC_SampleTime) { ADC_InitTypeDef ADC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); ADC_DeInit(ADC1); ADC_StructInit(&ADC_InitStructure); ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Upward; ADC_Init(ADC1, &ADC_InitStructure); RCC_ADCCLKConfig(RCC_ADCCLK_PCLK_Div4); ADC_ChannelConfig(ADC1, ADC_Channel, ADC_SampleTime); ADC_TempSensorCmd(ENABLE); ADC_GetCalibrationFactor(ADC1); ADC_Cmd(ADC1, ENABLE); while (!ADC_GetFlagStatus(ADC1, ADC_FLAG_ADEN)) ;}
开发者ID:tromeli,项目名称:STM32F0_User_lib,代码行数:27,
示例29: initSensorsvoid initSensors(){ ADC_DeInit(); // Setup ADC_CommonInitType first RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); ADC_CommonInitStruct.ADC_Prescaler = ADC_Prescaler_Div8; ADC_CommonInitStruct.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStruct.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStruct.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStruct); // Setup ADC_InitStruct 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_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_Init(ADC1, &ADC_InitStructure); ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_3Cycles); ADC_Cmd(ADC1, ENABLE); ADC_ResetCalibration(ADC1); //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)); //Start ADC1 Software Conversion ADC_SoftwareStartConvCmd(ADC1, ENABLE);}
开发者ID:Apo11oH,项目名称:micromouse_2014,代码行数:34,
示例30: TEMP_Initvoid 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,
注:本文中的ADC_DeInit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ADC_GetCalibrationStatus函数代码示例 C++ ADC_DMACmd函数代码示例 |