Sequential Logic, Latches, Flip-Flops, and Counter Applications Study Guide

Combinational Logic and Sequential Logic Circuits

  • Combinational Logic Circuits:     * Defined as logic gate circuits where the output is determined solely by the current particular input state.     * Characteristic: These circuits can only have one output state for a specific input state.     * Constraint: If the input conditions are removed, the output changes immediately; they possess no memory.

  • Sequential Logic Circuits:     * Defined as circuits possessing a bistable state, allowing for different outputs for the same input depending on history.     * Memory State: This is the state where the device’s output retains the previous value even after inputs change.     * Core Components: Sequential circuits utilize logic gate devices known as Latches and Flip-Flops.

  • Practical Example: Burglar Alarm:     * Scenario: In a burglar alarm, if a thief enters through a window, the alarm should remain active (latched) even if the window is closed afterward.     * Comparison: In a standard combinational logic circuit, the alarm would shut off the moment the window closed because the circuit lacks memory.

Latches

  • General Definition: The simplest sequential device used for temporary storage with two stable states (bistable). It serves as a basic form of memory.

  • S-R (Set-Reset) Latch:     * NOR Gate Construction: Constructed from cross-coupled NOR gates. This configuration responds to active-HIGH inputs.     * NAND Gate Construction: Constructed from cross-coupled NAND gates. This configuration responds to active-LOW inputs (often denoted with a bar over the S and R).

  • Active-HIGH S-R Latch Operation (NOR-based):     * Latch/Stable Condition: Occurs when both inputs are LOW (00).     * Initial State: Assume the latch is RESET (Q=0Q = 0) and inputs are inactive (00).     * SET Operation: A momentary HIGH signal applied to the S input while R remains LOW results in Q=1Q = 1.     * RESET Operation: A momentary HIGH signal applied to the R input while S remains LOW results in Q=0Q = 0.

  • Active-LOW S-R Latch Operation (NAND-based):     * Latch/Stable Condition: Occurs when both inputs are HIGH (11).     * SET Operation: A momentary LOW (00) signal applied to the S input while R remains HIGH results in Q=1Q = 1.     * RESET Operation: A momentary LOW (00) signal applied to the R input while S remains HIGH results in Q=0Q = 0.     * Invalid State: Active signals (LOW) must never be applied to both Set and Reset at the same time.

  • The 74LS279A IC:     * An integrated circuit featuring four internal active-LOW S-R latches.     * Two of these internal latches feature two S inputs.     * Pulsing the S line LOW sets the latch.

  • Switch Debounce Application:     * S-R latches are frequently used in switch debounce circuits.     * When a switch transitions and is not touching either contact point, the latch remains in the memory state (S=1S=1, R=1R=1), preventing signal noise from "bouncing."

  • Gated Latch:     * Variation of the basic latch that includes an Enable (EN) input.     * Operation: The latch only responds to S and R inputs when the EN input is HIGH. If EN is LOW, the inputs are ignored and the latch maintains its state.

  • D Latch:     * A variation of the S-R latch that combines the S and R inputs into a single D (Data) input.     * Simple Rule: QQ follows DD when the Enable (EN) is active.     * Truth Table:         * If EN=1EN = 1 and D=0D = 0, then Q=0Q = 0 (RESET).         * If EN=1EN = 1 and D=1D = 1, then Q=1Q = 1 (SET).         * If EN=0EN = 0, there is no change (Q=Q0Q = Q_0), and the output is latched regardless of DD.

