0
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

I'm playing around with 7400 series gates and I wonder what the best way is to connect some buttons as input and how to add some LEDs to make the input visible.

I think I have 3 choices:

  1. positive input and LED in series (SW1)

    The LED requires 2-2.4V (depending on make and color) to light up so the gate input should switch between 0V and 2.6-3V. A 74HCxx gates requires an input high voltage of 2.4V so 2.6V should register as high. Is that enough of a safety margin or should I stick with red LEDs that trigger at 2V to get 3V input for the gate? 74AHCTxx gates require an input high voltage of only 2V so they should be even safer, right?

  2. positive input and LED in parallel (SW2)

    Or should I connect the LED in parallel to the gate to get a full 5V input? Is 10kOhm a suitable pull-down resistor in this case?

  3. negative input and LED in parallel (SW3)

    For an input that should be high when the button isn't pushed it looks like I have no choice but to go for the parallel setup. At least with 74AHCTxx gates the 2-2.4V from the LED would register as high. But with this setup the LED would light up on LOW. Is there something better that doesn't need extra gates or transistors to make the LED go out when I press the button?

\$\endgroup\$
0

4 Answers 4

1
\$\begingroup\$

I think it should be 'obvious' that the switch and gate must work without the LED.

Otherwise you can't be sure any of your logic circuits will work without the LED, which would be a Heisenberg Effect, the act of observing the circuit may be changing the circuit's behaviour.

So 1 is a bad approach; the LED+current limiting resistor should be in parallel with the gates input, after the switch. Dropping voltage across a LED, as in 1, when driving the input is always a bad idea. The voltage drop across a green LED would probably be so big that the logic gate wouldn't work, and even a red LED might effect some logic families. That is what I mean by a 'Heisenberg' effect; adding a monitoring LED changes the behaviour of the circuit.

Which logic state the button/switch should drive likely depends on the application logic (and how you might be trying to minimise gates), so both 2 and 3 may be valid in the same application.

Then it becomes a question of what you want to see.
Do you want to see when the gate input is high, low, both, or not connected?

I might check that something is not connected with a multi-meter.

When I am playing around, I like to be able to add, remove and move 'observation', so I would use the LED+resistor arrangement in either 2, 3 or both to observe any point in a circuit.

EDIT:
I am not suggesting you use LOW == true.

I am suggesting that it is often convenient to 'observe' either true, false, or both.

I am attempting to alert you to the more general monitoring issue which happens when you construct actual circuits for applications, representing complex expressions, with many intermediate terms.

In general, logic circuits will have gates in series with gates. Then it may be very helpful to put an LED 'inside' a sequence of gates to make it easy to monitor a partial result. Sometimes it is easier to understand the behaviour of the overall logic circuit when a specific partial result is visible, and that partial result may need to be true or false. For example it is often useful to see if any input of an AND gate is false, and the input of an OR gate true.

So don't base the approach to logic state monitoring on the idea that only true is important.

Hence, a good strategy has the properties:

  • 'observation LEDs' can be added and removed without effecting the circuit
  • the inputs can be buttons or switches; buttons can normally (un-pressed) input either true or false, switches can provide either state
  • any signal can carry zero, one or two LEDs (I'd standardise on one colour for true and a different colour for false)
  • the electronics for 'observation' LEDs should be the same for buttons and intermediate logic states, so that you can assemble larger circuits from smaller circuits, or remove terms and substitute with a button or switch.
\$\endgroup\$
3
  • \$\begingroup\$ Do you mean probe effect, the electronics equivalent of programming's Heisenbug? \$\endgroup\$ Aug 23, 2016 at 18:04
  • \$\begingroup\$ I prefer the more general Heisenberg reference. Domain-specific terms when a general term already exists, or cutesy terms, always sounds a bit 'cliquey' or 'jargoney' to me (i.e. about exclusion, not inclusion and accessibility), so I try to avoid them. I would hope anyone with a reasonable scientific education would be familiar with 'Heisenberg effect' without needing to search the www. However YMMV :-) \$\endgroup\$
    – gbulmer
    Aug 23, 2016 at 18:09
  • \$\begingroup\$ I think input high == led on make the most sense. My ICs are labeled as e.g. quad 2in POS_NOR gate. So I think I will stick with LOW being 0V and HIGH being VCC. Otherwise I would have to always convert the logic function of each gate to it's reverse. That would get confusing. Or is there a good reason to turn everything upside down? \$\endgroup\$ Aug 24, 2016 at 0:04
