# ADC - poll Source: [https://docs.qualcomm.com/doc/80-58740-4/topic/adc-poll.html](https://docs.qualcomm.com/doc/80-58740-4/topic/adc-poll.html) This demo mainly demonstrates ADC poll reading the voltage value in single-ended mode. The default scan channel 0 ~ channel 10. It should be noted that some chips may not support all channels. ## Hardware connection The GPIO used in this demo refers to `board_adc_gpio_init`. ## Software implementation For more detailed code, refer to examples/peripherals/adc/adc\_poll. board_init();Copy to clipboard - The ADC IP clock is turned on in `board_init`, and the ADC clock source and frequency division will be selected (the ADC clock must be less than or equal to 500K). board_adc_gpio_init();Copy to clipboard - Configure related pins as `adc` function adc = qcc74x_device_get_by_name("adc"); /* adc clock = XCLK / 2 / 32 */ struct qcc74x_adc_config_s cfg; cfg.clk_div = ADC_CLK_DIV_32; cfg.scan_conv_mode = true; cfg.continuous_conv_mode = false; cfg.differential_mode = false; cfg.resolution = ADC_RESOLUTION_16B; cfg.vref = ADC_VREF_3P2V; qcc74x_adc_init(adc, &cfg);Copy to clipboard - Get the `adc` handle, initialize the ADC configuration, and set the ADC sampling frequency to 500K. qcc74x_adc_channel_config(adc, chan, TEST_ADC_CHANNELS);Copy to clipboard - Configure ADC channel information. The number of pairs used is configurable according to `TEST_ADC_CHANNELS`. Channels 0 ~ 10 are enabled by default. Other channels can be selectively closed according to `board_adc_gpio_init`. for (uint32_t i = 0; i < TEST_COUNT; i++) { qcc74x_adc_start_conversion(adc); while (qcc74x_adc_get_count(adc) < TEST_ADC_CHANNELS) { qcc74x_mtimer_delay_ms(1); } for (size_t j = 0; j < TEST_ADC_CHANNELS; j++) { struct qcc74x_adc_result_s result; uint32_t raw_data = qcc74x_adc_read_raw(adc); printf("raw data:%08x\r\n", raw_data); qcc74x_adc_parse_result(adc, &raw_data, &result, 1); printf("pos chan %d,%d mv \r\n", result.pos_chan, result.millivolt); } qcc74x_adc_stop_conversion(adc); qcc74x_mtimer_delay_ms(100); }Copy to clipboard - Call `qcc74x_adc_start_conversion(adc)` to enable conversion of ADC - Call `qcc74x_adc_get_count(adc)` to read the number of completed conversions - Call `qcc74x_adc_read_raw(adc)` to read the conversion value of ADC once - Call `qcc74x_adc_parse_result(adc, &raw_data, &result, 1)` to parse the conversion result of ADC, and save the parsed value to the `result` structure - Call `qcc74x_adc_stop_conversion(adc)` to stop ADC conversion ## Experimental phenomena Print raw data, channel number and voltage value corresponding to the channel. **Parent Topic:** [ADC](https://docs.qualcomm.com/doc/80-58740-4/topic/adc.html) Last Published: Feb 10, 2025 [Previous Topic ADC](https://docs.qualcomm.com/bundle/publicresource/80-58740-4/topics/adc.md) [Next Topic ADC - dma](https://docs.qualcomm.com/bundle/publicresource/80-58740-4/topics/adc-dma.md)