I don't use PIC, but obviously it uses a 10 bit ADC (because of 1023). So you must first calculate mVolts per LSB, I suppose 5000 is the reference voltage used. So If the maximum ADC value is 1023 and the reference voltage is 5000mV, then 5000/1023 is the ADC resolution in mV. Multiplying this with the ADC result, you will get the value in mV of the ADC voltage (tlong variable in this sample program). I am not sure though, if this is the right division with 1023. Maybe 1024 is the right value, I am sure that the datasheet clarifies that in the ADC section.