AD1_OnMeasurementComplete Never Entered

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

AD1_OnMeasurementComplete Never Entered

567 Views
thomasolenik
Contributor III


I am have issues with implementing an AD measurement with the FRDM-KE06Z.  Here is my code to start the measurement that I have placed within a app_Init method that is called from main along with SPI and GPIO Init (those seem to be working fine):

   AD1device = AD1_Init((LDD_TUserData *)NULL);

   AD1_measurement[0]=1; /*Used to confirm the value is being displayed*/

   measure_count = 0; /*incremented in OnMeasureComplete*/

   LDD_TError Error;

   Error = AD1_SelectSampleGroup(AD1device, 0U); /*Select sample group 0*/

   Error = AD1_StartLoopMeasurement(AD1device); /*Start continuous measurement*/

In Events.c I have:

void AD1_OnMeasurementComplete(LDD_TUserData *UserDataPtr)

{

  /* Write your code here ... */

measure_count++;

LDD_TError Error;

Error = AD1_GetMeasuredValues(UserDataPtr, (LDD_TData *)AD1_measurement);

}

The rest of my AD code is as generated by Processor Expert for the ADC_LDD component.

I am displaying the AD1_measurement and a measure_count on an LCD, and they never change from what I set them at.  I have confirmed if I change the values manually in code, the display shows the new values as expected.  So the problem is not with my display functions.  This tells me that the Ad1_OnMeasureComplete within Event.c is never entered.  Otherwise I would at least see measure_count update on my display.

Is there something I am doing wrong to start the measurement? What are some other things that I should check?

The this I am trying to read the output from an AD595 thermocouple amplifier IC.  I have measured the output from the AD595 at room temperature at around 200 mV which should equate to 20 C.

Tags (3)
0 Kudos
1 Reply

327 Views
daweiyou
NXP Employee
NXP Employee

Hi Thomas:

Since you use pe to generate code, you should enable interrupt for ADC.

If ADC finish the measure, but interrupt is not enabled, the AD1_OnMeasurementComplete can’t enter, which is called in ADC_ISR

Dawei You(尤大为)

0 Kudos