Lab tutorials

How to Use the Flip Flop Simulator on ECExplain

Learn how to use the ECExplain flip flop simulator to observe SR, D, JK, and T flip flop behaviour with step-by-step instructions.

Visual

InputsDCLKD Flip FlopEdge triggeredOutputsQQ'

Lab intro

The flip flop simulator on ECExplain lets you toggle input signals and a clock line, then observe how the output Q and its complement Q' respond in real time. This tutorial covers the D flip flop specifically, which stores one bit of data on each rising clock edge. You will set the D input, trigger the clock, and watch Q latch the value.

What you will learn

  • How a D flip flop samples the D input on a rising clock edge
  • The difference between the transparent latch state and the hold state
  • How to read Q and Q' output LEDs from the simulator panel
  • Why Q does not change when D changes between clock pulses

Prerequisites

  • Basic understanding of logic levels: HIGH (1) and LOW (0)
  • Familiarity with what a clock signal does in a sequential circuit
  • Completed the logic gates simulator tutorial or equivalent knowledge

Step-by-step

  1. Step 1: Open the simulator
    Navigate to the Flip Flop Simulator from the Labs section. Select 'D Flip Flop' from the type dropdown at the top of the panel. The simulator loads with D = 0, CLK = 0, Q = 0, and Q' = 1 by default.
    Tip: If the simulator shows SR or JK inputs instead, check that the type selector is set to D and not left on a previous session value.
  2. Step 2: Set D to HIGH
    Click the toggle button labelled D in the Inputs panel on the left. The button background changes from grey to blue, indicating D = 1. The Q output LED remains dark because no clock edge has occurred yet.
    Tip: Watch Q carefully. It will not change the moment you set D. This is the key behaviour of an edge-triggered flip flop.
  3. Step 3: Apply a rising clock edge
    Click the CLK toggle button once to set CLK = 1 (rising edge). The Q output LED immediately lights up blue, and the Q' LED goes dark. The simulator has just latched D = 1 into Q.
    Tip: The latch happens at the moment CLK transitions from 0 to 1, not while CLK stays HIGH. Click CLK to 0 and then back to 1 again to produce a second rising edge.
  4. Step 4: Change D while CLK is HIGH
    With CLK still HIGH, click the D toggle to set D = 0. Observe that Q remains HIGH. The flip flop holds its previous state because no new rising edge has occurred.
    Tip: This confirms edge-triggered operation. A level-triggered latch would have changed Q immediately when D changed.
  5. Step 5: Trigger a second clock edge with D = 0
    Click CLK to LOW (0), then back to HIGH (1) to generate a new rising edge. Q now switches to 0 and Q' switches to 1, reflecting the current D = 0 input.
    Tip: If Q does not update, verify that D is still set to 0 before the rising edge. The simulator reads D at the moment of the edge.
  6. Step 6: Observe the truth table
    The truth table panel below the simulator updates after each clock edge. Each row shows the D value at the time of the edge and the resulting Q. Work through D = 0, D = 1, D = 0, D = 1 in sequence to fill four rows and verify the pattern.
    Tip: Export the table using the Download CSV button at the bottom of the truth table panel if you want to include it in a lab report.

Expected output

After completing all steps, the truth table shows alternating Q values that match the D input at each rising clock edge: D=1 produces Q=1, D=0 produces Q=0, with Q' always opposite to Q. The LED panel shows Q and Q' in complementary states at all times.

Troubleshooting tips

  • Q stays at 0 regardless of D: The CLK toggle was not cycled through a full LOW-to-HIGH transition. Click CLK to 0 first, then to 1 to produce a valid rising edge.
  • Q and Q' are both showing the same state (both ON or both OFF): This indicates a simulator load error. Refresh the page and reselect D Flip Flop from the dropdown.
  • The truth table is not updating: Scroll down to check whether the table is below the fold. It appears beneath the waveform display and does not auto-scroll.
  • Clicking D changes Q immediately without a clock pulse: The type selector may have defaulted to a transparent latch mode rather than edge-triggered D flip flop. Confirm the mode label reads 'D FF (edge)' not 'D Latch'.