Im trying to use a pic with an analogue input (AN0/1..) to monitor the charge voltage of x2 12v 7Ah batteries in series.
i will be monitoring the battery voltages from 17v (battery low) to 26v (battery full)
i want to use the pic to give me the same linear "bar" type of output as a LM3914 chip.
the output setup for the LED's isn't a problem (i think....

I want to use 10 LED's indicating "low voltage" with x2 red LED's, "Caution" with x3 yellow LED's and "full/ok" with x5 green LED's.
im using the analogue knob in flowcode 5 professional with a 0 to 255 setting (i hope thats right) to simulate my voltage range.
My Problem #1;
How do i work out the value in the 0-255 for that 10v variance?
im trying to keep it simple by linking each LED to a one (1) volt increase/decrease.
My Problem #2;
how do i measure that 17-26v on the analogue pin of the processor without damaging the port/processor?
any help will be greatly appreciated guys.
Regards;
Andrew