Hi Paul, Well,here is my expectation of the ADC, please tell me if it is unrealistic: I have a pot as a voltage divider on my input,when I then feed through an op-amp, whose output goes to the PIC's ADC pin thru a 2.2K resistor (to protect the PIC/op-amp in case the PIC pin became an output). I expect that I should be able to adjust the pot and the op-amp gain to provide a certain division ratio of the input (to effectively raise the max ADC input voltage by a factor of about 3.5, to about 17.5v). Now, if I put in an input to the whole system of EXACTLY 2.00 volts, and I get a certain code, I expect to be able to get twice that code (+/- 1) when I EXACTLY double the input to the entire system. I know that the op-amp/pot aren't introducing any offsets,etc., because I measure the voltage at the PIC's ADC input and the input to the entire system and it is exactly what I expect. In other words, the ADC's transfer function should be a straight line which crosses at the origin. INSTEAD, it appears to deviate from this such that doubling the input doesn't exactly double the output. NOTE also, that no matter what I set the division ratio to(with the POT), I cannot compensate for this. This "system" is supposed to be a voltmeter to measure a voltage in the range of 2v to 17.85v,built into a power supply. The input is electrically divided by about 3.5 and then digitally multiplied by 7,to produce a 16-bit number in the range 200 to 1785.If I set the meter to read correctly at mid range (9.75v), by the time I get up to 17v I might read 16.87 and if I go down to 2v, I might read 2.17v. 70mV off is OK, but by the time you get to 140mV or 210mV, you could easily exceede the 5% power supply tolerance of many components. If I set it to be correct at 2v, I am way off at 17v (might read 16.45), which suggests to me that the total system "slope" is not one (I don't get an increase of 1V on the display for 1V on the input) OR there is an offset, YET, when I measure the actual input the the PIC's ADC, that is exactly what it should be, so the gain error is not in the pot or op-amp,so I concluded it must be in the PIC's ADC. As I say, it is not that I want any particular voltage to be exact, I just want the overall deviation to be less than 70mV at all points, and it seems to me from the datasheet's claim of +/- 1 LSB error max, I should be able to do that. Thanks for your help and please tell me where I am going wrong, Sean At 07:35 AM 6/1/99 +1000, you wrote: >Sean Breheny wrote: > >> I am seeing an ADC behavior as follows: if I apply a voltage of, say, >> 2.00 volts to the ADC, I might get a code of 102, as expected. >> HOWEVER, if I apply 4.00 volts, I might get 206 instead of 204. > > OK, I don't see the problem! 102 means 102 +/- 1 which means it could >easily be 103. Twice 103 is 206, which is what you get. No problem! > > If you want to make the FSD match, you need a tweakable reference. If >you want zero to match, you need a tweakable ground. If the results you >get are stable and repeatable, the ADC has fulfilled its mission. >Absolute accuracy is another thing again. > > I think you've got enough answers regarding the crystal. >-- > Cheers, > Paul B. > | | Sean Breheny | Amateur Radio Callsign: KA3YXM | Electrical Engineering Student \--------------=---------------- Save lives, please look at http://www.all.org Personal page: http://www.people.cornell.edu/pages/shb7 mailto:shb7@cornell.edu ICQ #: 3329174 ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download/index.html