Oh, duh! I'm sure that's it. Thanks! -----Original Message----- From: pic microcontroller discussion list = [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Jan-Erik Soderholm Sent: Saturday, June 05, 2004 19:58 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC:] How to read more than one A/D pin? Lindy Mayfield wrote : > Here is one thing that I am trying, that isn't working: > > 1) Set TRISA so that AD0 and AD1 are inputs > 2) Set ANSEL so that they are both analog > 3) Delay for acquisition time > 4) Set ADCON0 bits to select AD0 for AD I think 3) and 4) are in the wrong order. > 5) Start AD conversion (ADCON0/GO_DONE) and loop until done > 6) Output 2 bytes to RS232 at 9600 baud > 7) Set ADCON0 bits to select AD1 for AD Acquisition is missing here. > 8) Start AD conversion (ADCON0/GO_DONE) and loop until done > 9) Output 2 bytes to RS232 at 9600 baud > 10) Goto 3 > > Is this correct what I am doing here? No, acquisition should be done *after* the channel is selected (or changed). That is the time when the external voltage is "acquisitioned" (read into the internal capacitor in the AD converter). Jan-Erik. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.699 / Virus Database: 456 - Release Date: 6/4/2004 =20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.699 / Virus Database: 456 - Release Date: 6/4/2004 =20 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads