Comparator open collector output

Discussion in 'General Electronics Chat' started by strantor, May 1, 2012.

  1. strantor

    strantor Thread Starter Well-Known Member

    Joined:
    Oct 3, 2010
    Messages:
    3,651
    Location:
    Houston tx
    I'm doing a circuit, I was helped by wayneh to figure it out. It works in SIM, but I don't understand how or why. I have 2 comparators configured in a OR, according to LM393 datasheet.
    [​IMG]
    Now, this confuses me. I understand that *what supposedly happens* is that if either comparator goes high, the output goes high. The way I see it though, these comparator outputs are open collector, so with the pullup resistor, the output should be high if both comparators are low. If one of them goes high, it will sink the current and the output will go low. I know I'm wrong, but I have no clue why I'm wrong. can someone set me straight?

    What confuses me further is that this actually functions as an AND gate in my sim. When both of my comparators are high, the output is high. When I send one of my comparators low, the output is low. WTH?

    Attached Files:

  2. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    Messages:
    9,411
    Location:
    Ontario, Canada
    When both outputs are high then they are turned off and the pullup resistor provides a high.
    When one output is high then it is turned off and does nothing. Then if the other output goes low it makes the output low. Why do you think the output will be high?

    The two comparators together form an AND gate. The output is high only when both output are high.
  3. MrChips

    MrChips Moderator Staff Member

    Joined:
    Oct 2, 2009
    Messages:
    10,131
    This is also called a WIRED-OR circuit.
    This may sound confusing. That is because party-line bus systems are implemented using NEGATIVE LOGIC.

    Consider an INTERRUPT line on an MCU. This is usually implemented as IRQ'
    (IRQ inverted). (I would normally show this as IRQ overstrike, but don't see how to do this).

    This means that IRQ' line has to go LOW to request an interrupt.
    You can put multiple devices on the IRQ' line such as two or more comparators as in your example.

    Any one of the comparators can pull the IRQ' line LOW to trigger an interrupt.
    Hence it is an OR function for NEGATIVE LOGIC signals.

    (If you look at DeMorgan's equivalent circuits, an OR gate with negated inputs and output is equivalent to an AND gate.)
  4. Bernard

    Bernard Senior Member

    Joined:
    Aug 7, 2008
    Messages:
    3,325
    Location:
    Tucson AZ USA
    Comparators can be configured as inverting or non inverting, so with inverting the ckt is a NOR gate, with non inverting ckt is a AND gate.
  5. crutschow

    crutschow AAC Fanatic!

    Joined:
    Mar 14, 2008
    Messages:
    7,148
    Location:
    L.A. USA
    You are just confused about the definition. When the output of the comparator is "high" (plus input voltage higher than the negative input voltage), the output transistor is off, not on, and thus the output voltages goes to a high voltage from the pullup resistor.
    strantor likes this.
  6. strantor

    strantor Thread Starter Well-Known Member

    Joined:
    Oct 3, 2010
    Messages:
    3,651
    Location:
    Houston tx
    ok that makes sense, and that's what I observe. When it's high, the output transistor is off.
    But, that's not what I read here:
    In my circuit, the voltage on the + terminal is 6V. The voltage on the - terminal is 156mV. With these 2 voltage inputs, according to the quoted piece (as I interpret it) both of my comparator output transistors should be conducting (LOW output from the wired-OR gate).

    If I'm not mistaken, theres a disparity between what that page says and what you guys are saying. I totally agree with you though, because that's what I saw. Is there some scenario where what the page says is correct?
  7. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    Messages:
    9,411
    Location:
    Ontario, Canada
    The article you found about comparators is completely WRONG!
    strantor likes this.
  8. MrChips

    MrChips Moderator Staff Member

    Joined:
    Oct 2, 2009
    Messages:
    10,131
    It depends on if that transistor is part of the comparator or external to the comparator.
    A single common emitter transistor stage acts as a logic inverter.
  9. Jony130

    Jony130 Senior Member

    Joined:
    Feb 17, 2009
    Messages:
    2,732
    Location:
    Poland/Wroclaw
    I think that in the article they treat transistor as a part of the comparator.
    So I don't see any error in the article.
  10. MrChips

    MrChips Moderator Staff Member

    Joined:
    Oct 2, 2009
    Messages:
    10,131
    Just the opposite.

    If you define a comparator as HIGH OUTPUT when V+ exceeds V-
    then the transistor is outside of the comparator.

    In either case, there is nothing wrong with the article.
  11. wayneh

    wayneh AAC Fanatic!

    Joined:
    Sep 9, 2010
    Messages:
    8,391
    Location:
    Roscoe, IL
    +1
    Misleading may be the better term. It specifically mentions using an LM339 quad and appears to show an external transistor, although the text refers to it as internal. But it makes zero mention of using a pull-up resistor, and that's simply wrong, since this is the most frequent boo-boo when using this chip.

    The text also describes current flowing when the + input is higher than the - input. Wrong. Current flows when output goes low, not high.
    Last edited: May 1, 2012
  12. MrChips

    MrChips Moderator Staff Member

    Joined:
    Oct 2, 2009
    Messages:
    10,131
  13. crutschow

    crutschow AAC Fanatic!

    Joined:
    Mar 14, 2008
    Messages:
    7,148
    Location:
    L.A. USA
    My understanding, after reading the article, is that the transistor they are referring to is part of the comparator output and, in that case, they have the polarity of input to output wrong.
  14. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    Messages:
    9,411
    Location:
    Ontario, Canada
    I agree. They are stupid to claim that the transistor is separate from the comparator when actually it is built in.
    I think they are just trying to confuse the nOObs.
  15. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    Messages:
    9,411
    Location:
    Ontario, Canada
    I agree. They are stupid to claim that the transistor is separate from the comparator when actually it is built in.
    I think they are just trying to confuse the nOObs.
    Maybe they are confused nOObs.
Similar Threads
Forum Title Date
General Electronics Chat Simple comparator not working, voltage dropped Tuesday at 10:22 AM
General Electronics Chat Comparator input impedance matching.. Nov 7, 2014
General Electronics Chat NE522(High-speed dual-differential comparator/sense amp) Aug 18, 2014
General Electronics Chat What's a "temperature comparator" called? Jul 11, 2014
General Electronics Chat Question about LM311 Comparator May 16, 2014

Share This Page