AnsweredAssumed Answered

TWR60N512 ADC_LDD problem

Question asked by Pantelis Georgiadis on Jul 31, 2011
Latest reply on Mar 30, 2012 by ff ff


I try to read 2 analog channels using PE bean ADC_LDD. I think I set up correctly the inputs  , the sampling group etc in the

inspector. My problem is that I always read only the first channel in the MeasuredValues array. The 2nd is

always 0. If I exchange the index order I read the 2nd channel but always in the first position the 2nd is again 0.

I opened the file AD1.c created by PE and everything seems to be ok. This is the code in the main file:


/* MODULE ProcessorExpert */
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "AD1.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"

/* User includes (#include below this line is not maintained by Processor Expert) */

    LDD_TDeviceData *adcDevData;
    LDD_TError           err;
    #define SAMPLE_GROUP_SIZE  2
    AD1_TResultData MeasuredValues[SAMPLE_GROUP_SIZE];
void main(void)
  /* Write your local variable definition here */

    adcDevData = AD1_Init(NULL);
  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
  /* For example: for(;:smileywink: { } */
      AD1_SelectSampleGroup(adcDevData, 0);
     // Measure(adcDevData);
    while (!AD1_GetMeasurementCompleteStatus(adcDevData)) ;
    AD1_GetMeasuredValues(adcDevData, (LDD_TData *)&MeasuredValues);
  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

/* END ProcessorExpert */