4组adc 采样? 代码有问题吗? 延时够吗?
-
struct adc_cfg_t cfg;
memset((void*)&cfg, 0, sizeof(cfg)); cfg.src = ADC_TRANS_SOURCE_PAD; cfg.ref_sel = ADC_REFERENCE_AVDD; cfg.channels = 0x0F; //4 ADC1,2,3,4 cfg.route.pad_to_sample = 1; cfg.clk_sel = ADC_SAMPLE_CLK_24M_DIV13; cfg.clk_div = 0x3f; adc_init(&cfg); adc_enable(NULL, NULL, 0); co_delay_100us(5000); TemperatureAdcValue=1023; adc_get_result(ADC_TRANS_SOURCE_PAD,1,&TemperatureAdcValue); co_printf("TemperatureAdcValue1 %d\r\n",TemperatureAdcValue); co_delay_100us(1000); TemperatureAdcValue=1023; adc_get_result(ADC_TRANS_SOURCE_PAD,2,&TemperatureAdcValue); co_delay_100us(1000); TemperatureAdcValue=1023; adc_get_result(ADC_TRANS_SOURCE_PAD,4,&TemperatureAdcValue); co_printf("TemperatureAdcValue3 %d\r\n",TemperatureAdcValue); co_delay_100us(1000); TemperatureAdcValue=1023; adc_get_result(ADC_TRANS_SOURCE_PAD,8,&TemperatureAdcValue); adc_disable();