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.
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
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.
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.
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.
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.