To make this more portable could we do the following?
Code:
DEFINE ADC_BITS 10
ADvalue  VAR WORD
VDD      VAR WORD


;----[Get VDD by reading the FVR]-----------------------------------------------
VDD_Nom	 CON 500	     ; Nominal Value of VDD*100. 500 for 5V, 300 for 3V
VDD_Res  CON 10              ; A/D resolution (bits) used for VDD measurement
FVrefMV  CON 1024            ; Fixed Vref Voltage in mV  ( must match FVRCON )
Vref_AD5 CON EXT             ; Calculate FVref A/D reading when VDD = VDD_Nom
@Vref_AD5 = (_FVrefMV*100000) / (VDD_Nom*1000000/(1023 << (_VDD_Res-10)))

GetVDD:
    ADCON1 = %10110000       ; A/D Right Justified, FRC clock
    FVRCON = %10000001       ; Enable Fixed Voltage Reference (1.024V)
    WHILE !FVRCON.6 : WEND   ; Wait for fixed ref to be stable
    ADCIN 31, ADvalue        ; Read the FVR channel
    FVRCON = 0               ; Disable Fixed Voltage Reference
    VDD = Vref_AD5           ; calculated Vref A/D at VDD_Nom
    VDD = VDD * VDD_Nom      ; * Vdd_nom gives two decimal places
    VDD = DIV32 ADvalue      ;   / FVRef reading - converts to VDD volts
RETURN