Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

25mA source/sink per I/O

Status
Not open for further replies.

Deagol_the_Dead

New Member
The PIC12C509A has 6 I/O pins with 25mA source/sink per I/O.

I am having trouble understanding the whole "source/sink" deal.

Does "source" mean draw 25mA from the chip (output)?
Does "sink" mean the chip can draw (input) 25mA? :?:

Let's say, at 5V, 25mA, R would need to = 200 Ohms, right?
If R = 50 ohms, the chip would try to output 100mA (and burn up?)?
If R = 250 ohms, the chip would only output 20mA?

Sorry if this sounds trivial, but for some reason I am having a hard time getting it! :cry:

Thanks!
 

evandude

New Member
source means to supply current from Vdd
sink means to send current to ground

basically, when a pin is HIGH, it can only supply that much current at 5v (or whatever the high level voltage is)
similarly, when the pin is LOW, it can only accept that much current flowing to ground.

the chip won't burn up in your example... it can only source/sink that much current, you don't need to go limiting anything... it's not going to source or sink more than that, unless maybe you do something nasty to it, like connect a really high voltage or some strange load to it.

think of it like this if it helps: when the pin is held HIGH, it's like that pin is internally connected through a resistor to Vdd... or if it's held LOW, it's like it's connected through a resistor to ground...

both source and sink refer to OUTPUT. when a pin is configured as an INPUT, it appears as a very high impedance, and so only a very minimal amount of current will be allowed to flow into or out of it.
 

ivancho

New Member
I believe you can damage the pin if you try to pull too much current out of it.... like lets say you connect a motor to be driven by a PIC's pin.

You also have to check that a port as a whole also has a maximum allow sink/source current. I think is somewhere in the 100mA value.

If you have a whole bunch of signals going out you should have a good idea of what current those signals pull. Say if you connect two PICs together, the one recieving will have a high impedance therefore consuming very little current, which is supplied by the PIN so no resistor needed, but if you have something else you should limit the current flow to make sure and keep it safe.

Ivancho
 

Deagol_the_Dead

New Member
Ok, to use Ivancho's example, theoretically, if I had a 3V motor, that only drew 25mA it should be OK, BUT if I had a 3V motor that drew 1 Amp, then we would hurt the PIC?

I am trying to figure out what would be the best way to calculate suitable loads for PIC outputs.

Thanks!
 

Exo

Active Member
evandude said:
the chip won't burn up in your example... it can only source/sink that much current, you don't need to go limiting anything... it's not going to source or sink more than that, unless maybe you do something nasty to it, like connect a really high voltage or some strange load to it.

You CAN damage the chip. The chip does not limit the current at 25mA. Its the maximum it can give without beeing damaged. if you try to sink/source more it will be damaged.
 

Exo

Active Member
Deagol_the_Dead said:
Ok, to use Ivancho's example, theoretically, if I had a 3V motor, that only drew 25mA it should be OK, BUT if I had a 3V motor that drew 1 Amp, then we would hurt the PIC?

I am trying to figure out what would be the best way to calculate suitable loads for PIC outputs.

Thanks!

indeed, a motor that draws 1Amp would certainly damage the pic. The pic is a controller device, its meant to be the brains of a circuit, not the brawn.
If you want the pic to drive bigger loads you will have to add extra power circuitry. Like a transisor driving a relay or a FET. The relay or FET can then drive much bigger loads.
 

Deagol_the_Dead

New Member
So, is this correct :?:

At 5V, to "source" 25mA R would need to = 200 Ohms.

If R = 50 Ohms, mA = 100
If R = 130 Ohms, mA = 38

Am I calculating this correctly for a resistive load (I = E/R) :?:

If there is no immediate affect of trying to draw 38mA from the PIC pin, what would the long term affects be :?:

Thanks!
 

ivancho

New Member
Since PIC is a control device you have to see what devices you are controlling to see if you need an extra control circuit that handles greater currents.

:idea: Lets set a simple example. Say you want to control a motor. Motor are dumb devices, if you stall them (so that they can't rotate) the motor will keep on trying to rotate by increasing the current it consumes. You can see this by checking a small motor current while running and then stopping it with your fingers. So if you were to find a motor that consume 25mA you could in theory run it from the PIC......but because of the spikes and what not, the motor would damage the PIC. :evil:

:idea: Now you still want to control that motor. So you use a L293 H-Bridge driver. As you can see from this datasheet the inputs of the L293 will consume 100uA (very little current).... so here you would not need to limit the current because there is enough and you know what you are driving will not use that much current.

:arrow: Now imagine you want to turn on an LED to see the signal going to the L293. LED by nature need a limiting resistance. But if you were to connect those high intensity LED that consume upto 40mA then what? Well then you will have to live with a dimmed LED and use a resistor to limit the current off the PIC. Say your LED has a Vf=1.2V then your resistor will need to dop the 3.8V at a current of 20mA (not to drive the PIC at its MAX) You would need a 190 resistance. (all this numbers are made up :wink: )

So as you can see it really depends on the device you are connecting. Some times a 1K resistor is used to prevent too much draw, but you need to know what it is you are driving to limit ( if you can) the current, to put a power circuit driver (like the L293) or to just connect it straight.

Hope it helps some,

Ivancho
 

Exo

Active Member
Deagol_the_Dead said:
So, is this correct :?:

At 5V, to "source" 25mA R would need to = 200 Ohms.

If R = 50 Ohms, mA = 100
If R = 130 Ohms, mA = 38

Am I calculating this correctly for a resistive load (I = E/R) :?:

If there is no immediate affect of trying to draw 38mA from the PIC pin, what would the long term affects be :?:

Thanks!

You should never try to get more from the pic then the 20-25mA stated. If you need more, buffer it... simple as that
 

Deagol_the_Dead

New Member
Exo said:
You should never try to get more from the pic then the 20-25mA stated. If you need more, buffer it... simple as that

That is why I posted:

Deagol_the_Dead said:
I am trying to figure out what would be the best way to calculate suitable loads for PIC outputs.

Anyone know how? Is it just Ohms law like I stated earlier?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Deagol_the_Dead said:
Anyone know how? Is it just Ohms law like I stated earlier?

Yes, it's just ohms law. But as already mentioned I would also advise buffering anything approaching a substantial load - don't run it near the limits. PIC's also have a total maximum source/sink limit as well, so you can't usually run all the I/O pins at 25mA.
 

Deagol_the_Dead

New Member
Thanks so much!

Woo Hoo! That was the answer I was waiting for. :D

Thanks to everyone, you have helped me out a lot! I am so glad to find a BBS for PIC's that has such knowledgeable members!
 

Deagol_the_Dead

New Member
Thanks again to all. Sorry if I wasn't too clear on asking my questions, I'll try harder next time.

Thanks again! Like I said, you helped me tremendously!
:D :D :D
 
Status
Not open for further replies.

Latest threads

Top