Connecting several digital outputs together into one master line.

Thread Starter

Green Bean

Joined Mar 31, 2017
126
I have designed a circuit that takes input from a 2 bit DIP switch, and uses that data to address one of 4, 4 bit DIP switches. The output of the selected 4 bit DIP switch feeds into 4 LEDs. Here is my schematic:
IMG_20170704_1439512_rewind.jpg
(The yellow squares are there to show individual DIP switches).

The circuit uses a 4 to 16 line decoder (the 74ls154) and a hex inverter (the 74ls04). Here are the pin outs (for those who need them):
th (27).jpg th (26).jpg
The circuit "selects" which DIP switch's value is outputted to the LEDs by only supplying +5v to one, 4 bit switch at a time, the one addressed by the 2 bit DIP switch. The 2 bit switch is connected to the two least significant bits of the decoder's 4 bit input, and the decoder's lower 4 outputs connect to the hex inverter (because the decoder's outputs are inverted). Each of the four outputs (now reverted to their correct state) then feed into the 4 bit DIP switches. Each output connects to all 4 of their individual DIP switch's inputs. The output of bit 1 of every switch is connected to the first LED. The output of bit 2 of every switch is connected to the second LED. The output of bit 3 of every switch is connected to the third LED. And the output of bit 4 of every switch is connected to the fourth LED.

Why am I using 4 to 16 line decoder when I should be using a 2 to 4? Well, I do plan on using all the inputs and outputs in my final circuit, but for the sake of simplicity, I only used 2 inputs and 4 outputs here. Plus, the number of inputs/outputs used is irrelevant, the question is:

All of the first bits of every switch are connected, and all of the second bits of every switch are connected and the third bits, and fourth - basically there are four master lines (which connect to the LEDs) each with four "mini" lines of their own (connected the 4 bit DIP switch outputs). At most one, and at least zero of the "mini" lines will be high at any given time (depending on what switch is selected, and whether the bit on the selected switch that the master line corresponds to is high). When none of the "mini" lines are high, the master line is low and the LED does not light, no problem. But what about when one "mini" line is high, and the other three are low?

Will this create some sort of conflict, almost like bus contention? Is this what bus contention is? Theoretically (to me at least lol), because 1+0+0+0=1, there should be no problem, the master line will go high and the LED will light. But am I missing something? If so, what can I do to solve the problem?
 
Last edited:
Two much wordage.

I get "You want to select which group of 4 switches are presented to the LEDS?"

I might get the logic backwards, but it depends on the parts used.

If that's the case, you can do it easily with a bus structure. First use open collector inverters to drive the LED's.

Then connect each to a Tri-state buffer with likely one pull up resistor.

The inputs would go to the switches. So, 4 tri-state buffers inputs would go to one switch.

If you want the select lines to be 2 switches send it to a multiplexor that enables one of the tri-state drivers.

In a bus, the entire bus is usually pulled high. The bus drivers can be set to the high Z state except for the one being addressed. The actual circuit depends on the parts selected. Pull ups may or may not be needed.
 

Thread Starter

Green Bean

Joined Mar 31, 2017
126
Too much wordage to follow. :rolleyes:
What exactly is the purpose of all this circuitry?
Lol, the circuit just selects between four DIP switches and the output of the selected switch gets sent to the LEDs. The problem is basically that four lines have to connect to a single line, and there could be a combination of one high and three lows. I don't know if that will cause a problem, but I think I just thought of a solution! What if I connect the digital outputs to the bases of transistors, connect the collectors to +5v, and the emitters to the DIP switches. That way, outputs that are logic low will float (right?)
 

Thread Starter

Green Bean

Joined Mar 31, 2017
126
Floating and logic low are two different things. Float means "not connected".
Yes I know, that's the point. What I want is the outputs that are logic low to float instead, so that there is no conflict with the selected output that is high. I worded that terribly, sorry lol. I don't mean the outputs of the chip, but what's going into the DIP switches at the end.

If one output is high and the other three are low, and they all connect on one line, that'll create problems right? But if one is high and the other three are floating, or one is low and the other three are floating, there's no conflict.

My idea is to connect the outputs (which I think in this case can only be high or low) to the bases of transistors and use the transistors as switches, with the collectors connected to +5v. What I don't know is whether or not the transistors' emitters will float if the switch is open (base is low). If that is the case, then that's the solution.
 
Last edited:

crutschow

Joined Mar 14, 2008
34,286
....whether or not the transistors' emitters will float if the switch is open (base is low). If that is the case, then that's the solution
Yes they will float.
You can substitute diodes for the transistor and get the same effect.
It's called a diode-OR circuit.

But beware of cross-talk between sets of switches.
Even if one set of switches has the ground floating it can conduct through any switches that are on through the common connection and affect the current from the set of switches that are on.
You can avoid that by adding a diode in series with each switch.
 
Last edited:
My idea is to connect the outputs (which I think in this case can only be high or low) to the bases of transistors and use the transistors as switches, with the collectors connected to +5v. What I don't know is whether or not the transistors' emitters will float if the switch is open (base is low). If that is the case, then that's the solution.
Pretty much the functionality of a ULN2003.
 

Thread Starter

Green Bean

Joined Mar 31, 2017
126
...You can substitute diodes for the transistor and get the same effect...
Ohhh yeaaah, that's cool. Ok, that's what I'll do, thanks.
But beware of cross-talk between sets of switches.
Even if one set of switches has the ground floating it can conduct through any switches that are on through the common connection and affect the current from the set of switches that are on.
You can avoid that by adding a diode in series with each switch.
Ok, I think I understand. So something like this?
IMG_20170705_1127364_rewind.jpg
But wait, if I have to put diodes on the output of every switch anyway, wouldn't the diodes on the inverter outputs be unnecessary?
 
Top