ADC conversion on multiple inputs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC conversion on multiple inputs

833 Views
xavierbuhot1235
Contributor I

Hello,

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.

Labels (1)
0 Kudos
6 Replies

541 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I think customer can software trigger ADC1 module at ADC0 interrupt service routine.

Thank you for the attention.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

541 Views
xavierbuhot1235
Contributor I

In fact I made a mistake.

I want to change the channel after each convertion.

Is there posible to stop the conversion on a channel in the interrupt and swap to an other channel?

0 Kudos

541 Views
xavierbuhot1235
Contributor I

I try the code on my TWR kit k60 512. I decrease the prescaler to reduce the conversion time.

I should have more than 10K conversion per second but I can't go above 700 conversion per second.

What should be the maximum number of conversion per second  on my kit?

0 Kudos

541 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Please check the ADC conversion speed below:

pastedImage_1.png

pastedImage_2.png

If customer consider to use ADC interrupt mode and in interrupt service routine software trigger ADC conversion, the ADC conversion rate also need to consider the ADC ISR execute time.

There is an application note AN4590 using DMA to emulate ADC flexible scan mode and AN4590SW is the related software.

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

541 Views
xavierbuhot1235
Contributor I

Where could I find these tables? I cannot find it in the reference manual.

0 Kudos

541 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Those tables are located in K60 datasheet.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos