PIC ADC Questions - Page 1
Forum section: electronics / general

author: mariush
author_rank: Super Contributor
timestamp: April 30, 2014, 02:27:33 am
content: I'm working right now on a PIC project that involves reading voltage output from an AD595 (thermocouple amplifier). I've made PIC projects in the past but very few involved using the ADC.I'm using PIC16F1519, for no particular reason... I bought a bunch a while ago because 1. they were cheap 2. they had 10bit ADC 3. they had lots of pins (DIP40) and 4. they have lots of flash memory. I've used a few of these with led matrixes, uart etc.I've not yet tested this on the breadboard but I'm going to do it tomorrow or when I have more time, at the moment I'm writing the code in MPLAB X.So I'm checking the datasheet (which ishere) and in particular the ADC chapter (page 135+).I've set the internal voltage reference to 4.096v, I've configured the ADC to use the internal voltage reference. I'm planning to use the internal oscillator at the default 16 Mhz so I've set the conversion clock to Fosc / 32, because it gives a reasonable value of 2us in that table on page 137.Next, I looked on page 140 at ADC conversion procedure and I noticed something ... they turn on the adc and wait the required acquisition time, for the sampling capacitor to charge. Only then, I'm supposed to set GO to 1 and then wait until it becomes 0 again.Am I right to assume that this wait period only happens once, when the adc is turned on? Or, also when I change the channel (because sampling cap could be discharged due to nothing connected on previous channel) ? If only when turned on, then if I start the ADC at "boot" when I initialize the ports and everything, most likely there's going to be a few ms wasted initializing the PIC so no need to add code/ delays each time i do an adc read, I can then just set the GO bit and wait for the conversion to finish, I don't have to turn on and off the adc after every conversion.Besides saving power (I suppose), is it wrong to leave the adc on (but without doing conversions) all the time? Can it affect other parts of the PIC (heating the chip, noise etc)?I suppose if I measure the voltage of a battery for example, I would want to disable the ADC or change the channel at least so the battery wouldn't be discharged the adc, right?There's also a mention of the adc needing low impedance, maximum being 10kohm. The AD595 chips just says it has low impedance output of 10mV/C but I don't see any actual value for the impedance in the specifications... being the output of an opamp it should be fine, right? Am I missing something here?Thanks in advance for clearing this up and sorry if the write style is confusing

author: Skimask
author_rank: Super Contributor
timestamp: April 30, 2014, 04:07:03 am
content: I just got done doing the same basic thing with an 18F27J53, practically the same ADC in a different PIC.I wouldn't worry too much about anything. I found that I've been able to run the ADC balls-to-the-walls and still get good readings. Turn on the ADC, take a sample, shut it down. At most, I might wait an extra microsecond or two before doing anything with the ADC. In those rare cases when the ADC readings are all over the place, I back off the Tacq and Tad one step at a time until the readings are good, then go one more notch, and call it good.I haven't had any problems leaving the ADC on while not using it. If you're looking to squeeze every last micro-amphour out of a battery, ya, turn it off when you aren't using it...because that's what you're after, absolute minimal current draw.Otherwise, it's effectively a high-impedance input and doesn't draw much current at all.

author: Chipguy
author_rank: Unknown
timestamp: May 04, 2014, 07:57:19 am
content: I am using the PIC16F887 at the moment and also doing stuff with the ADC.When there is no waiting time after changing the channel the readings can be off.I found weird non linearities in reading after having miscalculated the waiting time (factor 4 too short).I also found that having a low pass filter with 1-10K / 1µF or more at each input decreases the noise somewhat, so for non time critical stuff I went for this input design.Cheers,Chipguy

author: Baliszoft
author_rank: Frequent Contributor
timestamp: May 04, 2014, 08:21:29 am
content: I would use a buffer on the output. Check the fourth note of the specs in the datasheet. I have already used these analog devices amplifiers in the past (not this exact one though), neither had low impedance output.

author: Unknown
author_rank: Unknown
timestamp: May 04, 2014, 09:56:23 pm
content: I've used the AD595 with a pic (16F877A) and had no problems running it straight in via a voltage divider up to 1250 degrees; I did have a bit of noise on mine so I just filtered it out in software, which worked really nicely.