PDA

View Full Version : Adc Ref. V.



GEEZER
- 2nd May 2005, 01:01
I would like to read voltages from 0 to .5 volts (0 to 500 millivolts). To get highest resolution I would like to set the reference just above .5 volts.

I understand that I can use vss, vdd, a couple of the porta pins, or any combination to set the reference.

Is there any way to set the reference very low without giving up one of the porta adc's. I need all 8 of them. The pic is a 16f877a.

Also, I have heard something about capacitors to keep the adc's from interaction error. Information on this will help me too.

Your knowledge will be appreciated.

Melanie
- 2nd May 2005, 01:28
The ADC section in the Datasheet for your PIC will tell you what you can and can't do with references. If you want to change the reference away from Vdd, then you will need to lose a pin for that task (see ADCON1 Register PCFG configuration 0001).

There is only one ADC on the PIC... it is however multiplexed to several pins. Providing you allow enough settling time for the sampling capacitor to charge before initiating a conversion (50uS is a good starting point), you will have no problem switching between multiple inputs.

modifyit
- 2nd May 2005, 01:58
Melanie,

I guess this is a little off topic, but you mentioned 50us between reading in different a/d values on porta. Are you basically saying we should not attempt to do....

ADCIN 1, var1
ADCIN 2, var2
ADCIN 3, var3

Are you saying we need at least 50us between differnt ADCIN commands or wierd issues may result?

Thanks for clarifying

Warrier
- 2nd May 2005, 05:09
Internally, the sampling switch and the channel multiplexers are CMOS switches and they present an ON resistance that is a linear function of supply voltage. (it can vary from about 5kohm to 10kohm for Vdd ranging from 5V to about 3V). When a signal is applied to any pin, the internal holding capacitor has to charge to the input voltage through this resistor. With a 10bit ADC, you need the holding capacitor to be about 0.1% of the applied voltage to get accurate results.

You also need to make sure that any external amplifier also settles down to this accuracy before you let the ADC perform the digitization. Hopefully you are not increasing this value outside the PIC using any resistors. The acquision time thus is close to about 20usec at 5V with a 10k signal(source) resistance (impedance). To allow for other switches to settle, Ms. Newman is suggesting 50usec.

No, you don't need to add a Pauseus 50 if you have already defined DEFINE ADC_SAMPLEUS 50 at the header. This keeps the program waiting for 50usec between setting the selected channel and starting the AD conversion.

When you set your external reference to 500mV keep in mind that your LSB is only 500microvolt. The ENOB of the PIC ADC is only 9.5bits even with severly bandlimited signal. Glitches when operating internal switches and amplifier settling time may all be comaprable to this value. Keeping signal path clean also becomes critical. Sloppy Vref can eat into this resolution. Bypass is a must.

-warrier

GEEZER
- 4th May 2005, 05:07
Thanks everybody, lot's of information. Just what I need.

G8RPI
- 4th May 2005, 13:13
Hi Geezer,
While you can use a 500mV reference, it will (apart from using pins on the PIC) compromise your system performance. The non-linearity for the 'F877 goes up to 1.5 bits with a 2V reference. Microchip don't specify performance with a Vref below 2V, but you can be sure it's much worse at 500mV.
You are also down in the digital noise. You would be better off amplifying your signal up to 5V full scale before connecting it to the PIC. A gain of 10 is easily acheived and well worth the cost of a couple of quad op-amps (actually four dual's are probably cheaper). An LM358 will give reasonable performance.

Regards,
Robert G8RPI.

GEEZER
- 5th May 2005, 00:49
Thanks Robert, as a matter of fact I have some LM324's already on the board, and I have free opamps. The requirement was for a single opamp in each location on a plug-in bread board, and I had some 324's handy, so I just stuck the quads in there for testing purposes. They are right at the point of sampling.

Your suggestion has promise.

Thanks again,

The Geezer