So basically you can hook the pic pin to 12vdc as long as the current is limited to below the max input current on the data sheet (20ma). Then you are relying on the clamping circuit in the pic to take care of any voltage above vdd , right? Pretty simple, I like it.
Is this good practice? What if the input was for a 24vdc system instead of 12vdc? Use a 48K resistor?
what would be the absolute max voltage input? Or does in not matter as long as the current is controlled?
I'm using a 16f887 pic and it looks like the Port E 0, 1 & 2 inputs are indeed diode clamped to vdd.
If the switch is pressed the PIC should see 12VDC @ ~500uA. If, for whatever reason, someone connects the switch to 15vdc then the pic would see ~700uA, Correct? This is well under the 20ma max current for the inputs.
And lastly, if I were designing this to accept inputs ranging from 5vdc to 24vdc then I assume a more advanced circuit would be required to handle the variation? Maybe the voltage divider with a 5.1 zener diode
Thanks for your time and details...this is really helping me get some old brain cells wrapped back around electronics.