----- Original Message ----- From: Drew Vassallo To: Sent: Wednesday, March 06, 2002 1:42 PM Subject: Re: [PIC]: A/D sketchiness on PIC16F877 > >When I do an A/D conversion I get funny results. If I use right justified, > >ADFM = 1 and try and read 5V... I get something like (011-1000111). > > You mention that the left justified results are screwy. Well, the right > justified result doesn't seem right, either. Looks like something's wrong > with your input source or your Vref. Are you using a really high impedance > or capacitance for your input source? Is your Vref (Vdd) stable? Is it the > right value? reading 5v (right justified) gives 11-10000011 reading 5v (left justified) gives 11111111-11[111111] - the numbers in [] should be 0... Vref is Vdd... yep, stable at 5.06v through a 7805 just trying to measure voltages out of a resistor divider network. ~10k. no capacitance > Also, try using ADCON1 values of 0x09 or 0x00 instead of 0x02. They should > be functionally the same, but try them just in case. (or 0x80 and 0x89 for > right justified) I didn't try the values you recommended because I am using a PORTE for my lcd ctrl lines. Is there a reason why you suggested those values... (changing PORTE to analog?) I tried some other values, 0x0E, 0x8E, 0x03, 0x83.. > I also assume that you're switching to the proper banks to read ADRESH and > ADRESL? Yes. > > I've never had a problem using the A/D on the 16F87x series chips. > > --Andrew > It seems to work if I left justify it... it just bothers me cause I usually like to try understand why something is acting the way it is.. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body