# What happens if more than one button is pressed at the same time?

Discussion in 'Homework Help' started by Blackrobe, Nov 3, 2009.

1. ### Blackrobe Thread Starter New Member

Oct 30, 2009
6
0
Hey there,

I have to build something similar to a LED display that only displays 1s and 0s.

The circuit will have three inputs (1, 0, and reset)..and 5 outputs (one output to display each digit so you can enter 5 digits max to display). I need to find a solution on what happens if two of the buttons or more were pressed at the same exact time..so for example what happens if 1, 0 and clear are pressed at the same time.

My solution: I was thinking of using propagation delay, that allows me to address each input at a time even when three are pressed so for instance 1 will not have delay, 0 will have one delay and clear would have 2 delays...does it make sense?.. I cant think of any other reliable way.

2. ### beenthere Retired Moderator

Apr 20, 2004
15,815
283
Many variables come into play. If your circuit is properly designed, only the first button press will be recognized. Trivial in software, cumbersome in logic.

That said, what device/s are your buttons attached to?

3. ### MaxSmoke Active Member

Oct 29, 2009
35
0
It is hard to say without seeing the original question your circuit diagram, but I would look at the truth tables and datasheets for each device you have design in to your circuit, as this often helps. Further, draw a timing diagram.

By way of example, what happens to the outputs of a D type flip flop if both preset and clear are asserted at the same time? The only way to be sure is to look at the datasheet truth table. If you were using a 74LS74 then both Q and Q\ would go high, but the flip-flop is not stable. The same will apply to your design, you should be able to design the circuit on paper and then apply the truth tables to each part of the logic to see ultimately what occurs. Of course if you have access to a simulator this will show you the outputs, when all inputs are asserted.

Another approach is to give a higher priority to, say, the logic one input over the logic zero input. So, when asserting both inputs the logic one will win. However, reset should always override any circuit state or condition, this allows the circuit to to return to a know state when reset is asserted.

4. ### hobbyist Distinguished Member

Aug 10, 2008
774
64
Your way would work, if that's the kind of output your looking for,
but if your looking for a output that will cancell, there are several ways to approach this, for instance, you can use a "exclusive OR" gate function,
where one input goes through to the output, but if more than one input comes in then there is no output, each input cancells eachother out,
and with that you can send this multiple input into a "AND" gate function, to provide an "ERROR" signal, of some sort.

5. ### Blackrobe Thread Starter New Member

Oct 30, 2009
6
0
I guess this is the right approach i have to consider...probably its a matter of preference (which input should be considered first) so I guess I'm just gonna go with what you advised...reset has highest preference then the one button and then the zero button. But in what way should I implement this function, I was thinking of some series of gates that works as such:

- If Reset = 1 and One = 1 and Zero = 1, disable One button and Zero button then execute Reset.
- If Reset = 1 and One = 1 and Zero = 0, disable One button then execute the Reset.
- If Reset = 1 and One = 0 and Zero = 1, disable Zero button then execute the Reset.
- If Reset = 0 and One = 1 and Zero = 1, disable Zero button then execute the One button.

I'm actually using a left-shifting register since another part of my homework is to be able to shift each input to the left after entering a new input which goes to the rightmost position and so on.

Also I'm trying to build storage for each digit or input entered and then shift it to the left when needed. So I was wondering what kind of storage component is the best for this case? D-Flip Flop or just a simple Latch?