From a previous message to the PICLIST: > I'm trying to use all 8 analogue inputs on a 14000. I find that AN1 and > AN5 just give overflows (the other 6 inputs are OK), unless I switch on > the level shift networks. Then they work fine, except for having ~0.5 V > added! > > Is there something obvious I've missed? No, there is something obvious that MicroChip missed. The level shift resistor network is ALWAYS active on AN1 and AN5! Thus, whatever signal you feed to these pins is going to have about 0.5 volts added to it WHETHER YOU LIKE IT OR NOT! Here is an example of how to read AN1 or AN5: 1) Always, always, always CLEAR the LSOFF bit (SLPCON<4>). This "enables" the level shift network. (SETTING this bit doesn't disable the network anyway; in fact, it causes the input to go to +5.0V!!) 2) Read the AN1 or AN5 signal with the ADCON0<0> bit SET! This effectively zeros whatever external signal you are feeding into the chip and allows you to read just the level shift signal by itself. Store the raw counts from the level shift signal for use in step 4 below. 3) Read the AN1 or AN5 signal with the ADCON0<0> bit CLEAR! This enables the external signal, and now you can read the counts for THE SUM of the external signal plus the level shift signal. Store this result for use in step 4 below. 4) Subtract the raw level shift signal counts (step 2) from THE SUM measured in step 3. The difference is the counts representing the external signal only. This is a major pain, but it works! This error is described in the "Errata Sheet for PIC14C000 Revision A" found on the web at http://www.microchip.com/10/Datasheet/Errata.htm ................ -- ------------------------------------------------------ /\ Frank Dalton (fdalton@pineinst.com) //\\ Pine Instrument Company ///\\\ 101 Industrial Drive ////\\\\ Grove City, PA 16127 || (412) 458-6391 || www.pineinst.com ------------------------------------------------------