You can solve the variable 12V problem by generating Vref from a voltage divider off the 12V. If you do it this way, then the A/Ds will track. A good start would be 12V in to a 2K resistor, the other end of the 2K to Vref and that junction through a 1K resistor to GND. Put a 10uF capacitor across the 1K for a noise filter, and a diode across the 2K (cathode to the +12V end). This diode will prevent the cap from discharging into the PIC Vref pin under fault conditions. The values given will put 4V (nom) on Vref.

Once you have calibrated your unit, save your critical variables in the chip's EEPROM. Every time you power up, read those variables and have your program act accordingly.