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.
Bookmarks