问答

汇集网友智慧,解决技术难题

21ic问答首页 - TAG - N32WB01
  • N32WB01 内部adc测Vcc的问题 sos

    软件是根据ADC获取电压偏移函数写的,adc_val = ADC16bit_SingleRead_Val(ADC_CTRL_CH_6,20);这个函数应该能直接获取到Vcc的电压值,但是读了20次的adc值都是0,这是什么原因? 代码: uint16_t ADC16bit_SingleRead_Val(uint16_t Channel , uint8_t avg_num) { int32_t sum = 0; uint16_t i,null_num; uint16_t adc_val; GPIO_InitType GPIO_InitStructure; RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB, ENABLE); /* Enable peripheral clocks */ /* Enable ADC clocks */ RCC_EnableAHBPeriphClk(RCC_AHB_PERIPH_ADC, ENABLE); RCC_ConfigAdcClk(RCC_ADCCLK_SRC_AUDIOPLL); /* enable ADC 4M clock */ RCC_Enable_ADC_CLK_SRC_AUDIOPLL(ENABLE); /* configer ADC */ ADC_SetOverSampleCounter(ADC,3); ADC_EnableBypassFilter(ADC, ENABLE); ADC_ConfigChannel(ADC, Channel); ADC_ConfigContinuousMode(ADC, DISABLE); ADC_Enable(ADC, ENABLE); ADC_EnableTS(ADC, ENABLE); /* drop invalid data */ delay_n_10us(100); //1ms /* get adc data */ null_num = 0; for(i = 0; i

    BLE VC ADC N32WB01

    2246浏览量 0回复量 关注量