Ok, so you've decided on 0.1V resolution. Set the A-D ref volt to 5V and construct a voltage divider on the A-D input with a mid-point voltage of 5V when 25.5V is applied at the top-end e.g 15k fixed resistor at the top, 10k multi-turn pot at the bottom and take the output off the wiper. (you can refine this but just as an example)
I believe the PIC has a 10-bit A-D converter so RRF the result to give an 8-bit result. You now have a 0-25.5V voltmeter with a 0.1V resolution and a direct relationship between the value returned by the A-D and the input voltage i.e. 125 = 12.5V, 147 = 14.7V ....
Bookmarks