3
\$\begingroup\$

I am going to blink with LED from MCU I/O port. Where do I need to connect LED: VCC ot GND? I think it might be a difference whether the current goes into the inside MCU (when the port is low level and LED is connected to the VCC) or the current goes out from the MCU's port (when the port pin is high and the LED is pulled down to the GND). Is one of them better than another or they are equal and why?

\$\endgroup\$
1
  • 3
    \$\begingroup\$ Usually older designs of push-pull output drivers are more powerful when they sink (pull) current. Modern CMOS based MCU output drivers are usually symmetrical enough that the current sink/source capabilities are equal. \$\endgroup\$
    – KyranF
    Aug 20, 2015 at 16:49

1 Answer 1

7
\$\begingroup\$

You should check the spec of the IO port.

If your circuit is like [Vcc --> LED --> resistor --> IO port] the port must be able to sink the current required for your LED.

If your circuit is [IO port --> LED --> resistor --> GND] then your port needs to be able to source the current required for the LED.

One isn't inherently better than the other. It depends on your design constraints. If Vcc is a much higher voltage than your IO port can reach than the first option won't work (could never shut off the LED). If they both are 3.3V then it shouldn't matter, but check the specs.

\$\endgroup\$
1
  • \$\begingroup\$ And if your device can do either I usually stick to active high just to that it is more intuitive. \$\endgroup\$ Aug 20, 2015 at 23:38

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