I'm trying to calculate the value of a resistor to protect a digital input on a microcontroller (10Ω and 1kΩ in the image below):

Protection circuit for digital input on microcontroller

The microcontroller datasheet (PIC16F1718 Datasheet) doesn't specify an input resistance (shown as 20 MΩ in the drawing,) so I'm unable to determine how high a resistor value I can use without interfering with logic levels.

The datasheet does list the max "Input leakage current." I understand that to be the current into the input pin when the input voltage is at maximum. Is that correct?

Since I know the input leakage current and the max input voltage, can I use Ohm's law to then calculate the DC resistance of the input pin? When I do the calculation I get 5MΩ which seems reasonable.

Source for circuit diagram

  • 1
    \$\begingroup\$ I had to +1 this, as it is a nicely formed question that can be answered (Spehro, QED.) \$\endgroup\$ – jonk May 17 at 19:10

You can't really calculate a resistance, but using the current directly is a valid approach. Assume maximum current is flowing in or out of the pin (typically you'd be worried about the current flowing out of the pin when the input is low and into the pin when the input is high) and ensure there is adequate noise margin remaining under those conditions.

The datasheet you linked shows a maximum current of +/-125nA at 85°C.

Keep in mind that the current will typically increase rapidly if the die temperature is higher than 85°C, so a limit of 125nA at 85°C might be more like 1uA at 125°C.

  • \$\begingroup\$ Oh nice, so would I use the maximum input current to calculate the max voltage drop across the input resistor? \$\endgroup\$ – Luminaire May 17 at 17:46
  • 2
    \$\begingroup\$ Across whatever the source impedance is. It might be a lot lower than the input resistor. \$\endgroup\$ – Spehro Pefhany May 17 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.