A catchall for PSoC5 discussions not captured by the other forums.

Moderator: ericb


Postby BenGraham » Tue Sep 24, 2013 3:13 am


Just a quick question regarding the ADC_SAR on PSoC5. I am currently using this ADC to measure a simple DC voltage, but the values the ADC returns are always incorrect.

The ADC_SAR is setup in single ended operation, range from VSSA to Vddd, Internal Vref, SPS =60000, Clk Frequency 1140khz and resolution 12 Bit. The VDDD is setup for 3.3Volts.
The attached photo shows how the input is feed into the ADC via a mux.
The ADC is been used manually by calling ADC_StartConvert.


if(ADC_IsEndConversion(ADC_WAIT_FOR_RESULT) != 0) //Wait until ADC meas finished
ADC_Pressure_Value=ADC_GetResult16(); //Return ADC value


For example with an input voltage of 2.582Volts the ADC_GetResult16() is returning A6A, which when calculated corresponds to (2666*0.80566) =2147mV.

From my understanding the ADC_GetResult16() returns the 12 bit value and from this it just a matter of multiply by the 0.80566mV(resolution of the 12 Bit ADC)

Could the mux be causing a problem, or am I doing something very stupid. Any suggestions would be great.

PSOC_ADC_Problem.png (72.05 KiB) Viewed 1638 times
Posts: 5
Joined: Fri Mar 14, 2008 4:37 am


Postby bobmarlowe » Tue Sep 24, 2013 5:29 am

Did you have a look at the functions ADC_SetGain() and ADC_SetOffset() to calibrate your ADC? Additionally it is advisable to use a configuration that allows for placing a bypass capacitor at P0_2 or P0_4. Additionally check the 3.3V with the ADC and check your multimeter.

User avatar
The Big Cheese
The Big Cheese
Posts: 1490
Joined: Thu Oct 06, 2011 2:03 am
Location: Germany


Postby danadak » Tue Sep 24, 2013 2:10 pm

Don't forget to take into consideration mux settling time -

Analog Mux Settling time.jpg

Also keep in mind return result from API is twos complement.

Additionally consider adding two mux inputs, one with input at Vssa, the other at Vdda,
and use measured values to correct other channel readings, to take out offset and gain

Some possible use -

Regards, Dana.
Field Application Engineer
KB1RHB Mostly listen :)
Semi Retired
User avatar
The Big Cheese
The Big Cheese
Posts: 2008
Joined: Thu Dec 27, 2007 8:42 am
Location: New Hampshire

Return to “%s” PSoC5 General

Who is online

Users browsing this forum: No registered users and 1 guest