> From: Mark A. Samuels[SMTP:msamuels0@COX.NET] > Sent: Wednesday, February 11, 2004 2:43 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC:] A/D module gain > I'm having some issues with 10-bit A/D conversions that I've never seen before, and wanted to know if anyone on the list had ever > seen, or would have any insight into... > I'm seeing a variable gain in the A/D result, apparently dependent on the frequency of the sampled signal. I'm primarily > interested in reading a 1 to 6 hz ac signal. The ADC works perfectly at DC, and works perfectly above 20hz. > My test setup right now is the frequency generator and the scope are both connected directly to the AN0 input, on the PIC pin > itself. The only other thing on the board that is on this pin is a voltage divider, made up of 2 1k resistors to set my bias at 2.5v, > and an open connector where the normal analog signal would be applied. > I'm sampling at 192hz, which is plenty slow, and time samples as follows: > turn on the A/D module, delay 24uS (calculated min. Taq of 11.5uS), do the conversion, delay 100uS, turn the A/D module off, > store ADRESH and ADRESL, delay remainder of 5.2mS necessary for 192hz sample rate, and repeat. I've also tried this with a > full millisecond aquisition time, and a full millisecond to do the conversion, with the same results. Also tried witl all possible > ADC clock sources, with identical results. Once I've read all 192 samples, I spit out all the sampled values via the serial port, > and can capture and plot the data. > Waveforms look perfect, just the amplitude is off. The gain that I see is anywhere from 2 to 5 times, depending on the frequency > ranging between .5hz and 10hz. The common elements in all of this are the signal generator and the scope. Perhaps the output of the generator changes with frequency. You may say that you are using the scope to keep the output constant as the frequency changes. Here is a subtle point: the frequency range from 0.5 to 10 Hz may be at the low end of the AC range for your scope. If you are using AC coupling, you may be seeing the fall off of the scope response, which you are compensating for by cranking up the output of the generator. By the time you get to 20Hz, the input is above the knee of the input response. Perhaps you are using AC coupling to prevent the 2.5 volt DC bias from complicating the display. Try using DC and shifting the display accordingly. John Power -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads