for the I2C slave routine, you could start with those on the melabs website
http://www.melabs.com/resources/samples.htm
I2Cmast.bas
I2Cslave.bas

for the voltage reference... for ADC or analog comparator?