What is the max detecting voltage for a pic16f819? i wish to detect up to 12v dc, and im guessing it pic wont like that, any ideas on how the get around this problem.
Its a trick caled a voltage divider.You only need 2 resistors.They are in serial and in the midle the PIC is conected and one resistor is puling down to ground and one pulling up to the voltage you want to meshure.
For exsample 1K to ground and 10 K to the voltage to detect ouputs an 10th of the output voltage so then 12V gets out as 1,2V
Not exactly. It will give its max code- 1023- for anything above Vdd or the Vref. Electrically the pin cannot take anything more than 0.3v above Vdd. This will forward bias an internal protection diode and this means the power gets connected to the Vdd rail. If you are using a 4.5v Vdd then 4.8v is the max allowable voltage.
A voltage divider is commonly used to lower the voltage so you can measure 12v for example. You need to make sure the resistance of the divider meets the 2.5k recommended input impedance for a PIC ADC.