74HC08N always outputs 1 :(

Discussion in 'Digital Circuit Design' started by Human2, Dec 24, 2017.

  1. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    So if I connect I1 to + and I2 to nothing, LED shines,
    if I connect I1 to nothing and I2 to +, LED shines
    if I don't connect both I1 and I2 to anything, LED shines.

    Why is my output always zero ? Is it my mistake or maybe my SN74HC08N is broken ?

    Bez naslova.png
     
  2. MrChips

    Moderator

    Oct 2, 2009
    17,331
    5,338
    You cannot leave an input connected to nothing. The input impedance is very high and will float to any undetermined voltage.
    You must connect ALL inputs to logic LOW or logic HIGH.
     
    Human2 likes this.
  3. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    Wait, so if I want to put 0 on a pin, I should connect it to - (GND) ?
     
  4. MrChips

    Moderator

    Oct 2, 2009
    17,331
    5,338
    Yes.
     
    Human2 likes this.
  5. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    When I used transistors for logic gates when I wanted to put 0 on an input I didn't
    connect base to nothing.

    What would happen if I would connect transistor base to - in that case?
     
  6. dl324

    AAC Fanatic!

    Mar 30, 2015
    7,438
    1,762
    Ground.

    When you ground the base of a common emitter transistor, it can't turn on.
     
    Human2 likes this.
  7. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    But how do I implement switches with TTLs ?

    If I'd go from + to a swtch and from switch to a pin when switch is off there is nothing
    connected to a pin, and I can't connect both + and - to a pin what should I do in this case ?

    EDIT: I can connect 2 switches one leading - to the pin and one leading + and make a rule that one switch should always be on and one off but how can I do this with just one switch so its either 0 or 1, not 1 or nothing :/
     
    Last edited: Dec 24, 2017
  8. dl324

    AAC Fanatic!

    Mar 30, 2015
    7,438
    1,762
    Schematics are better able to convey thoughts about circuits...

    If I understand what you're asking:
    upload_2017-12-24_10-24-9.png

    When S1 is opened, the input of IC1A is connected to 5V. When it's closed, the input is grounded. The input is never floating.
     
    Human2 likes this.
  9. MrChips

    Moderator

    Oct 2, 2009
    17,331
    5,338
    What @dl324 has shown are called pull-up and pull-down resistors, respectively.
    This is one way to guarantee that the inputs are not left unconnected or floating. The value of the resistors should be at least 10 times lower than the input resistance of the input pin.
     
    Human2 likes this.
  10. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    Hmm what is the input resistance of the input pin ?

    I looked in a datasheet and could find any infromation about that.
     
  11. LesJones

    Well-Known Member

    Jan 8, 2017
    1,581
    390
    The input resistance of this type of cmos logic gate will probably in the tens of megohms range. The value of the pullup / pulldown reistor is not critical. I would suggest between 10K and 100K but anything fro 1K to 1 meg would probably work.

    Les.
     
    Human2 likes this.
  12. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    Oh okay
     
  13. MrChips

    Moderator

    Oct 2, 2009
    17,331
    5,338
    You will not find input resistance in the data sheet. What you will find is the input current or input leakage current, 0.1nA typical, 1μA max. Hence you are looking at input resistance of the order of 10MΩ or greater.

    74HC08 Input Current.jpg
     
    Human2 likes this.
  14. dl324

    AAC Fanatic!

    Mar 30, 2015
    7,438
    1,762
    The lowest value for pull-up or pull-down resistors is determined by whatever will be driving that input. The driver needs to be able to sink or source an appropriate amount of current.

    With a switch, this is a don't care; except that you want the resistance to be high enough to avoid unnecessary power dissipation.

    In the example below, the LM393 needs to be able to pull the input of IC6B to a logic LOW. Since the comparator is only guaranteed to sink 6mA, a 1k pull-up would be too low.
    upload_2017-12-24_12-57-32.png
     
    Human2 likes this.
  15. Audioguru

    Expert

    Dec 20, 2007
    10,606
    1,182
    You asked about TTL. But the 74HC08 is not TTL, it is High Speed Cmos. It has the same pins and numbering as an old TTL AND gate: 7408 which has much higher input currents and inputs that are high if they are not connected.
     
  16. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    So 74HC08 is not TTL but 74LS08 is ?

    If I'm going from +5V to pins, how do I know which current I'm supplying a pin with if I don't use a resistor
    and can't calculate current then ?

    Also, can I do this switch thing with a transistor ? Get signal to pin from emiter, +5V to collector, +5V to switch and switch to base.
    If no base current, collectors current would be really low right ? So we could use that as a 0 ? and with transistor getting
    current to base emmiter it would be bigger so we could use that as 1 ?
     
  17. MrChips

    Moderator

    Oct 2, 2009
    17,331
    5,338
    74HC08 is different from 74LS08. Check the data sheets to find out what is different.

    If you connect the gate input to 5V, the input current is IIH = 40μA for 74LS08.
    If you connect the gate input to GND, the input current is IIL = -1.6mA for 74LS08.

    For 74HC08, the input current is less than 1μA. Hence you don't need an additional transistor to drive the input. You can feed a logic level voltage 0-5V directly to the input pin.

    For clarification, state exactly what you are attempting to do. It would be best to supply a circuit diagram.
     
  18. Audioguru

    Expert

    Dec 20, 2007
    10,606
    1,182
    Absolutely not. Check the data sheet!
    IIH = 20uA for 74LS08 (it is 40uA for the 7408).
    IIL = 0.4mA for 74LS08 (it is 1.6mA for the 7408).​
    See, I remember those old things.
     
    GopherT likes this.
  19. Human2

    Thread Starter Member

    Dec 22, 2017
    51
    1
    Bez naslova.png

    Can't I do this?

    If switches would be off, the current would be really low on emmiter, maybe that could be 0 ?
    And if they would be on, emmiter current would be bigger and maybe that could be 1 ?

    EDIT:
    Oh actaully maybe get 5V to 1 transistor at the time, not both from the same breadboard input of 5V so then:

    1. +5V breadboard hole would be connected to Vcc of 7408 as in the diagram,
    2. second +5V breadboard hole would be to only T1 C and B
    3. third breadboard hole below +5V to other T1 C and B
     
  20. Audioguru

    Expert

    Dec 20, 2007
    10,606
    1,182
    You talked about a 74HC08 and a completely different 74LS08. Now you are talking about a 7408 that is also different. Which one are you using??

    Your new circuit has transistor emitter-followers (that must be NPN) that turn on and provide about +4.3V to the IC. Then when the base of a transistor floats, it "might" turn off but the emitter is floating and the type of IC determines if its input floats high or goes all over the place. ALL inputs to the IC must be high or low. Most of yours are either high or they are floating. Since the transistors create a logic high then ALL inputs need a resistor to ground to make a logic low. The datasheet for which IC you are using says the input current when low.
    The base of each transistor needs a resistor to ground to make the base 0V.
     
Loading...