Continue to Site

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.

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

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


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
    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.
 
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..
 
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top