This is regarding auxilary ADC (ADC1).  I am measuring single ended values in unipolar against ADC5 (which is connected to GND).

=====================================================================

ADCFLT = 0x4F;           // Chop off, 100hz samping rate. No averaging.  also resets both ADCs

ADCMDE = BIT7 + BIT1;           // [7]=512Khz, [4:3]=normal pwr, [2:0]=2 (single conversion)

Vtemp = Vtemp/65535 * 1.2;    // convert to voltage (internal ref = 1.2V)

=====================================================================

ADCFLT = 0x4F;               // Chop off, 100hz samping rate. No averaging.  also resets both ADCs

ADCMDE = BIT7 + BIT1;           // [7]=512Khz, [4:3]=normal pwr, [2:0]=2 (single conversion)

Vtemp = Vtemp/65535 * 1.2;    // convert to voltage (internal ref = 1.2V)

I experience the following problems:

-- readings are all over with 50% variations.  My source is very clean on oscilliscope

What do I have to do to measure a high impedance source?  I tried sampling down to 50Hz, chop on, averaging, delay between two reads.. but nothing works

• The main problem is that you start conversion before you switch the input configuration. You first should set ADC1CON and than start the conversion via ADCMDE, otherwise the digital Sigma-Delta-Filter has still data from AIN4/5 input and it takes at least 1 sample-cycle to fill the filter-pipe with correct data.

Another point to mention are the input voltage specifications as explained in Reading negative voltage with ADUC7060.

To get AGND related, you can bypass the negative input buffer (AIN5 connected to AGND).

• Thanks, I understand now that ADC6 thru ADC9 will not work until GP0CON1 is written a 0x1.  I was previously writing a value of 0x2

I can not seem to write a value of 0x1 to GP0CON1.  I had no problem writing 0x2 previously.

Here's my code:

GP0CON0 = 0;

GP0KEY1 = 0x7;

GP0CON1 = 1;           // 8-bit. Bit[1]=0 (I2C), bit[0]=1 (ADC)

GP0KEY2 = 0x13;

What could be the problem?

Also, I can not afford to loose all 4 pins, as I am using I2C bus on P0.1 & P0.3.  Since ADC6 is only read at power up, can I switch back the GP0CON1, after I take my reading for rest of the program?

• This should be possible I think.

• I have now tried all sorts of ways, but I can not write "1" to GP0CON1.  I can not measure any voltages on AIN6-AIN9.  These are not dedicated ADC inputs, but shared with didgital IOs.  My dedicated ADC inputs work.

What do I need to do to read voltage on a shared ADC (6,7,8,9)?

• BTW, I just want to mention that I am able to write a value of 2, but not 1.   Even if I write 3, only 2 gets written.  Something inside the chip is blocking me to write a 1 to GP0CON1.  I tried writing as a first piece of code, and other places - but nothing works