AnsweredAssumed Answered

Problem doing Differential ADC1 MQX4.0, CW10.2 & PE

Question asked by Tom Junkans on Apr 9, 2013
Latest reply on May 1, 2013 by Monica Arvizu

I am using a K40 Tower System with MQX4.0 CW10.3 and cannot get the ADC to do differential mode.

 

I used PE to set it up. ADC1, Differential, input-> PGA1_DP/ADC1_DP0/ADC0_DP3 and negatice ->PGA1_DM/ADC1_DM0/ADC0_DM3, Conversion time                                : 9.615385 µs, High voltage reference Vrefh_1_2V, Low voltage reference Vrefl_1_2V

 

My code from the example PE stuff builds and runs but all I get is 56891 to 56897, no matter what I put on the input lines ADC1_DP0 & ADC1_DM0.

 

Here is the code:

void main_task(uint_32 initial_data)

{

  uint_16 atodValue;

  MyADCPtr = AD1_Init((LDD_TUserData *)NULL);             /* Initialize the device */

 

  printf("\n\n-------------- Begin TJs Differential ADC example --------------\n\n");

  while (TRUE)

  {

        _time_delay(5);

        SampleGroup[0].ChannelIdx = 0U;                         /* Create one-sample group */

        Error = AD1_CreateSampleGroup(MyADCPtr, (LDD_ADC_TSample *)SampleGroup, SAMPLE_GROUP_SIZE);  /* Set created sample group */

        Error = AD1_StartSingleMeasurement(MyADCPtr);           /* Start continuous measurement */

        //_time_delay(2); //while (!AD1_GetMeasurementCompleteStatus(MyADCPtr)) {}; /* Wait for conversion completeness */

        while (ADC1_SC2 & 0x080);

        Error = AD1_GetMeasuredValues(MyADCPtr, (LDD_TData *)MeasuredValues);  /* Read measured values */

        printf("%5d,\n ", *MeasuredValues);

  }

    printf("\ndone!\n");

    _task_block();

 

Any help or ideas is much appreciated.

Thanks and cheers,

Tom

 

Outcomes