Maker Pro
Maker Pro

Explain strange behavior in 74HC04

I got my first logic gate in the mail yesterday and started playing around with it. I set up a 5v power regulator and my new 74HC04 (6 gate hex inverter); power into power, ground into ground. I put an LED + resistor onto one of the outputs and a switch onto the related input. Everything worked as expected. When the switch was not pressed the LED lit up. When I pressed the switch the LED went dark. So then I decided to run two gates in series. I unplugged the switch and plugged a wire from the input of the LED's gate into the output of another gate on the same chip. The LED went dark as expected. That the new gate was receiving no input so it was inverting it to positive output which the second gate was inverting back to no output and turning the LED dark. Then I plugged a wire into the input of this second gate. The other end of the wire was not plugged into anything at all but to my surprise the LED lit back up as if this wire was provided positive input. Can anyone enlighten me as to what was going on?
 
An input must be driven either high or low, you cannot leave it unconnected, (also called floating) or it will not function correctly.

If you want input from a switch, you would use a switch to either 5V or ground, and a resistor to the opposite, so that it is always one or the other.

Another way to put it, no input does not mean logic 0.

Bob
 
I agree 100% with everything BobK says.

I will add that the wire you are attaching to the input of your gate is likely acting as an aerial and picking up mains hum of 50 or 60Hz depending on your country.

You have created a 50 or 60Hz oscillator - albeit an unreliable and undependable one.
 
Top