CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Increase A/D resolution?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Georg Prinz



Joined: 07 Jan 2004
Posts: 22
Location: Frankfurt, Germany

View user's profile Send private message Send e-mail

Increase A/D resolution?
PostPosted: Tue Sep 13, 2005 4:53 am     Reply with quote

Hi folks,

is it possible to increase the 10-bit resolution of the pic A/D-converter by oversampling the signal? If yes, what is the mathem. background or a hint where to find it and does anybody have a code snippet for CCS-compiler for 18F4620.
What are the limits?

Thanks in advance

George
_________________
dl 2 kp
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue Sep 13, 2005 5:50 am     Reply with quote

The built in A to D converter resolution in PIC microcontrollers is impossed by the
hardware architecture, not for the sample rate. Resolution indicates the number of
discrete values that an A to D Converter can produce.
Using microcontrollers with built-in AD Converters, the user only determine the
Start of Conversion. If enabled, the End of Conversion can set an interrupt flag,
meanwhile the user canīt do anything to modify this process.

Some external AD converter devices that use Slope-Integrating Type, perform the
conversion process by feeding the unknow signal to an analog integrator for a fixed
period of time. In this type of converters an external counter is used to measure
the time of a know signal against the time of the unknow signal. Increasing the
clock frequency of the external counter increase the resolution.


Fortunatelly, ranging from 6 to 24 Bits actually you get a lot of very good external AD
converters that can suit your needs without being involved in such obscure tasks.

Humberto
Georg Prinz



Joined: 07 Jan 2004
Posts: 22
Location: Frankfurt, Germany

View user's profile Send private message Send e-mail

PostPosted: Tue Sep 13, 2005 6:20 am     Reply with quote

Ok Humberto,

thank you for your reply. This is what I suggested, too. The reason was that I found a software at the microchip forum (18ADOver), which says "Oversampling and averaging technique used to improve the S/N and number of useful bits in an A/D convertrer". It sounds that they pretend to increase the resolution by simple oversampling. Averaging is clear and accepted, but increasing the resolution is nonsense. Or they mean that they increase the useful bits within the range of 10bit resolution of the A/D converter.

Ciao

George


_________________
dl 2 kp
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Sep 13, 2005 6:47 am     Reply with quote

Humberto wrote:
The built in A to D converter resolution in PIC microcontrollers is impossed by the
hardware architecture, not for the sample rate. Resolution indicates the number of
discrete values that an A to D Converter can produce.
Using microcontrollers with built-in AD Converters, the user only determine the
Start of Conversion. If enabled, the End of Conversion can set an interrupt flag,
meanwhile the user canīt do anything to modify this process.

Some external AD converter devices that use Slope-Integrating Type, perform the
conversion process by feeding the unknow signal to an analog integrator for a fixed
period of time. In this type of converters an external counter is used to measure
the time of a know signal against the time of the unknow signal. Increasing the
clock frequency of the external counter increase the resolution.


Fortunatelly, ranging from 6 to 24 Bits actually you get a lot of very good external AD
converters that can suit your needs without being involved in such obscure tasks.

Humberto


Forgive me if I don't understand you correctly, but I get the feeling that you are saying that you can not extend the resolution of the Pic's A/D. In certain cases it is possible to extend the resolution through this method:

http://www.ccsinfo.com/forum/viewtopic.php?t=4502
http://www.amresearch.com/v6/appnotes/appnote003.pdf


Last edited by Mark on Tue Sep 13, 2005 11:32 am; edited 2 times in total
Ttelmah
Guest







PostPosted: Tue Sep 13, 2005 7:13 am     Reply with quote

How effective it is, depends on the nature of 'errors' in the ADC. If (for instance), your accuracy is not really 10bit, because of noise in the system, and this noise is random, then oversampling allows the full accuracy to be achieved. Similarly, if the ADC is deterministic, and for a signal sitting half way between two values, returns the two possible readings in a random pattern, that is symmetrical in terms of how often the two values are given, the results can be averaged to give a genuine extension of the accuracy. However you have to remember that linearity errors in the ADC itself will still remain at their original values. Hence though you may get legitimate readings, corresponding to an extra bit, the linearity of the converter, and accuracy of the reference source will remain unchanged. Also the time that needs to be allowed for the sample capacitor to be charged needs to be extended, to handle the potential extra resolution, and response speed will be proportionately lower.
This approach will not give you a 14bit AD, from the PIC hardware, but in some cases can be used to maximise the resolution available.
The standard averaging algorithm publshed in the past can be adapted to test this:
Code:


int32 sum;
int16 result;

sum+=(read_adc() * 4);
result=sum>>5;
sum-=result;


Gives effctively 32* oversampling, and returns a 12bit result.
For some applications/sources, it can work suprisingly well.