0
\$\begingroup\$

I agree with gbulmer in that approach 1 is not desirable, but approaches 2 and 3 are both fine and depend on what kind of output you'd like to see from them.

The 1st approach isn't as "safe" (regarding logic level voltages) as the 2nd and 3rd approaches, which use the 10k resistors. Personally, I tend to use the style of approach 2 because I like to have an active HIGH output, but it depends on your own preference.

A decently prominent problem with approach 1 is that the LED will cause a voltage drop, so the logic gate won't actually see your logic level voltage, but rather something smaller. Approaches 2 and 3 don't have this issue (I use them frequently with I/O pins on mirocontrollers)

\$\endgroup\$
1
  • \$\begingroup\$ I have inputs where I want to simulate different defaults. Some I want to default to low, some to high when the button isn't pressed. So that normaly I would only change one or two inputs away from the default, press one or two buttons, at a time to test a circuit. I gues a 4th option would be to have a flip-flopy with 2 buttons (set and reset) and 2 outputs (active high and active low). I should probably build me a number of those on a separate breadboard so I can wire them in as needed and keep the test breadboard clean of clutter. \$\endgroup\$ Aug 23, 2016 at 23:57
0
\$\begingroup\$

It is important to recognize that TTL used higher impedance current limiting on the high side driver and Similarily with input currents.

The TTL standard threshold voltage for all families from 74xx to 74Lsxx to CMOS 74HCTxx has always been to PN diode junction or Vbe drops of 0.65V each or 1.3V -1.4 nominal subject to temperature effects. This is also the floating TTL input voltage.

Now LEDs have a greater Vf drop (1.2 for IR, 2.1 for Red, etc) so using them in series to make a logic 0 input won't satisfy the 0.8V max level giving 0.5V margins for a logic 0 worst case.

Thus you always put the LED on the high side since VIh=2.0V minimum giving 0.6-0.7V noise margin to the TTL input threshold.

The reason for this apparent asymmetric voltage margin is actually to balance the noise power or VI margin from stray noise.

Thus when you work out the actual input voltages example 2 is the only one which fails for not meeting the criteria for Vil=0.8max and Vih=2.0 min Example 2 has Vih=5V and but Iil inout current is 1.6mA so a 200 Ohm not a 10k pulldown would be needed to work as a "bandaid" and not recommended.

Not shown is a Red LED +220 Ohm pullup to 5V with a switch to ground with up to 60 Ohms driver impedance to get 0.8V max. While 7400 Output for a "0" output is 0.4V @16mA thus has a typical low output ESR < 40 Ohms and also works. This is how I might have done it only using active low for ON indicators. We called this "negative logic" or active low inputs , commonly used in TTL for set, reset etc.

\$\endgroup\$
2
  • \$\begingroup\$ I'm not sure you have your numbers right there. 74HCT00 has a voltage input low of 0.8V max, true. But at 20uA, not 1.6mA. So for SW2 I get: 0.00002 A * 10000 Ohm = 0.2V. So a 10kOhm pull down seems OK to me. I also don't get your last part about red LED + 220 Ohm pullup to 5V. Could you draw that? Where does the 7400 output come into play there at all? \$\endgroup\$ Aug 23, 2016 at 23:50
  • \$\begingroup\$ sorry I read playing with 7400 as TTL. #2 then works, for 74HCT input currents . Last part is for negative logic ,,low,side switch with pullup. \$\endgroup\$ Aug 24, 2016 at 0:23
0
\$\begingroup\$

A far more reasonable thing to do would be to have an LED that doesn't mess with your logic levels so that you can use it to probe any point in your circuit without having to consider what effect it may have on the circuit.

Something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

The point marked Probe in both of those diagrams can be connected to any point in your circuit to show the current state of that input (or output.)

The first uses a 7404 buffer. The second uses an AND gate as a buffer.

You can connect these with a wire that has a free end to use as a logic probe, or connect them permanently to some point that you always want to monitor.

\$\endgroup\$
1
  • \$\begingroup\$ A probe is something completly different and overkill (too many parts) for an input switch. Also I think the recommended way is to use a NOT gate and connect the LED towards Vcc. But that might be from TTL times. \$\endgroup\$ Aug 26, 2016 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.