Quite new to programming but I think I've detected an error in this interesting thread.

http://forum.allaboutcircuits.com/showthread.php?t=80018

Isn't itUnderstanding ratios and ratio math!

Putting it all together.

To get a reading of 0.00v to 5.00v from the PIC ADC can be done using the correct data scaling of all samples, and properly compensated integer rounding on all samples, by the following integer math;

((ADC*2)+1) *500 +1024 /2048

Using *x of *500 means we are converting 1024 ADC units to 500 output units (which represent 0-500 ie 0.00v to 5.00v).

**(((ADC*2)+1) *500 +1024 )/2048**

instead of

**((ADC*2)+1) *500 +1024 /2048**