Let's Make Robots!

where to place output pin

Hi guys.

i can't really understand why (i know it works, i just want to understand why :) )  you can connect the anode of a led (example) to V+ and the cathode to an output pin. shouldn't the cathode be connected to V- or Gnd?  (example shown on page 4 of the getting started picaxe manual)


oh by the way. in the manual it says this can be done with the darlington. Can it also be done without it?

(i could understand how it works with a transistor: output current goes to base and cathode of led gets connected to Gnd through collecter and emitter)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

If the cathode were connected to V- or Gnd (through a resistor, of course) then the LED would always be on -- there would be a constant 5v across the LED, so current would always flow.

If you were to connect the cathode of the LED to V+ (+5v) along with the anode, then the voltage difference across the pins would be 0v (5v - 5v), so no current would flow, and the LED would always be off.

When a pin is configured as an output, if you set it to HIGH then it goes to 5v, and if you set it to LOW, then it goes to 0v, or Gnd. So when you connect the LED to an output pin, it basically lets you 'switch' the cathode of the LED between 5v and 0v. When you set the pin HIGH, the LED turns off, because both of its pins are connected to 5v, so there's 0v across the LED. When you set the pin LOW, the LED turns on, because now its cathode is connected to 0v.

The i/o pins on the PIC are can source or sink something like 25 mA. That means that when you've configured it as an output and you set it LOW, then up to 25 mA of current can flow out of your circuit, through the pin, to ground. And when you set the pin HIGH, then it can provide up to 25 mA of current to flow through your circuit.


very precise and explanatory answer. thank you!

i've got a problem.

 i'm trying to make a 7-segment digit work.

this is what happens:

- when i connect the common cathode to the ground and the segment pin to V+ everything works nicely (a segment properly lights up)

- when i connect the common cathode to an output pin, and i make it low, and connect the segment pin to an output and make it high the segment doesn't light up :( how come?

 extra informations (i am using 150 ohm resistors for every pin)

maybe the output pins don't provide enough current?

Hmm, that should work, but you don't need to connect the common cathode to an i/o pin. The common cathode can be tied to ground, with each of the seven segments connected to an I/O pin (through a resistor, as you're doing). Try that and see if it makes any difference.


well i can't tie the common cathode to the ground as i have 3 common cathodes (i am trying to interface a three digit counter). i'll try to bypass the resistors connected to the common cathode.

Ok guys, i'm sooooooo dumb. the output pins i was using weren't connected to the chip :D

That may impact your performance.  ;) 

Don't worry, I've done the same thing...