Sinking power

01 May 2011

Hello All,

May sound like a stupid question but... How do you sink power on a pin? I want to light an LED by providing a circuit to ground. Is it as simple as declaring the pin a digitalOut and setting it to 0?

And if this is the case, how do you ensure the circuit is Not "grounded" when the device starts up? I want to be sure the LED is lit only when I tell it to in code... It cannot be grounded while the device starts up...

Also, what is the maximum curent that can be sunk on a pin? In case I wanted to close a small contact coil or something other then an LED... Can you sink 100ma ?

Thanks in advance.

Tim

01 May 2011

After reset I/O pins are normally set to input, hence from the outside they are high-impedance and resemble an open circuit. The setting of the mode to output would typically take place in the consructor of the DigitalOut object. With a static object this is quite soon after reset.

01 May 2011

Great Link Cristian. Thanks! The load is on a 14V circuit so I'm limited to a low side transitor switch. It's just that I wanted to use a PNP switch instead of a NPN for reasons I'll not get into here... 4ma is not a lot to play with.

Ad, I'm going to have to read what you wrote a few times over. I need it dumbed down a bit for me to understand. I think what you are saying is that when the device starts the pins are in a "high-impedance" state which would resemble an open circuit. But that in the declarations of the program the pin would be set as a digalOut and it would then immediatly produce a circuit to ground until its output was set = 1;

Thanks for the info guys. I really appreciate the help...

Tim

01 May 2011

That's right