AnsweredAssumed Answered

ADC on FRDM problem.

Question asked by filipsobczak on Dec 1, 2012
Latest reply on Dec 6, 2012 by Petr_H

Hey. In my project I'm using 5 single ended ADC channels. I connected my force sensitive resistors to pins PTE20( ADC0_SE0 ), PTE21( ADC0_SE4a ), PTE22( ADC0_SE3 ), PTE 23( ADC0_SE7a ), PTE29(ADC0_SE4b). Then I created 5 static sample groups ( I'm using the ADC_LDD component ) each with one distinct channel assigned.


Three ADC channels work fine. When I want to measure the value on the sensor connected to PTE20 I use the following code:

                             Error = AD1_SelectSampleGroup(MyADCPtr, 0U);
Error = AD1_StartSingleMeasurement(MyADCPtr); // Start continuous measurement
while (!AD1_GetMeasurementCompleteStatus(MyADCPtr)) {}; // Wait for conversion completeness
Error = AD1_GetMeasuredValues(MyADCPtr, (LDD_TData *)MeasuredValue);  // Read measured values
FsrReadings[0] = MeasuredValue[0];
SendUint8_t_1(FsrReadings[0], &deviceData_1);

For each sensor I change the second argument in SelectSampleGroup method and the element number in FsrReadings according to the channel I want to measure. The rest stays the same.


If I touch the sensor connected to PTE20 everything works just fine. It's the same with PTE22( ADC0_SE3 ) and PTE29(ADC0_SE4b).

But when I want to get the measurment form the sensor connected to PTE21( ADC0_SE4a ) I get MeasuredValue[0] = 0 despite touching it. But if I touch the PTE20 sensor instead of PTE21 it measures the value for the PTE20 sensor. So if I measure them both at once (one after the other in the code) and press PTE20 i get FsrReadings[PTE20]=FsrReadings[PTE21]. If I touch PTE21 it looks as if I hadn't touched any sensors FsrReadings[PTE20]=FsrReadings[PTE21]=0. It's the same for the pair PTE22 / PTE23 ( PTE23 doesn't work ).


Do you know what may have caused this? Might it have anything to do with the 'a' letter at the end of ADC channel name ( ADC0_SE4a, ADC0_SE7a )?


There's one more thing I'd like to ask. If I take measurements from all 5 sensors and touch only one of them I get a '1' instead of a '0' for the measurement from the next channel.


If any of those problems might have been caused by wrong selection of conversion time, my settings are: A/D resolution - 8 bits, conversion time - 3.27us.