# Why the output voltage of dsPIC IO ports is not constant?

I expect output voltage of dsPIC pin should be 3.3V, and this seems to be true when the output pin is connected to high resistance.

However, when I connect to low resistance, the voltage of output pin is pulled low.(The image below shows the voltage is 2.75V).

I suspect it is caused by the circuit in the microchip, but I don't know how to analyze it.

BTW, here's the datasheet of this chip.

The output pins of a micro can only supply so much current. If you try to draw more current then they can provide, the voltage will drop (as you are experiencing).

Here is the documentation for the microprocessor you are using:
Datasheet page 231, Section 24.0 - "Absolute Maximum Ratings"

As you can see, the datasheet only rates the IO lines to supply an absolute maximum of 4 mA each (and you should derate the them as well. Use 2-3 mA as a safe limit). As such, you're actually exceeding the MCUs rated current by an order of magnitude! ($\frac{V}{R}=I, \frac{3.3V}{100Ω}=33 mA$). I don't know how the simulator you are using handles this sort of abuse, but with the real micro, you could very well damage the output buffer of the IC.

To some extent, you can think of the output of each IO pin as being a perfect output driver in series with a resistor (really, it's more complicated - there is also inductance, capacitance, and some fun non-linearities, but we'll ignore those for now). As such, even if you are not exceeding the absolute maximum ratings, there will be some voltage sag as you load the IO pin.

From the datasheet referring to the (1) next to the "Absolute Maximum Ratings" line:

Note 1: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only, and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for extended periods may affect device reliability.

• Conner, please please don't use the AMR section of the datasheet!! Those figures are NOT ratings for normal operation (as your quote states), so saying "the datasheet only rates the IO lines to supply up to 4 mA each" on the basis of the AMR is WRONG. – Wouter van Ooijen May 31 '13 at 7:57
• Typical output current is 2mA. (As Wouter could have seen if he had been feeling helpful). However, since the data sheet doesn't quote a maximum other than the absolute maximum, AMR was the correct value to reference in this answer. – david May 31 '13 at 9:02
• @WoutervanOoijen - I included the section of the datasheet that describes how operating the device at the AMR, as well as above it, can be a bad idea. Exposure to maximum rating conditions for extended periods may affect device reliability. – Connor Wolf May 31 '13 at 9:13
• @Connor - but you use the AMR snippet to justify your claim that "the datasheet only rates the IO lines to supply up to 4 mA each". That is misleading, the AMR section states that 4mA is outside the normal operating conditions (and says nothing about which range of current is inside, for that you need the Normal Operating Conditions). – Wouter van Ooijen May 31 '13 at 11:21
• The a common mistake I've seen is exceeding the current/sourced for all pins/ports ... that's the following 2 lines after the highlighted ones. – Spoon May 31 '13 at 11:23

A more general approach to a problem of this kind is to think of the output pin in terms of a 'black box'. The contents of the box is reduced to a voltage source and internal series resistor. (This is known as the Thevenin equivalent circuit). The cell is not a 'real' cell or battery, it merely represents the voltage supplied by the circuit for calculation purposes.

When there is no load (open circuit) the output voltage will be equal to the internal cell voltage.

If you short circuit the output then the output voltage would be 0V and the current = internal voltage / internal resistance.

Any external resistance (load) between open circuit and short circuit that you place on the output will lower the output voltage.

• The output pin has only one line, I don't understand how to model it as black box with two lines. Can you explain that? Thank you~ – Po-Jen Lai Jun 3 '13 at 11:45
• @Ricky - The chip has a connection to ground (0V) so the voltage of the pin is measured relative to ground. The external circuit (load) is connected from the pin to ground (return). The top connection will be the pin, the bottom connection of the black box is simply the ground. – JIm Dearden Jun 3 '13 at 15:12