Flip-Flops

  • Contrast with Latches: While latches are level-sensitive, flip-flops are clocked devices. A new bit is only entered at the active clock edge.

  • Triggering Mechanisms:     * Positive edge-triggered: Sensitive to the rising edge of the clock signal.     * Negative edge-triggered: Sensitive to the falling edge of the clock signal (indicated by a bubble and a triangle dynamic input indicator).

  • D Flip-Flop:     * The output QQ takes the state of the DD input only at the specific active clock edge (represented by an up or down arrow in truth tables).

  • J-K Flip-Flop:     * More versatile than the D flip-flop.     * Truth Table (Rising Edge):         * J=0,K=0J=0, K=0: No change.         * J=0,K=1J=0, K=1: RESET (Q=0Q=0).         * J=1,K=0J=1, K=0: SET (Q=1Q=1).         * J=1,K=1J=1, K=1: Toggle (The output changes to the opposite of its current state).

  • Toggle Mode Hardwiring (D Flip-Flop):     * A D flip-flop can be forced into toggle mode by connecting the Qˉ\bar{Q} output back to the DD input. This causes the output to change once for every clock pulse.

  • Synchronous vs. Asynchronous Inputs:     * Synchronous: Inputs (like D or J-K) that transition the output only on the clock edge.     * Asynchronous: Inputs that affect the output immediately, independent of the clock. Common examples are Preset (PRE) and Clear (CLR), typically active-LOW.

Flip-Flop Characteristics and Timing

  • Propagation Delay Time:     * Measured between the 50%50\% level of the clock triggering edge and the 50%50\% level of the output transition.     * tPHLt_{PHL}: Delay for HIGH-to-LOW transition.     * tPLHt_{PLH}: Delay for LOW-to-HIGH transition.     * Typical delay for 74AHC family (CMOS): 4 ns4\,ns.     * Async delays (unrelated to clock) for PRE and CLR are typically under 5 ns5\,ns.

  • Setup Time (tst_s): The minimum time the data must be present at the input before the clock transition to be reliably clocked.

  • Hold Time (tHt_H): The minimum time the data must remain at the input after the clock transition.

  • Power Dissipation: The product of the supply voltage and the average current required (P=VCC×ICC,avgP = V_{CC} \times I_{CC,avg}).

  • Speed-Power Product:     * A metric for comparing logic families using energy units.     * Formula: Average Propagation Delay ×\times Average Power Dissipation.     * Example 74AHC74A: Average delay 4.6 ns4.6\,ns, Power dissipated 1.1 mW1.1\,mW. Speed-power product = 5 pJ5\,pJ.

Multivibrators and Timers

  • One-Shot (Monostable) Multivibrator:     * Has only one stable state.     * When triggered, it enters an unstable state for a length of time (tWt_W) determined by an external RC circuit (REXTR_{EXT}, CEXTC_{EXT}).

  • Types of One-Shots:     * Non-retriggerable: Does not respond to triggers occurring while in the unstable state.     * Retriggerable: Responds to triggers during the unstable state, extending the pulse duration.     * Application: Power failure detection. AC power triggers keep the one-shot in the unstable state; if a trigger is missing (power out), the one-shot returns to stable state and initiates an alarm.

  • 555 Timer (One-Shot Configuration):     * Pulse width formula: tW=1.1×R1×C1t_W = 1.1 \times R_1 \times C_1.     * Trigger: Negative-going pulse.     * Example Calculation: If R1=10 kΩR_1 = 10\,k\Omega and C1=2.2 μFC_1 = 2.2\,\mu F, then tW=1.1(10 kΩ)(2.2 μF)=24.2 mst_W = 1.1(10\,k\Omega)(2.2\,\mu F) = 24.2\,ms.

  • 555 Timer (Astable Multivibrator):     * Continuous oscillation.     * C1C_1 charges through R1+R2R_1 + R_2 and discharges through R2R_2 only.     * Output Frequency: f=1.44(R1+2R2)C1f = \frac{1.44}{(R_1 + 2R_2)C_1}.

