I added a PICList tag so more people will see your question. I don't see anything obviously wrong with the code you sent. It looks to me like it is CCS's "C". If so, did you include a "use delay()" directive to let the compiler know what speed oscillator you have. You might want to try out the "EX_ADMM.C" sample included with CCS "C" to see if that works. It should compile/run fine if you just change the processor and speed directives to match the setup you have. I've never used the "ICEPIC" emulator but, I have used a number of different emulators over the years and have often found A/D conversion results unreliable on emulators. Whenever I have questionable A/D results on an emulator I first check the signal with a DMM and/or oscilloscope to make sure the signal is what I expected. If the signal looks good I next try the circuit with a programmed chip instead of the emulator. One last thought, make sure your source impedance is 10K or less. Paul > -----Original Message----- > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Mccauley, Daniel H > Sent: Friday, November 21, 2003 8:01 AM > > I am having some difficulty getting the A/D Converter in my > PIC16C76 Emulated System (via ICEPIC). I'm inputting a 0-5VDC > voltage through a series 10 ohm > resistor into Port A0 of my microcontroller which at the time is > the ICEPIC emulator. > > The problem is that the voltage seems to be drifting all over the > place and not settling. I think it may either be a code problem > on my part. > In particular, the voltage seems to be constantly and slowly drifting up. > > The following subrouting is from my program. > > //***************** > > setup_adc_ports (ALL_ANALOG); > setup_adc (ADC_CLOCK_INTERNAL); > set_adc_channel ( 0 ); > > while (TRUE) > { > value = read_adc ( ) ; > delay_ms (20); > > *****routine here for displaying 8-bit A/D number on LCD***** > } > > Any thoughts??? > > Thanks in advance! > Dan -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body