You CAN offset the range the PIC A/D by increasing Vref-, however, you must remain a minimum value for (Vref+) - (Vref-) to get full accuracy from the converter. The correct transfer function is indeed 0...1023 = (Vin - Vref-) / (Vref+ - Vref-) . It is a good idea to make sure that both Vref- and Vref+ are well decoupled and 'clean'. Bob Ammerman RAm Systems ----- Original Message ----- From: "Dave Dilatush" To: Sent: Wednesday, January 23, 2002 3:16 AM Subject: Re: [PIC]: Better to offset & scale analog input or set Vref +/-? Rick Mann wrote... >I'm using a PIC 16F877 to sense temperature using an LM335. Since the output >voltage range of the sensor is about 0.5 V, somewhere between 2 & 3 V, I >need to either a) offset and scale the sensor's output, or b) set >appropriate Vref+ and Vref- voltages, probably using two (different) zener >voltage refs. I prefer the latter option, if it can work, because it seems >to use cheaper parts. You'd be much better off using a large Vref (such as a well-regulated 5V supply) and offsetting/scaling the sensor's output with an opamp so that the temperature range of interest produces a 0 - 5 volt output. This will minimize conversion noise and other errors. The PIC A/D converter doesn't do well with small reference voltages. Also, unless I'm mistaken, I don't think you can offset the PICs analog input range by using an elevated Vref- voltage (the Vref- pin is there so it can be connected to a "quiet" analog ground, as I understand it). In other words, I believe the PIC A/D converter's transfer function is 0...1023 = Vin / (Vref+ - Vref-) , not 0...1023 = (Vin - Vref-) / (Vref+ - Vref-) . In any case, zener diodes are really crappy references; they're inaccurate and they drift with temperature. >I'd like people's feedback on the two methods, and why one might be better >than another. > >And, if you don't mind, can you CC me on the reply, as I don't get the >digest but once per day. Done. Hope this helps... Dave Dilatush -- 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 -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.