-
1. Re: Problem with single ended ADC example project CY8CKIT-030
user_202683688 Dec 26, 2013 12:49 AM (in response to user_202683688)Hi Modrator,
I dont know how to move this thread from PSoC 3 "Device Programming" catagory to "PSoC 3 Architecture" Catagory. It is my sincere apology to all viewer, that I have made this mistake. Please help.
-
2. Re: Problem with single ended ADC example project CY8CKIT-030
user_1377889 Dec 26, 2013 3:30 AM (in response to user_202683688)Don't worry about the placing of your question, we'll find it as long as you use a PSoC 3 entry, forum software is not capable of editing or re-positioning a post (to be true, forum software isn't capable of many things at all)..
There are some knowledge-base entries concerning your issue: Since ADC cannot be made totally error-free they always show some mismatching, but this can be calculated-off with some simple math.
Errors you find are
- Noise
- Offset Error
- Gain error
- Temerature error
and probably some more I've forgotten. Each of these errors initially built into the chip can be minimized,
have a look aththis knowledge-base articles (I found them by typing "ADC error" into the field "Keyword search" at top of this page) http://www.cypress.com/?id=4&rID=43218
Happy coding!
Bob
-
3. Re: Problem with single ended ADC example project CY8CKIT-030
user_14586677 Dec 26, 2013 3:41 AM (in response to user_202683688)You are using the wrong GetResult, GetResult16, should be GetResult32,
see notes below for API (dont forget to decalre output as 32 bit) -
-
4. Re: Problem with single ended ADC example project CY8CKIT-030
user_78878863 Dec 26, 2013 7:05 AM (in response to user_202683688)You also need to be careful with the input configuration. It decides how close to the rails your input signal can get.
-
5. Re: Problem with single ended ADC example project CY8CKIT-030
user_14586677 Dec 26, 2013 8:35 AM (in response to user_202683688)When you config the DelSig the range is shown pictorialy
-
6. Re: Problem with single ended ADC example project CY8CKIT-030
user_202683688 Dec 26, 2013 10:20 AM (in response to user_202683688)Hi Bob Marlowe
Thank you for your valuable time, interest and reply. I will defiantly consider it with tuning of my ADC.
Hi danaaknight
Yes.. I got my answers from your post when I have gone (again and again) through component datasheet. My final result is attached here. Thanks again.
But still My question is what I have to do to get 0x0000 to 0xFFFF for 0v-5v.? (Vssa to Vdda) (my actual requirement). Thanks in advance.
Hi hli
Thank you for your reply. Can you suggest me the buffer mode.? It will be saving me from lot of pain. After seeing in snap as danaaknight suggested in above post, I think it will be Rail to Rail, Still it does not serve the purpose. Thanks in advance.
-
7. Re: Problem with single ended ADC example project CY8CKIT-030
user_14586677 Dec 26, 2013 12:56 PM (in response to user_202683688)If you are looking for real R-R performance you have to bypass the buffer. If you are
not concerned or need the gain the buffer provides. Look at your current config,
R-R with G = 1, buffer enabled., if you look at the graphic its not R-R, its < R-R
performance. Does not allow you to get to ground or to Vdd with input to buffer.
I am getting a Keil error, "Build error: L251: RESTRICTED MODULE IN LIBRARY NOT SUPPORTED "
So I cannot run your code.
Regards, Dana.
-
8. Re: Problem with single ended ADC example project CY8CKIT-030
user_1377889 Dec 26, 2013 3:07 PM (in response to user_202683688)I could open it and compile free of any warning with Creator 3.0
Bob
-
9. Re: Problem with single ended ADC example project CY8CKIT-030
user_14586677 Dec 26, 2013 7:16 PM (in response to user_202683688)Looks like my desktop Creator has to be reinstalled, compile on laptop fine.
I debugged, and changed/addeed code with this -
#include <stdio.h>
unsigned char buff[ 20 ]; // Buffer holding character conversion of ADC results in mV
unsigned char i = 0;
LCD_Position(1u,10u);
sprintf( buff, "%6d", ADC_DelSig_1_CountsTo_mVolts ( i32Output ) );
for ( i = 0; i < 6; LCD_Position( 1u, 10u + i ), LCD_PutChar( buff[ i ] ), i++ );
//LCD_PrintNumber( ADC_DelSig_1_CountsTo_mVolts (i32Output) );
And I get basically results you are looking for.
Note I do see values > 0xFFFF and have not measured to see if
input went outside CM range.
Regards, Dana.
-
10. Re: Problem with single ended ADC example project CY8CKIT-030
user_202683688 Dec 26, 2013 9:20 PM (in response to user_202683688)Hi Top Contributor(s)
Thanks for replying. You guys helping a lot.
I don't know what is going on.. But more I dig, more I got confused.
To be frank I needed to calculate some parameters from this ADC output result(some counter and a 16bit PWM). It requires 16-bit resolution, I tried for even 15 bit but my ultimate slope is not satisfactory. For 16-bit what ever buffer mode I try, I can not get full range of 16 bit (0-65535 for VSS to VDD). For the buffer bypass mode I got some -Ve value (as result is 32 bit signed, thanks for the point Dana) for VSS and 0x000101B5 for VDD. I have tried this by shorting the ADC Input pin directly to VSSA and VDDA. The value between this two point is OK and according to the current configuration. Is it like I am getting the desired result, but I am confused enough to get the conversation done...??
-
11. Re: Problem with single ended ADC example project CY8CKIT-030
user_14586677 Dec 27, 2013 5:13 AM (in response to user_202683688)I believe that basic operation, with buffer bypassed, gives you
a range of Vss to Vdd and correct readings. Its when you go outside
CM range, in this case Vss - 100 mV > Vx > Vdd + 100 mV that your
readings go outside 0 - 0xFFFF.
So just saturate your readings, eg
Vx = ( Vx > 0xFFFF ) ? 0xFFFF : Vx; // Test for radings exceeding Vdd
Vx = ( Vx < 0 ) ? 0 : Vx; // Test for readings < 0
You can add the 100 mV into above tests is so desired, although that would
generate result < 0 or > 0xFFFF.
Regards, Dana.
-
12. Re: Problem with single ended ADC example project CY8CKIT-030
user_202683688 Dec 27, 2013 9:41 AM (in response to user_202683688)Hi Dona,
Thanks you, finally you saved me from days pain. I think this satisfy my requirements. Even if I am saturating results here, it does not affect my other application result. My counter slope (ultimate parameters depends on ADC value) is within the range with this settings.
Thanks again.
-
13. Re: Problem with single ended ADC example project CY8CKIT-030
user_202683688 Dec 27, 2013 9:34 PM (in response to user_202683688)Hi Dana,
Sorry for wrongly spelling your name.
Here with I am including the final concluded project example, in any case if someone need it. Please do comment if I have mistaken.