AND-gate with flip-flop to turn on lamp

Discussion in 'Homework Help' started by TsAmE, Jun 20, 2010.

  1. TsAmE

    Thread Starter Member

    Apr 19, 2010
    72
    0
    3 pushbutton units A, B and C each produce a logic '1' while pressed. Design a circuit in which briefly pressing C permanently turns off an indicator lamp L. To turn L on again, button A must be pressed first, then button B. Pressing them in the reverse order has no effect.

    In the diagram attachment (which is the correct answer), I dont get how pressing B then A would have no effect as:

    *If B is pressed first, a '1' will correspond to one of the inputs of the AND-gate, the R of the flip-flop will be triggered resetting the other input of the AND-gate to 0 (first input=0, second input=1). But now when A is pressed, the first input will change to '1', and thus both inputs = '1', which means the lamp turns on, but it shouldnt:confused:
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Actually it would be better if the attached diagram had more details than it does. There are several inputs to a flip/flip and there are several flavors of flip/flop.

    hgmjr
     
  3. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    Let's notice that you use JK flip flops, as you ommited to label them in your schematic.

    Let's examine things from the beginning:

    • At first, all flip flops are set to 0 state and all inputs are 0. The lamp is off
    • We press A. FF1 gets 1/0 as input and is set to 1
    • We release A. FF1 gets 0/0 as input and is on hold at 1
    • We press B. AND Gate gets 1/1 and ouputs 1. FF2 gets 1/0 as input and is set to 1. The lamp is lit.
    • We release B. And Gate gets 1/0 and outputs 0. FF2 gets 0/0 as input and is on hold at 1. The lamp is lit.
    Now, to close the lamp:

    • We press C. FF2 gets 0/1 as inputs and goes to reset (state 0). The lamp is off. Also FF1 gets 0/1 and goes to reset (state 0).
    If we press B,A when system is off:

    • We press B. FF1 is in 0. AND Gate gets 0/1 and outputs 0. FF2 gets 0/0 and stays in 0.
    • We press A. FF1 gets 1/0 and goes to set (state 1). AND Gate gets 1/0 and outputs 0. FF2 gets 0/0 and remains on hold at state 0.
    If we press A at this point (after B is pressed), the lamp is lit. I hope this makes obvious how this sytem works. Please ask further is something remains obscure.
     
  4. TsAmE

    Thread Starter Member

    Apr 19, 2010
    72
    0
    Sorry I forgot to be more specific but it contains a RS flip-flop (refer to attachment). Does this change what you said above?
     
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
  6. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    As long as you don't excite both inputs of the FF (wich isn't our case) RS and JK are identical. So, no, the analysis is the same.
     
  7. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Who is to say both wont be excited at the same time?

    Using both buttons, in a required order, requires logic. If the inputs are the same, there will be no differentiation between button orders.
     
  8. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    That would be the data of the exercice.
    It states that the sequences would be A then B, or B then A. And C will be pressed when the lamp is lit (after pressing A and then B).
    I agree that RS is a bad choice for a robust system, but when solving a theoretical exercise you have to make simplifications and assumptions in order to come to a clean solution. Let alone the fact that the tutor won't get "use JK FF" as an answer, if he asked for RS.

    To TsAmE: I should specify that I made my analysis assuming that the J pin is on the top and K pin is on the bottom of the FF. Alternatively, the S pin is on top and the R on the bottom for an RS FF.
     
  9. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    What I was getting at, is the data of the exercise calls for no effect if B then A is pressed.

    So, using a logic system to dump low if A is not pressed first.

    So if latching A, then A=1

    so when B is pressed, if A=1 then let B=1

    therefore the AND is happy and triggers.

    If B is pressed and A=0, 'A' has NOT been pressed yet, then B=0.

    I think the main point it using the logic with latching flip-flops to get the button press order logic together.
     
  10. TsAmE

    Thread Starter Member

    Apr 19, 2010
    72
    0
    I have only learnt about the RS flip-flop so far in my course, thats why this question is based on it. I understand most of this diagram, but I just dont understand the part when if B is pressed first then A, the lamp will not light as:

    *Pressing B would make the 2nd input of the AND-gate = 1
    *Then pressing A would set the 1st input of the AND-gate = 1
    *Thus 1 and 1 makes the lamp turn on which isnt right.
    *I dont get if the reset line coming out of the bottom-left of the first flip-flop is joined to B? Which I havent taken into consideration.
     
  11. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    The link in post #5 gives you the truth table for an R-S flip flop. Try assigning A & B for R & S so A = R and B = S, or the other way around to see how the flip flop works. Then it should be easy to see how to AND the B signal to get the function. Using C to reset is the next step.
     
  12. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    You have a logic gap in your thoughts. As your switches are pussbuttons, they do not latch on one position, but return to 0 when you don't press the anymore. Consequently, ressing B will make the 2nd input of AND 1, but you will then let B go to 0, before you press A. As a result, the AND gate will never have 1 on both its inputs at one time, and won't give 1 to the S pin of the second RS FF.
    Is that clear?
     
    TsAmE likes this.
  13. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    I tend to agree with georacer that you must be thinking that you hold the pushbutton B down and then press pushbutton A. My interpretation of the sequence is that you press A (then release A) and then press B (then release B). A and B are momentary switches and therefore they return to the open state when released. If after pressing C and releasing C, you press B (then release B) and then press A (then release A), then the light should not light.

    hgmjr
     
  14. TsAmE

    Thread Starter Member

    Apr 19, 2010
    72
    0
    Ah of course that makes sense now, thanks a lot:) The other thing which confused me was that the reset line of the first flip-flop intersects the B line (either it is joined, or the line overlaps?). In a logic diagram how would you tell that the lines which intersect on the diagram, arent actually joined together like in this one?
     
  15. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    B and C lines do not intersect. The most commonly used symbol for non intersecting lines is this:
    Circuit Bridge.png

    However, in simple designs as this one, when it is obvious that the lines are separate, we don't express it visually.
    On the other hand, when two lines DO intersect, we draw a dot over the intersection, like this:
    Circuit Intersection.png
     
    TsAmE likes this.
Loading...