AnsweredAssumed Answered

Reading ADC_LDD values

Question asked by yogesh patel on Jun 17, 2013
Latest reply on Aug 27, 2013 by Monica Arvizu

Hi

 

I have  TWR-K20D72M and I read the quick start pdf of the TWR-K20D72M .I am  Freescale MQX RTOS 4.0 BSP for TWR-K20D72M.

Now I want to read the ADC value which comes from the Potentiometer Already attach to the board. So I added ADC_LDD from processor expert and set the pin no. of the potentiometer mentioned in the Manual. My settings are shown in the picture attached. then I generate the code and build bsp.


My code for reading the value is below.


 

 

LDD_TDeviceData     *Analog_DeviceData;

LDD_TError           Analog;

LDD_TData           *Buffer_DAta;

 

 

static uint16_t value;

void Analog_task

(

  uint_32 initial_data

)

{

  puts("\nInitializing Analog device.....");

  Analog_DeviceData = AD1_Init(NULL);

  if (Analog_DeviceData == NULL)    {

  puts("failed");

  _task_block();

  }

  else {

  puts("done");

  }

 

 

  for(;;) {

  //AD1_StartLoopMeasurement();

  AD1_StartLoopMeasurement(&Analog_DeviceData); /* do conversion and wait for the result */

  AD1_GetMeasuredValues(&Analog_DeviceData,&Buffer_DAta); /* get the result into value variable */

 

   printf("\n - Buffer_DAta              = %d Hz", &Buffer_DAta);

   puts(Buffer_DAta);

  

 

 

  }

}

 

 

But no output Shown I change the value.

Can any one suggest me the efficient way of reading the ADC values using MQX and Processor Expert.

 

 

ADC Freescale.png

 

Attachments

Outcomes