> -----Original Message----- > From: Nick Veys [SMTP:nick@VEYS.COM] > Sent: Saturday, November 02, 2002 10:40 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: 16F870 ADC inaccuracy > > Had this problem a while ago and just didn't care because the > application wasn't too important, but I'm coming up on a project in > which temperature measurements will need to be within a few degrees... > > For this test, I am using an LM35 (Centigrade temp sensor, 10mV/C > output), and a 16F870's 10bit ADC, and spitting the value out onto an > LCD. > > I consistantly get around 10C (8-10 in the range I can test) less than > the actual output (by probing). > > Say, for instance if I probe and get .334mV, that is 33.4C, but my > output is around 22C. That's just not right. > > I'm wondering if the built-in ADC's are just simply horrible? Or am I > doing something wrong? > The internal ADC's are not particularly horrible and work very well if you follow the datasheets instructions to the letter. The most common mistake that people make is not allowing enough time for the acquisition phase, which will give you an offset. After selecting the channel you wish to convert, you must wait for all the internal caps to charge (the succesive aproximation ADC is based on a series of capacitors rather than the more common resistor ladder). The time you need to wait depends on several factors including you source impedance and temperature, and the datasheet shows to to claculate this. In practice, a 15 - 20us delay will be suitable for low impedance sources. Regards Mike -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics