You should be able to do it with three Resistors and two additional PIC pins...
R1 connects between Vdd and VRef+.
R2 connects between VRef+ and Digital PICpinX.
R3 connects between VRef+ and Digital PICpinY.
For additional stability, I would connect a 100nF Capacitor between VRef+ and 0v.
Vref- connects to 0v.
PICpinX and PICpinY are any available PIC pins that you have spare, that have full I/O capability and when in INPUT mode DO NOT have an internal Weak Pull-Up enabled.
When requiring 5v on Vref+, set PICpinX and PICpinY to INPUT. A Vref+ of 5v is provided via R1. R2 and R3 are effectively not in circuit.
When requiring 3.3v on Vref+, set PICpinX to OUTPUT LOW and PICpinY to INPUT. Vref+ is the product of Resistor divider chain R1 and R2. R3 is effectively not in circuit.
When requiring 3.0v on Vref, set PICpinX to INPUT and PICpinY to OUTPUT LOW. Vref+ is the product of Resistor divider chain R1 and R3. R2 is effectively not in circuit.
Resistors should be 1% or better. For absolute precision, make R2 and R3 hi-stab multi-turn pots and calibrate for 3.3v and 3.0v with their respecive PICpinX or PICpinY pulled OUTPUT LOW.
In software, remember when switching between different VRef's, allow a short settling time before performing a new ADC measurement.
Simple... cheap...
Bookmarks