Code examples for oversampling technique using mikroC PRO ?

General discussion on mikroC.
Post Reply
Author
Message
bobx
Posts: 115
Joined: 14 Mar 2010 08:35

Code examples for oversampling technique using mikroC PRO ?

#1 Post by bobx » 28 Nov 2011 14:40

Hello.I used PIC18F8722 that has 10-bit ADC, but I want a more higher resolution of 12-bit
or even more with a good speed.

I want to use oversampling technique in mikroC PRO for PIC18F8722 to higher its resolution;
Would somebody give me some code examples?
Sould I use a special hardware for it?


Thanks,

Acetronics
Posts: 715
Joined: 27 Dec 2006 14:33
Location: Le Tréport , FRANCE

Re: Code examples for oversampling technique using mikroC PR

#2 Post by Acetronics » 02 Jan 2012 15:16

Hi,

Oversampling is a pure view of mind when very little change in signal :

the trick is to take, say, 10 samples and take the mean value.

if your signal stays between 998.5 and 999.5 ... you will have 999 as a mean value ( you get 10 times 999 from the ADC ): NO resolution enhancements ...

if your signal grows linearly from 998.5 to 1000.5 ... you will get 5 times 999 and 5 times 1000 ... mean value will be 999.5 Ok then !

if your signal grows linearly from 998.5 to 1000 ... you will get 6 times 999 and 4 times 1000 ... mean value will be 999.4 instead of 999.25

So, take care ... It doesn't improve resolution in any way if the signal is ~ steady ... :roll:

Alain

Alain

bobx
Posts: 115
Joined: 14 Mar 2010 08:35

Re: Code examples for oversampling technique using mikroC PR

#3 Post by bobx » 04 Jan 2012 17:17

Hello,Acetronics.Thanks for your message.But " oversampling " technique is not the calculation
of a simple mean value as you wrote.You can get know more about oversampling at the following;

1] Microchip's application note; AN1152.

2] Atmel's application note; AVR121.


Thanks,

Post Reply

Return to “mikroC General”