If your maximum voltage is 25.15v, then chose Resistors to give you as close to 5v as possible at your ADC. Right now you're only using 2/3rds of your ADCs scale and limiting your final result accuracy.
Simple maths from then on (forget the actual voltage across the Resistor)...
If say a 10-bit ADC reading of 1010 is equal to 25.15v (your maximum) at your potential divider input, then...
1010*0.0249 will give you 25.149...
So let's scale everything up for Integer math...
MyADCWORD is a variable of your ADC reading
MyVoltageWORD is a variable containing the voltage to be displayed
TempWORD is just a variable
TempWORD=MyADCWORD*249
MyVoltageWORD=DIV32 10
This above code snippet will give you a result of 25149 which you can then use the DIG command to display upto five significant figures ie 25.149 or if you used DIV32 100 you would have four significant figures ie 25.14.
To work out the constant (in our above case 249) simply take...
Constant=Input Voltage/ADC Reading
...and just scale everything up accordingly so there are NO DECIMAL PLACES. Ignore the fact we are going to spill out of a WORD variable when we do our multiplication, DIV32 will take care of the final result. Use DIV32 to scale us back so the final Results fits in a WORD variable to the maximum number of significant places you need.
Finally, remember that DIV32 doesn't like interrupts as they may corrupt the result. So if your are using interrupts, the two lines of code that first multiply and then use DIV32 must be enclosed within an DISABLE/ENABLE pair. If you are not using interrupts, then you needent bother with this.
Bookmarks