问答

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

zhtmz

TA的家园币:10  

  • N32WB01 内部adc测Vcc的问题

    软件是根据ADC获取电压偏移函数写的,adc_val=ADC16bit_SingleRead_Val(ADC_CTRL_CH_6,20);这个函数应该能直接获取到Vcc的电压值,但是读了20次的adc值都是0,这是什么原因?代码:uint16_tADC16bit_SingleRead_Val(uint16_tChannel,uint8_tavg_num){int32_tsum=0;uint16_ti,null_num;uint16_tadc_val;GPIO_InitTypeGPIO_InitStructure;RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB,ENABLE);/*Enableperipheralclocks*//*EnableADCclocks*/RCC_EnableAHBPeriphClk(RCC_AHB_PERIPH_ADC,ENABLE);RCC_ConfigAdcClk(RCC_ADCCLK_SRC_AUDIOPLL);/*enableADC4Mclock*/RCC_Enable_ADC_CLK_SRC_AUDIOPLL(ENABLE);/*configerADC*/ADC_SetOverSampleCounter(ADC,3);ADC_EnableBypassFilter(ADC,ENABLE);ADC_ConfigChannel(ADC,Channel);ADC_ConfigContinuousMode(ADC,DISABLE);ADC_Enable(ADC,ENABLE);ADC_EnableTS(ADC,ENABLE);/*dropinvaliddata*/delay_n_10us(100);//1ms/*getadcdata*/null_num=0;for(i=0;i

    BLE VC ADC N32WB01

    2024-09-26 0