This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to get every adc channel conversion result?

Hi: I want use all eight ADC channel, But I don't know how to get different channel conversion result.

I write my code as follow:

void adc_config(void)

{ const nrf_adc_config_t nrf_adc_config = { ADC_CONFIG_RES_10bit, NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD,
NRF_ADC_CONFIG_REF_VBG };

nrf_adc_configure( (nrf_adc_config_t *)&nrf_adc_config);
nrf_adc_int_enable(ADC_INTENSET_END_Enabled << ADC_INTENSET_END_Pos);
NVIC_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_HIGH);
NVIC_EnableIRQ(ADC_IRQn);

}

void ADC_IRQHandler(void)

{

nrf_adc_conversion_event_clean();
adc_sample = nrf_adc_result_get();
nrf_adc_start();

}

In my main funciton I do like this:

nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_2);
		printf("%d",adc_sample);
nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_3);
		printf("%d",adc_sample);

.... Now, I wonder that : 1.if this funciton is right ? 2.can I get adc result without ADC_Interrput? thank you!

Parents Reply Children
No Data
Related