# Choose which led that will light up, (Digital circuit)?

So I am supposed to construct a digital circuit that have 3 inputs and 2 outputs. The first input is used for "settings", in the second input you can choose which one of the LED lights you want to be affected by setting, the third input is then used to carry out the setting for the lamp you chose. the outputs are 2 LED lights.

The first input is a light switch, with this light switch you are supposed to choose if you want an LED to be on or off. 0 is off, 1 is on.

The second input is a light swhitch, with this swicth you are supposed to choose which LED you want to be affected by the setting in input 1. 0 is LED 0, 1 is LED 1.

The third input is a simple button, when you push it the setting that you chose for input 1 is supposed to affect the LED that you chose in input 2.

I am supposed to do this with only D flip flops, multiplexers and logical gates but I have no idea where to even start? What's the first step in a problem like this?

• If I were you I would start by making the configuration with first and second input(your second and third paragraph). You only need gates and multiplexers. The third step is more interesting as you have to modify a little bit the alredy existing circuit. Commented Jan 31, 2018 at 12:41
• What's the first step in a problem like this? Make a table or state diagram with all the states. You should have learned this in the class which gave you this assignment. No one on earth is expected to be able to do such an assignment without some education. Commented Jan 31, 2018 at 12:42
• @Bimpelrekkie We haven't touched on state diagrams yet but by a table I guess you mean a truth table?
– Lss
Commented Jan 31, 2018 at 12:55
– TimB
Commented Jan 31, 2018 at 12:58
• @TimB It's for lab preparation.
– Lss
Commented Jan 31, 2018 at 13:03

You can do this by constructing corresponding state diagram/table and reach the circuit by solving K-maps for next-state and outputs in terms of two switch inputs. Third switch will be the clock input in this sequential circuit. However, one quick method is :

Solve for the two outputs X and Y (Two LEDs) in terms of the two inputs A and B (Two switches), using K-maps. Using the obtained expressions, construct the corresponding combinational logic for X and Y. Now feed this logic to the D input of a D flip-flop and the output Q of the flip-flop will go to the corresponding LED X or Y. So you will need two flip-flops, one for X and the other for Y. You third switch input will be the clock input to the flip-flops.

So it sounds like what you are describing is you have one button that acts as a clock, and two switches that act as data... Or more accurately one switch is a one bit address and the other is one of bit data.

That should be enough to get you started, but I'll go a little further.

You have two outputs, which are changed depending on the input data, at the clock edge. That means you need at least two latches. You now need to figure out what the truth table of the input data is to present the right level to the D inputs of the two latches.

Once you have that, you can generate the appropriate logic circuit and present the clock. Using two 2-1 multiplexers makes it simple, shown below, but don't look if you don't want to cheat.

simulate this circuit – Schematic created using CircuitLab

• Interesting. I read that spec as purely combinatorial: 1=active high/low, 2=destination, 3=activate. Maybe he should provide the full original assignment text. Commented Jan 31, 2018 at 20:15
• @oldfart I did too at first then his 2nd last paragraph clinched it. Commented Jan 31, 2018 at 20:16
• @Trevor-G: I see what you are getting at. I can interpret it in two ways. The third button is to get the result when you push it. A register would make more sense. But nowhere is written that the result should remain if you release it. That would make it combinatorial. Shows again how difficult is to write a non-ambiguous spec. Commented Jan 31, 2018 at 20:26
• @oldfart yes, plus this may be a translation from the OP. But I take "settings" to mean it takes and keeps the state when you press the button.. but who knows.. been scuppered many times by the old "OH,, that's not what I really meant..." thing... Commented Jan 31, 2018 at 20:35
• @oldfart yup, I learned that lesson a long time ago.. It still doesn't get you past the.. "Oh I know that's what we asked for, but that's not what we really need!" bit though ... sigh :D Commented Jan 31, 2018 at 20:43

Its a simple version of how a digital watch is programmed.

Start with a truth table for every /any combination or edge transition of inputs then outputs, Use ^,v, 0,1,x