AnsweredAssumed Answered

Help needed on Processor Expert Coding on ADC_LDD KE06Z

Question asked by Eyeow Lee on Dec 9, 2016
Latest reply on Dec 12, 2016 by Alice_Yang

I am using FRDM-KE06Z (MKE06Z128VLK4) to measure the temperature (analog input) and display output at hyper terminal with time stamp. I am using CW 10.6 Processor Expert (PE) to generate code for RTC, ConsoleIO and ADC. I have selected the required components from the components library and configured them in component inspector. I don't have major problem on RTC and Console coding since I  can manage to printf the time stamp at the hyper terminal based on internal RTC clocking from controller. My major problem is I cannot get ADC input readings correctly and to display the raw hex value at hyper terminal.

 

I have attached screen shot of ADC_LDD configuration, main.c code and hyper terminal output.

I follow the typical usage code that can be found at the Help on Component > Component ADC_LDD > Typical Usage.

I suspect the program  stuck at before this line:

 

 

....
while (!AD1_GetMeasurementCompleteStatus(MyADCPtr)) {}; /* Wait for conversion completeness */
Error = AD1_GetMeasuredValues(MyADCPtr, (LDD_TData *)MeasuredValues); /* Read measured values */
i++;
printf("MyADCPtr:0x%x 0x%x MeasuredValues:0x%x 0x%x [%d]\n",MyADCPtr,&MyADCPtr,MeasuredValues, &MeasuredValues, i);
Wait_ms(12000);
}

 

May I know what is the problem? and what is the suggestion to fix it? Thank you in advance.

 

P/S: Before using PE for code generation. I had tried on the ADC_poll_demo sample code from FRDM-KEXX Driver Library Package and it works fine to read and show the raw hex value of each analog channel. I would expect to get the similar kind of raw hex value from the code generated from PE.

Original Attachment has been moved to: main.c.zip

Outcomes