{"base":{"id":"alphys-9-07","subject":"Physics","title":"Logic circuits and flip-flops","slug":"logic-circuits-and-flip-flops","scene":"mix3","steps":[{"use":"alphys","mode":"table","table":"gates","board":"logic","eyebrow":"Combining gates","title":"From expression to table","body":"To analyse a circuit, write the Boolean expression at each gate output and build the truth table column by column. To design one, write the truth table first, then an expression for the rows where Q = 1, simplify, and draw the gates."},{"use":"alphys","mode":"logic","gate":"nand","board":"nand","actions":[{"id":"a","label":"Input A"},{"id":"b","label":"Input B"}],"eyebrow":"Building with NAND","title":"One gate to make them all","body":"Joining both inputs of a NAND gate makes a NOT gate. NAND followed by NOT makes AND. Inverting both inputs of a NAND gives OR (De Morgan). So a single NAND chip can replace a whole set of different gates."},{"use":"alphys","mode":"logic","gate":"sr","actions":[{"id":"a","label":"Set S"},{"id":"b","label":"Reset R"}],"eyebrow":"Memory","title":"The SR flip-flop","body":"Two NOR gates cross-connected make a bistable (SR flip-flop): a 1-bit memory. S = 1 sets Q to 1; R = 1 resets it to 0; with both at 0 it keeps its last state. Try setting, releasing, then resetting."},{"mode":"quiz","use":"alphys","look":"logic","gate":"sr","eyebrow":"Check yourself","title":"Flip-flop","body":"S = R = 0 means hold.","question":"An SR flip-flop has Q = 1. S changes from 1 back to 0 while R stays 0. Q becomes…","options":["0","undefined","1 (it remembers)"],"answer":2,"right":"Right.","wrong":"Both inputs low: hold."}],"more":[{"type":"cards","id":"detail","eyebrow":"The ideas in detail","title":"Logic circuits in detail","items":[{"tag":"Design","title":"Sum of products","body":"For each row where Q = 1, AND together the inputs (inverting any that are 0); then OR these terms. Example: Q = 1 only for A = 1, B = 0 gives Q = A·B̄."},{"tag":"Memory","title":"Why a flip-flop remembers","body":"Each NOR output feeds the other's input, so once set, the outputs hold each other in place even after S returns to 0."},{"tag":"Uses","title":"Where these are used","body":"Half-adders (XOR + AND) add binary digits; flip-flops store bits in registers and memory; simple gate circuits control alarms and safety interlocks."}]},{"type":"cards","id":"ideas","eyebrow":"Popular idea vs physics","title":"Common mix-ups","items":[{"tag":"Popular idea","title":"A flip-flop needs power only while setting","body":"This kind of memory is lost when the power is switched off (volatile)."},{"tag":"Popular idea","title":"Every expression must be built from AND, OR and NOT","body":"NAND alone (or NOR alone) is enough."}]},{"type":"quiz","id":"quiz","eyebrow":"Go further","title":"Thirty questions: easy, medium, hard","questions":[{"level":"easy","question":"Combinational logic outputs depend on…","options":["present inputs only","past inputs","time"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"A flip-flop is a…","options":["amplifier","one-bit memory","rectifier"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"An S-R flip-flop has inputs…","options":["Start and Run","Send and Receive","Set and Reset"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"Sequential logic outputs depend on…","options":["present inputs only","present inputs and previous state","nothing"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"An S-R latch can be built from two cross-coupled…","options":["NOR (or NAND) gates","AND gates only","diodes"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"Q and Q̄ outputs are normally…","options":["equal","both 0","opposite"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"For a NOR latch, S = 1, R = 0 makes Q =","options":["0","1","unchanged"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"For a NOR latch, S = 0, R = 1 makes Q =","options":["1","0","unchanged"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"easy","question":"For a NOR latch, S = 0, R = 0…","options":["keeps the previous state","sets Q = 1","resets Q = 0"],"answer":0,"right":"Correct: memory.","wrong":"Look at the idea again."},{"level":"easy","question":"A burglar alarm that keeps ringing after the door closes uses…","options":["only an AND gate","a NOT gate","a latch (memory)"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"For a NOR latch, S = 1 and R = 1 is…","options":["memory","forbidden (Q = Q̄ = 0)","set"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"For a NAND latch, the active inputs are…","options":["low (0)","high (1)","either"],"answer":0,"right":"Correct: S̄ and R̄.","wrong":"Look at the idea again."},{"level":"medium","question":"A clocked flip-flop changes state only…","options":["on a clock pulse (edge)","at any time","never"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A D flip-flop copies D to Q…","options":["continuously","on the clock edge","when D = 0 only"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A T (toggle) flip-flop with T = 1 changes state…","options":["on every clock pulse","never","only when reset"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A toggle flip-flop output has frequency…","options":["equal to the clock","half the clock frequency","double"],"answer":1,"right":"Correct: frequency divider.","wrong":"Look at the idea again."},{"level":"medium","question":"Three toggle flip-flops in a chain make a counter up to…","options":["3","9","7 (8 states)"],"answer":2,"right":"Correct: 2³ states.","wrong":"Look at the idea again."},{"level":"medium","question":"A switch-debounce circuit often uses…","options":["an AND gate","a diode","an S-R latch"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"Registers in computers are made of…","options":["capacitors only","groups of flip-flops","resistors"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"medium","question":"A 2-to-1 multiplexer selects…","options":["both inputs","no input","one of two inputs to the output using a select line"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"NOR latch starts with Q = 0. Inputs in order: S = 1 (R = 0), then S = 0, then R = 1, then R = 0. Final Q:","options":["1","forbidden","0"],"answer":2,"right":"Correct: set, hold 1, reset, hold 0.","wrong":"Look at the idea again."},{"level":"hard","question":"A 4-bit ripple counter driven by a 1 kHz clock: the last flip-flop output frequency:","options":["250 Hz","62.5 Hz","4 kHz"],"answer":1,"right":"Correct: 1000/2⁴.","wrong":"Look at the idea again."},{"level":"hard","question":"A 3-bit counter at 101₂ receives two more clock pulses. Its value:","options":["111₂ (7)","110₂","000₂"],"answer":0,"right":"Correct: 5 + 2.","wrong":"Look at the idea again."},{"level":"hard","question":"Why is S = R = 1 forbidden in a NOR latch?","options":["it destroys the gates","it sets Q = 1","both outputs go to 0, and the final state is unpredictable when released"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"A logic circuit: output = A·B + C. For A = 1, B = 0, C = 1:","options":["0","undefined","1"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"A majority-vote circuit (output 1 if at least 2 of 3 inputs are 1) is…","options":["AB + BC + CA","A + B + C","ABC"],"answer":0,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"In a NAND latch, S̄ = 0, R̄ = 1 gives…","options":["Q = 0","Q = 1 (set)","memory"],"answer":1,"right":"Correct: active-low set.","wrong":"Look at the idea again."},{"level":"hard","question":"A D flip-flop with Q̄ fed back to D behaves as a…","options":["latch that never changes","toggle (divide-by-2)","NOT gate"],"answer":1,"right":"Correct.","wrong":"Look at the idea again."},{"level":"hard","question":"Number of flip-flops needed to count to 100:","options":["7","10","100"],"answer":0,"right":"Correct: 2⁷ = 128 ≥ 101 states.","wrong":"Look at the idea again."},{"level":"hard","question":"A traffic-light controller cycling through states needs…","options":["only combinational gates","only a resistor","sequential logic (flip-flops and a clock)"],"answer":2,"right":"Correct.","wrong":"Look at the idea again."}]},{"type":"keywords","id":"words","title":"Key words","items":[{"word":"Combinational logic","meaning":"Output depends only on present inputs"},{"word":"Bistable (flip-flop)","meaning":"Circuit with two stable states that stores one bit"},{"word":"De Morgan's laws","meaning":"(A·B)‾ = Ā + B̄ and (A + B)‾ = Ā·B̄"},{"word":"Set / reset","meaning":"Make Q = 1 / make Q = 0"}]},{"type":"checklist","id":"check","title":"I can…","items":["find the Boolean expression and truth table of a gate circuit","design a simple logic circuit from a truth table","explain an SR flip-flop made from NOR gates"]},{"type":"sources","id":"sources","title":"Sources","items":["NIE Sri Lanka, G.C.E. (A/L) Physics syllabus, implemented from 2017 (competency level 9.4).","HyperPhysics (Georgia State University): Flip-flops and latches."]}]},"overlay":null}