A/D conversion problem in 18F2520, 2523, 2550 etc.
Hello again everybody,
I have successfully studied with PIC18F252 and its easy to use 10-bit A/D conversion. I'm designing some temperature controller stuff to use in our university labs.
New generation 18F pics (2520, 2523(12-bit), 2550 and 4550 (with USB). I have never achieved to any precise measurement level with these pics. There's always a difference in the results of Keithley multimer and Pic, to the contrary of "lovely" 18F252, in the levels of 10-20 mV. This difference is sometimes linear or non-linear depending on the addition of capacitors and/or RC filters at the voltage and ref. inputs. (I've never needed to use these precautions on 18F252). I've tried to fix the parameters of ADCON registers, tried many combinations of timing, but it's useless. My reference voltage is provided from Maxim's precision ICs (4096 mV or 2048 mV).
Today, finally I've desperately tried to develop the A/D conversion process of USB demo program written by Mister E and Darrel Taylor (Thanks to them for their great USB comm. example program). I've changed the 8-bit (0-255) resolution of potentiometer voltage to 10-bit (0-1023) by dividing ADREAD variable to low and high bytes, and succesfully combined them in VB6 program to produce the 10-bit result. But the result is still different with this program code.
I'm using picbasic pro 2.47 and latest version of MPASM. I also tried to write the code in assembler according to the timing diagrams of Microchips manual.
I never encountered any problem in 18F252 (no capacitor, no filter, a simple reference source from op-amp buffered voltage divider, max. of 1-2 mV error). But I need to use A/D conversion within a USB Pic and/or in a 12-bit Pic (Unfortunately, all of these pics' A/D conversion procedures are differs from 18F252).
As a summary, can anybody explain where I made mistake(s).
If you've experienced with that kind of millivolt precision application on these Pics, can you provide me the picbasic code of A/D conversion.
(sorry about my English)
Thank You..
Dr Selim Kara
Hardware design fault ???
Hi,
While carefully reading your Datasheets ...
Did you notice the ADC input impedance had slightly changed ??? ... take care to the voltage source impedance !!! ( in your RC filters ... there's a series resistor !!! )
Your "symptoms" make me think it's a source impedance problem ...
Also consider the voltage offset of your buffers ... An AOP gives easily 10 mV offset !!! and from a batch to another, it can widely differ.
Could you show us a scheme of your input circuits ???
I Use a 2520 for my Honda Lawn tractor ( read air and oil temp - LM335 , plus oil pressure - MPX 5700 , with the inboard ADC) and readings are rock steady ...
My ref is a 4.096v from a TL431a ... trimmed with a 4.5 digits multimeter ...
The initial project was built around a 18F452 ... and I didn't notice any change.
Alain
Improving ADC repeatability
High ADC accuracy and repeatability takes dedication at the PCB layout stage. There must be analog ground right beside the analog input and overall copper pour ground planes. Keeping all analog circuitry within its own fenced are of copper usually helps quite a bit.
Another good technique (thanks Melanie) is to take 16 readings, sort them, throw out the top 4 and the bottom 4 then average the eight values that are left. That technique eliminates the outliers and tames the last one or two counts.
I have also found several ADC ticks of noise/variability can be eliminated by locking the sampling point to the mains. I bring low voltage AC to an optocoupler and use that to trigger the ADC conversion. Varying the delay after the mains zero crossing will usually show a sweet spot where the fluorescent lights and other electrical loads are fairly quiet. I NEVER attempt 16 bit ADC without mains locking.
Sloppy techniques that are invisible with 8 bit conversion start showing up with 10 bits and can make the transition to 12 or 16 bit ADC a worthless expedition.
HTH
BrianT