# ADC injection current and supply voltage

I'm using a PIC18F MCU.

I am using an ADC reference of 3.3 V. If I want to measure 4 V, what would happen? Would the internal ADC peripheral get damaged or will the ADC work fine, and show the maximum value?

It is mentioned one should not apply more than 300 mV outside the supply rails. If the ADC input got more than the supply rail, then what would the PIC controller behavior be?

Also, the clamp current is mentioned as 20 mA which must be distributed across all the I/O pins. What if I provide a clamping current of 20 mA to each pin? The internal diodes would get stressed and lead to failure? I assume the internal pins have only diodes and not resistors. I couldn't find any info on the internal clamping diodes and resistors in the datasheet.

• What kind of answer do you expect? Why do you want to operate the MCU outside its specification? Feb 28, 2023 at 7:09
• @thebusybee, I am just curious to understand what would happen in those cases? I do not want to operate in those conditions. Just understanding what would be the effects.
– user220456
Feb 28, 2023 at 7:12

I am using an ADC reference of 3.3 V. If I want to measure 4 V, what would happen? Would the internal ADC peripheral get damaged or will the ADC work fine, and show the maximum value?

You need to check the Electrical Specifications in chapter 39:

Source: PIC18F26/45/46Q10 Datasheet

So it all depends what VDD is in your case. It could be anywhere between 1.8..5.5 V (Table 39-1) under operating conditions.

So if VDD is below 3.7 V you might damage your device. I would also treat any VDD below 4.0 V as if it were below the absolute max value, because it's a grey area.

And if it's at 4.0 V or above the ADC value would simply clip at the max value.

As @MattS commented, you always have to meet the specifications of -0.3 V to (VDD + 0.3 V). So if your device is unpowered (i.e. VDD = 0 V), VPIN mustn't exceed +0.3 V.

Another input by @TimWilliams:

One more note -- in the process of injecting current, the pin voltage may rise above VDD+0.3V. The current and voltage limits shall be understood inclusively, i.e. voltages higher than this are acceptable (again, for survival purposes) if the current limits are respected.

Here is a discussion on the Microchip forums that supports this assertion: PIC16LF18324 ADC input higher than Vref+

Also, the clamp current is mentioned as 20 mA which must be distributed across all the I/O pins. What if I provide a clamping current of 20 mA to each pin? The internal diodes would get stressed and lead to failure? I assume the internal pins have only diodes and not resistors. I couldn't find any info on the internal clamping diodes and resistors in the datasheet.

You find this answer also in the same table in chapter 39.1 Absolute Maximum Ratings:

If you apply a clamp current of ±20 mA to each pin, you'll definitely fry your MCU. You must also meet the specifications for maximum current and total power dissipation, which you'll exceed.

This question may also add some further insights: What is meant by Input clamp current/Output Clamp current in micro controller datasheet?

• Thank you for your answer. So, If I apply 4V at the ADC input when the ADC reference is 3.3V, I won't be damaging the chip? The value will be the maximum value only?
– user220456
Feb 28, 2023 at 7:45
• Yes, as long as VDD is 4V or above. Otherwise the datasheet would be inaccurate. Feb 28, 2023 at 7:47
• "So it all depends what VDD is in your case. It could be anywhere between 1.8..5.5 V." Minor quibble: VDD can also be 0 V when your power is off. Applying a voltage that is in-range when the chip is powered may have unpredictable effects if you apply it when the chip is off. Feb 28, 2023 at 9:23
• @MattS Good point, I didn't think about the obvious, I'll update my answer. Feb 28, 2023 at 9:25
• One more note -- in the process of injecting current, the pin voltage may rise above VDD+0.3V. The current and voltage limits shall be understood inclusively, i.e. voltages higher than this are acceptable (again, for survival purposes) if the current limits are respected. Feb 28, 2023 at 9:28

Regarding the effect:

Analog pins are generally sensitive to injected current. Whether that's true of the PIC18 family and ADC, who knows. It's not clear from the datasheet whether this is the case. Many other devices suggest zero injection while analog functions are in use on respective pins / IO banks.

Simply, the most likely result is ADC readings out of tolerance. Maybe it'll still read 0x03ff anyway, maybe it'll be marginal (erroneous at min clock, max. temp., etc.), maybe it reads zeroes or gibberish.

It's not likely to cause CMOS latchup if the current limit is respected in the process, but supplying a hard-fixed (excess) voltage to a pin is likely to cause much more current flow. Typically ~100mA is required to induce latchup.

See: Quality Handbook - Microchip It appears they rate their products to 200mA, even; though the exact nature of those tests isn't given and you'd have to find the underlying standard to see.