AnsweredAssumed Answered

ADC conversion on multiple inputs

Question asked by Xavier BUHOT on Jul 10, 2017
Latest reply on Jul 13, 2017 by Hui_Ma



I try to modify the ADC_demo example supply on IAR with my Kinetis K60.


I want to modify it to be able to read multple analog inputs.Here is the interrupt in the program:


/****************************************************************************** * adc0_isr(void) * * use to signal ADC0 end of conversion * In: n/a * Out: n/a ******************************************************************************/ void adc0_isr(void) { if (( ADC0_SC1A & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK) { // check which of the two conversions just triggered PIN1_HIGH // do this asap result0A = ADC0_RA; // this will clear the COCO bit that is also the interrupt flag cycle_flags |= ADC0A_DONE ; // mark this step done } else if (( ADC0_SC1B & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK) { PIN1_LOW result0B = ADC0_RB; cycle_flags |= ADC0B_DONE ; } return; }

Is it possible in that interrupt to switch the input target to convert?

For example I start with ADC0, once the conversion is finish, I continue with the ADC1 and so on.