Counters

  • Basic Concepts:     * Binary counting follows a sequence where the LSB (Least Significant Bit) changes on every count, the next bit on every second count, the third on every fourth, and so on.

  • Asynchronous Counters (Ripple Counters):     * The clock is applied only to the first stage. Subsequent stages are clocked by the output of the previous stage.     * Disadvantage: Propagation delays accumulate. For a 3-bit counter, Q0Q_0 is delayed by 1 unit, Q1Q_1 by 2 units, and Q2Q_2 by 3 units. This limits high-speed operations.     * 74LS93A IC: Contains one independent toggle J-K flip-flop (CLK A) and three forming an asynchronous counter (CLK B). Can be combined into a 4-bit counter by connecting Q0Q_0 to CLK B.

  • Synchronous Counters:     * All flip-flops are clocked simultaneously by a common clock pulse.     * Overcomes the ripple delay disadvantage but requires more complex control circuitry (logic gates) to determine input states.

  • Decoding Counters:     * Full Decoding: Uses logic gates (like AND gates) to detect a specific binary number.     * Partial Decoding: Detecting a state by looking at only some bits (e.g., detecting 10011001 in a decade counter by looking only at LSB and MSB).

  • Decade Counters:     * Counters that recycle to zero after state 9 (10011001).     * Example: 74LS90 (asynchronous) or 74LS163 (synchronous 4-bit with terminal count RCO).

  • Up/Down Counters: Capable of counting in both directions based on a control input (e.g., 74HC190, 74HC191).

  • Cascading Counters: Connecting counters to achieve higher-modulus.     * Example: Two DIV 16 counters cascaded result in a modulus of 162=25616^2 = 256.     * Frequency Example: If fin=100 kHzf_{in} = 100\,kHz and modulus is 256256, then fout=100 kHz256=391 Hzf_{out} = \frac{100\,kHz}{256} = 391\,Hz.

Shift Registers

  • Operation Types:     * Serial In / Shift Right or Left / Serial Out: Moves data bit by bit; can be used for time delay or as a frequency divider.     * Parallel In / Serial Out (PISO): Converts parallel computer data into serial form (e.g., for Network, SATA, USB).     * Serial In / Parallel Out (SIPO): Converts serial data (USB, Keyboard) into parallel form for CPU processing.     * Parallel In / Parallel Out (PIPO): Temporary data storage (I/O port buffers, CPU registers).     * Rotate: Cyclic movement of bits (continuously rotating display).

  • Specific ICs:     * 74HCT164A: CMOS 8-bit SIPO shift register. Active-LOW async clear. Leading-edge clock trigger.     * 74HCT165: CMOS 8-bit PISO shift register. Asynchronous load when SH/LD is LOW.     * 74HCT194: 4-bit bidirectional universal shift register (supports both serial and parallel).

  • Application - Digital Signal Delay:     * Calculation: An 8-bit SISO register with a 40 MHz40\,MHz clock.     * Delay per clock: 1/40 MHz=25 ns1 / 40\,MHz = 25\,ns.     * Total delay: 8×25 ns=200 ns8 \times 25\,ns = 200\,ns.

  • UART (Universal Asynchronous Receiver Transmitter):     * A combination serial-to-parallel and parallel-to-serial converter.     * Uses a serial format consisting of a Start Bit (00) and Stop Bits (11).

Questions & Discussion

  • Q: Why use a latch for a burglar alarm?     * A: Because standard logic gates have no memory. If a door is opened and then closed by an intruder, a combinational circuit would turn off the alarm. A latch stays active even after the initial trigger (door opening) is removed.

  • Q: Determine the pulse width for a 555 timer where R1=10 kΩR_1 = 10\,k\Omega and C1=2.2 μFC_1 = 2.2\,\mu F.     * A: Using tW=1.1R1C1t_W = 1.1 R_1 C_1, the result is 1.1×10,000×0.0000022=24.2 ms1.1 \times 10,000 \times 0.0000022 = 24.2\,ms.

  • Q: How is frequency division achieved using flip-flops?     * A: Using a flip-flop in toggle mode divides the input frequency (finf_{in}) by 2. Chaining multiple flip-flops divides the frequency further (e.g., two divide by 4). The output also results in an exact 50%50\% duty cycle.

  • Q: What is the modulus of two cascaded DIV 16 counters?     * A: The modulus is 16×16=25616 \times 16 = 256.