Simple question: Driving 1 led from two PICS

Status
Not open for further replies.

2camjohn

Member
I have two pics which need to be able to switch on the same LED.

Obviously if i connect two PIC outputs together then when one is high and the other low we will hit problems.


I think this will work but I thought i'd ask your opinions before I put it together.



Will this work???

Cheers
 

Attachments

  • twinled.jpg
    10.1 KB · Views: 802
Yes, it'll work that way, but there is an even simpler way.

Assuming both pic's are running of the same power supply. If you put the pin high to make the led light, but tri-state it to turn the led off you don't need the diodes.
 
ey



hello..i think just one PIC will do the whole thing that u need. here it is ..makeone pin as output and two as inputs..
RB1 as output 1
RB2 as input1
RB3 as input2
 

Attachments

  • pic_106.gif
    5.4 KB · Views: 696
techknow, I don't think that's what he's talking about.

Why will you have problem if one is high and one is low? You can run the GPIO on the PIC as open drain, right? Just provide power to the LED and turn the pin on open drain, when you want it to light. If both pins are on/on, on/off, or off/off, there's no conflict.

Also assuming you have common ground.
 
DirtyLude said:
Why will you have problem if one is high and one is low? You can run the GPIO on the PIC as open drain, right?

No, usually PIC's have ONE pin which is open drain (usually RA4), none of the others are.
 
like exo said...

you CAN do open-drain with a PIC GPIO pin. but you have to sort of fake it.

set as output low for low, and set as input for high. (high-z state, ie- open collector)

that's what i did for communicating with PS/2 devices.
 
evandude said:
like exo said...

you CAN do open-drain with a PIC GPIO pin. but you have to sort of fake it.

set as output low for low, and set as input for high. (high-z state, ie- open collector)

that's what i did for communicating with PS/2 devices.

But it's NOT open drain, simply an input instead - it's a common technique to use, my I2C tutorials do it! - but it still isn't an open drain output.

For this application it would still work fine, as Exo previously suggested, as long as you ensure that nothing ever goes wrong!.

The original circuit with the two diodes is the safer solution, nothing can go wrong in the software then!.
 
i'm sorry, but why would anyone want to drive a single LED from two pics in the first place.. i mean they are not that expensive..
 
why

As willib says
i'm sorry, but why would anyone want to drive a single LED from two pics in the first place.. i mean they are not that expensive..

i also dont know y 2 PIC's r needed to make an LED on ...
 
In most applications driving led's is not the sole purpose of the design.
It's probably part of a large, complicated design wich was too much for 1 pic to handle, or simpler to accompish using 2 pic's.
 
Exo

In most applications driving led's is not the sole purpose of the design.
It's probably part of a large, complicated design wich was too much for 1 pic to handle, or simpler to accompish using 2 pic's.

oh...So actually i dont understand what u guys wants to make....hehehe.give me an brief explanation..
 
hello 2camjohn i need an brief explanation of what u actually want to make...the circuit is needed too
 
he wants to drive one LED from two PICs... that's exactly what he asked in the first place. maybe we don't know WHY he can't use two LEDs but that's not for us to decide, it's part of HIS design.

i'm sure he's not using two pics because he thinks one PIC can't handle lighting an LED all by itself... :lol:

perhaps it's an activity indicator LED or something? and he wants to share it between the two, rather than having two separate ones?

regardless, the point is that you can do it with the diode method in hardware as initially posted, or via the "fake-pseudo-open-drain" method also posted, in software.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…