Put an extra R to ground, so your Vin never hits "0". It doesn't take much, and it does limit your range a bit, but it allows you to detect when the input is there.
Put an extra R to ground, so your Vin never hits "0". It doesn't take much, and it does limit your range a bit, but it allows you to detect when the input is there.
If your source is a low impedance, which it probably is -
and if you place a small capacitor (.1uF or so) connected to the
input of the voltage divider, turn your A/D input into a digital output.
Drive it high for several milliseconds (depends or your resistor and
cap values). It is safe to do this because your PIC pin is "protected"
by the voltage divider impedance.
Then turn the pin back into an analog input and read it immediately. If you have a voltage, the input was floating
(the capacitor still has some charge left). If the voltage is zero, the source is connected
and is at zero volts.
By doing some calculations, you can figure out the timing for your application.
Charles Linquist
add resister from +5V to top voltage divider R that is X10 to X100 the R-divider values to give 2,3 or say 5 point A/D reading with floating (no sensed voltage connected). The low current should not affect the sensed voltage reading. Could add a diode from +5 pointing to the new resister to stop any current from the 13V backing up to the 5V.
don
amgen
Bookmarks