AnsweredAssumed Answered

ADC Channels

Question asked by Anthony Massa on Sep 19, 2012
Latest reply on Sep 20, 2012 by Anthony Massa

Are there registers ADCx_Rn and ADCx_SC1n for each channel in the ADC0 and ADC1, where n denotes the channel?  I'm confused as to how the different channel registers are accessed.

 

I am planning on using 9 (or more for future stuff) ADC channels. I see in the example code (adc_demo) ISR code the reading of the SC1A or SC1B registers to determine which ADC channel completed it's conversion. Here's the code:

 

if (( ADC1_SC1A & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK)

{ // check which of the two conversions just triggered

  result1A = ADC1_RA; // this will clear the COCO bit that is also the interrupt flag

}

else if (( ADC1_SC1B & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK)

{

  result1B = ADC1_RB;

}

 

For my case using more than 2 channels, would I need code similar to this to determine the ADC conversion complete interrupt?

 

// check ADC1 channel 4

if ((ADC1_SC1(CH4) & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK)

{

  result4 = ADC1_R(4);

}

// check ADC1 channel 5

if ((ADC1_SC1(CH5) & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK)

{

  result5 = ADC1_R(5);

}

// check ADC1 channel 6

if ((ADC1_SC1(CH6) & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK)

{

  result6 = ADC1_R(6);

}

 

and so on.  I assume there is no way to have an individual channel interrupt (an interrupt per ADC channel).  Is there only a single interrupt per ADC?

 

Thanks.


Outcomes