AnsweredAssumed Answered

ADC Interrupt in Kinetis MKE02Z

Question asked by Pablo Suarez on Oct 28, 2014
Latest reply on Nov 13, 2014 by Pablo Suarez

Hi there, I'm trying to implement a synchronous measure of samples using as time base a timer interrupt. To do this I chose the ADC One Conversion method inside a timer interrupt in this way:

 

On Processor Expert:

1. Set Interrupt service / event = Disable (As the Processor Expert help suggest for One Convertion method)

2. SetUp A/D Channel List with my 4 ADC inputs.

3. SetUp Static sample group indexed to my 4 ADC inputs.

 

On my interrupt function:

 

ADC_TResultData ADC_Values_Result [4];

void ADC_Sampling (void)

{

     (void) ADC_SelectSampleGroup(ADC_DeviceData,0);

     (void) ADC_StartSingleMeasurement(ADC_DeviceData);

     while (!ADC_GetMeasurementCompleteStatus(ADC_DeviceData)) {}; /* Wait for conversion completeness */

     (void) ADC_GetMeasuredValues(ADC_DeviceData,&ADC_Values_Result);

}

 

As you can imagine I have some problems with this code.

When it run on main, it works perfectly, if I set Interrupt service / event = Enable, but if I set Interrupt service / event = Disable the processor don't come out from GetMeasurementCompleteStatus while loop;

If I set Interrupt service / event = Enable this function don't works on the timer interrupt.

 

So, my questions: Why I need to set Interrupt service / event = Enable to make a single measure of a group?

How may I measure the group values without generate interrupts?

I read and implement the One conversion of a created sample group, without interrupt service from Processor Expert Help, but it neither worked.

 

I will appreciate your help.

Best regards.

Outcomes