Best Wishes
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue Sep 13, 2005 10:03 am     Reply with quote

___________________________________________________________
Mark,

I donīt understand why you "remark" all my post. Did I wrote something that is not true nor real or senseless?
After that you didnīt write anything and redirect to an inexistent link and to an example coded in Forth (???)

Kindly, pls post your opinion and keep my posts.
___________________________________________________________



Regarding the oversampling method to improve the resolution in AD converters, it is a technique that can be used only in special cases, it is not applicable to all kind of signals.

Following I pasted some conclusions about this subject in chipcenter tech app note:
http://archive.chipcenter.com/TestandMeasurement/tn035.html
by Leonard Staller, Applications Engineer,
Cygnal Integrated Products, Inc., Austin, Texas



"Oversampling and averaging will work only if the A/D converter noise can be approximated as white noise. If the input signal changes randomly from sample to sample by amounts (amplitude) comparable to the code size (1 LSB), and the input signal has an equal probability of being anywhere between two adjacent codes, then the noise can be modeled as approximating white noise.

What is white noise? It's noise that's characterized as having a uniform power spectral density over a frequency band of interest. When noise can be approximated as white noise, then oversampling and averaging can improve the SNR and increase the effective resolution of your data.

If the overall noise isn't stationary (some systems may have some correlation due to feedback), then oversampling and averaging may not be effective. Additionally, if the quantization noise is comparable to sources of white noise (thermal and shot noise are small compared to quantization noise), then oversampling and averaging may not be effective."



Humberto


Last edited by Humberto on Wed Sep 14, 2005 8:19 am; edited 1 time in total
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Tue Sep 13, 2005 10:17 am     Reply with quote

RJ is right. The key is that the errors be uniformly distributed (white noise). Then the averaging of multiple samples will result is an apparent increase in resolution. If the ADC is of such poor quality that its quantiziation noise overwhelms external noise sources then you will not get the sqrt(num_samples_averaged) improvement factor. The resulting data will be colored by the distribution of the quantization errors.

The terms "dither" and "dithering" apply and might make good Google search terms. Or you might end up with something more related adult entertainment Shocked , Google is funny that way.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Sep 13, 2005 11:43 am     Reply with quote

Humberto wrote:
___________________________________________________________
Mark,

I donīt understand why you "remark" all my post.


Cause it is too easy to just click the quote button Wink


Humberto wrote:
Did I wrote something that is not true nor real or senseless?

That's not what I meant. If I thought that then believe me, I would tell you flat out that you are wrong!

Humberto wrote:
After that you didnīt write anything and redirect to an inexistent link

Oops Embarassed not sure how that happened but I fixed it.


Humberto wrote:
to an example coded in Forth (???)

What, we all don't understand Forth? Razz I can program in multiple languages and do so daily. Yeah, I might leave off a ';' or leave off the "Then" for an "if" statement in VB but all in all, most languages are quite similar. Besides, how am I to know if anyone reading knows Forth. I am just posting useful (IMHO) information. Besides, doesn't the first part explain things in plain English language??

Humberto wrote:
Kindly, pls post your opinion and keep my posts.

I posted my opinion. I didn't delete your posts, nor did I say anything bad about them. I merely quoted you so that if you were not aware of this technique that you would read it. So let it roll off your back dude Cool
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: Increase A/D resolution?
PostPosted: Tue Sep 13, 2005 1:49 pm     Reply with quote

Georg Prinz wrote:
Hi folks,

is it possible to increase the 10-bit resolution of the pic A/D-converter by oversampling the signal? If yes, what is the mathem. background or a hint where to find it and does anybody have a code snippet for CCS-compiler for 18F4620.
What are the limits?

Thanks in advance

George


I have had very good results reading a 4-20mA input signal dropped on a 200 ohm load. I filter to a 12 bit value from the built in 10 bit ADC. Using a calibration source that can drive a variable current I can hit each increment on a 12 bit scale without trouble. I don't know how liner it is but it is certinaly better than 10 bits. In my applications the input never changes at a rate that would exceed the filters frequency.

http://www.ccsinfo.com/forum/viewtopic.php?t=19509&highlight=filter
Georg Prinz



Joined: 07 Jan 2004
Posts: 22
Location: Frankfurt, Germany

View user's profile Send private message Send e-mail

PostPosted: Wed Sep 14, 2005 11:45 pm     Reply with quote

Thank you all for the valuable explanation and references, especially from Humberto and Neutone. It helped me a lot to revise my opinion and to make the right decision for my design.
Very Happy
Unfortunately I am not allowed to access the url //home.houston.... because members only are accepted.

Best Regards
Georg
_________________
dl 2 kp
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group