You can change the measurement range to any of the allowed ranges in the component configuration. You just have to keep the input voltage within that range to get appropriate outputs.
When using the ADC in single-ended mode, also use unsigned integers for the result, otherwise you get negative values when you get to half your input voltage if you use a 16-bit variable for a 16-bit result. So just keep it in mind when selecting the number of bits resolution and variable size.
If you use the ADC in 8-bit mode, you can use LCD_PrintInt8, For 9 to 16 bits, LCD_PrintInt16 and above 16-bits, you have to use LCD_PrintInt32. Also match your result variable to the bit size required. You can always use a larger variable, although it does not serve much of a purpose.
A further note on the gain setting. Keep in mind that if you apply gain to the input, you reduce the input measurement range by the gain factor. You also add more noise to the ADC input as the input noise is amplified as well as adding the amplifier noise. For very sensitive measurements, like load cells, PT100's and other instrumentation, this can become significant.
There is a very good app note (AN2099) on IIR for use in averaging conversion results to average your results. It provides code that works as is or you can change it to suit your own application.
if you have a PSoC without the DeltaSigma ADC and need better resolution out of your SAR ADC, you can always oversample and average. I have very successfully achieved 16-bits on the SAR. AN118 provides the theory behind it.
I hope you find the above useful.
first of all thank you for your help and I tried your code ,i got a resolt of the output voltage how ever the output voltage was wrong for exmplae the voltage are between 0.3-4.01v ( on pin goes to the ground and the second pin goes to Vdd of the Psoc 5 ) . but i get voltages of 0.5-4.9v. do you have idea why am i I getting the wrong value again ?
hi itreid your code and still gives me the wrong answer . maeby i need to add LP filter ?
1 of 1 people found this helpful
I hope you used ADC_SetOffset (); and ADC_SetGain ();
For display at LCD, it is sufficient to average the result.
My old project with a Simple Moving Average: VoltageDisplayMean41.zip
first of all thank you very much this is the closest answer that i got !!! i will try to undestand this code. one more thing is it possible to add
Find on the forum about sprintf and heap size for it
sprintf(string, "%f\r\n", result);
thank you very much evegeny you really helped me , one more thing how did you know to write this code ? is there a source of information that you could share with me ?