connecting open collector/drain outputs together

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I was just after some clarification with the following.

I've got 2 outputs going to 1 TTL input. If either output goes low the TTL input should go low (so its an OR operation in relation to going low, a AND relation in relation to being high).

1 output is from a ATmega, the other is from a comparitor with a open collector output. I think I can connect them directly as in the picture as it will be a wired OR, is that right?

I'm just not sure if say 1 output goes low will it sink alot of current from the other output and damage it?

Thanks for your help

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, that's the whole point of "open collector" and "open drain." No device can source current, they can only sink current. The resistor sources all the current. It will only source what the supply and resistance value permit. In your case I = E/R = 5/10k = 0.5 mA. Presumably either device can handle that without harm.

To be logically correct, a wired-or is truly an AND circuit (positive logic) or an OR circuit in negative logic. Either input can assert true (negative logic = low) so in fact a wired-or is actually a negative logic wired-or.

Just ensure that neither input has active high driving capability, or it won't work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You will need to add an NPN transistor between the ATmega output and the TTL input as, the ATmega output can both, sink & source current.

That means that, the way you have the node configured, when the ATmega output goes to a logic high, and the comparator goes to an active logic low condition, the two outputs will be in contention with each other.

At that point, which ever output is capable of supplying the lowest impedance to the power supply rail, that output will be dominant. In all reality, the voltage at the node of those outputs will probably be in some voltage area that is outside of the legal logic low or logic high specification (0.8V < Vin < 3.0V) of the TTL input specification.

Worse case will be that, you will let the smoke out of one of the output devices.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Carl: There's a little trick on overrriding the need of a extra transistor: Instead of

PORTC = _BV(1);//go high
PORTC = 0;//go low

Yuo do

DDRC = 0;//disable the output, go into high impedance mode and stay that way. this will ensure the pullup is not tampered with

PORTC = 0;//set the output value to 0
DDRC = _BV(1);//set the one pin we want to go down to output. 

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the quick responses. I think I'll go the transistor option just to be on the safe side.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I think I'll go the transistor option just to be on the safe side.
True, it's safe. But Daqq's suggestion is safe as well. Just stick to the DDRC in your program. And don't touch PortD.

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

daqq wrote:
Carl: There's a little trick on overrriding the need of a extra transistor...

Yes, I have used this scheme before, as well. But, I don't like suggesting this because, while I am arare of the potiential issues, the OP may not be.

Effectively, while technically not exactly a "Tri-State" condition, programming the I/O pin as an input yealds the sam results.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

microcarl wrote:
Effectively, while technically not exactly a "Tri-State" condition, programming the I/O pin as an input yealds the sam results.

My answer above assumed (from the thread title) the OP had in fact programmed his microcontroller to have an open drain or open collector option for the pin.

The suggestion to switch the pin between output mode and input mode is a very effective trick to emulate open output circuits in a device without that feature. :)

IMO it's always better to fix things in firmware rather than adding additional circuitry. That's what makes firmware solutions so amazing!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are a lot of things that work with simulated open-collector output.. I've done numerous software I2C implementations with it, as well as talked to a PS/2 keyboards.

It is almost shame that an USART TX pin must be a push-pull output, it would be so handy to make it open-collector too.

- Jani

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i must admit it would be better to have fewer components.