>> It's for a hand held equipment and I want to be able to show how >> much battery "is left" on a LCD display... any ideas? >> >How accurate do you need it? I was thinking of doing a battery-low >indicator by using a couple of resistors in series, one end going into an >IO pin the other other to ground. Then use another IO pin in the middle of >the resistors and you can see when the voltage is low enough to cause a 0 >on that pin. The resistor pair is fed from the first IO pin so you can >turn it off to conserve power. > >Obviously it would need a bit of tweaking to get the resistor values >right, but I'm sure you can add a few more resistors to it to have a >'medium' and 'full' level (at the expense of a couple more IO pins). > >Good luck with it, A good way to do this is to attach a stable reference to the Vref+ pin of the PIC, and use this as the reference voltage when doing any other analogue measurements, (with caveats about the linear input voltage needing to be less than the Vref voltage), but when you want to measure the battery voltage, convert to using Vcc as the reference, and measure the Vref voltage. Now this will give you an inverse function, I.e. as the battery voltage falls the voltage you will measure will rise. When the "voltage" you measure gets above a certain value (you should be able to precalculate this) then the battery is below its end voltage. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body