Hi, Selim
First, I'd like to raise the problem data ...
- Your scale is 1 - 4.096v with 10 bits resolution.
- You want to read 10-20 mV
That means you read with 4 mV per Bit ...
The ADC count is always +/- 1 LSB ( rollover error ) ...
So, your result is 1 to 5 +/- 1 ... I do not think you want to seriously regulate something with a +/ 20% input data error...
Now, generally speaking, I always use a mean value - Nb of samples are a function of the measuring allowed time - and, to get rid of the rollover ... I then swap the LSB ...
Moreover, when tracking the mV ... Ground Guard rings around the PIC inputs are to be used ( remember the inputs are "not so far" from the Xtal ... ).
You'll notice the input leakage current has been reduced from +/- 500 nA ( '252) to +/- 100 nA ('2520) ... which means a much greater noise sensitivy ...
I'd lead you to use a ground plane on the component's side, ADC section ...
It would be interesting to know exactly what you want to do ... and how you do it ( input data range, sensors used, ...).
I do not want to be rude ... but tracking 0 -20 mV with a 4v reference is a nonsense without "superior" PCB design skills ... as BrianT told.
" May I ask you, did you ever precisely measure the voltages with a 1 mV (or lower) resolution voltmeter? "
My multimeter is a 4.5 Digits ... so, 1 mV resolution.
I really do not think the solution is in the code lines ...
Regards
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks