Visual
Lab intro
The logic gates simulator provides a two-input, one-output interface for each gate type. You set A and B using toggle switches, and the output LED updates instantly. This tutorial walks through the AND gate in detail, then shows how to switch between gate types to build a complete truth table for each one.
What you will learn
- How to toggle inputs A and B and read the output LED
- The correct output for all four input combinations of a two-input AND gate
- How to switch between AND, OR, NAND, NOR, XOR, and XNOR gate types
- Why NAND and NOR outputs are the inverse of AND and OR respectively
Prerequisites
- Knowledge of binary logic: 0 represents LOW, 1 represents HIGH
- Understanding that a gate is a combinational device with no memory
Step-by-step
- Step 1: Select AND gateOpen the Logic Gates Simulator from the Labs menu. Use the gate selector buttons at the top of the interface to choose AND. The circuit diagram in the center panel updates to show the AND gate symbol with two inputs on the left and one output on the right.Tip: The gate symbol shown is the standard ANSI shape. If your textbook uses IEC rectangular symbols, the labels A, B, and Y still correspond to the same terminals.
- Step 2: Test input 00Both A and B toggles are OFF (grey) by default, representing A=0 and B=0. The output LED should be dark, confirming Y=0. The truth table row for 00 fills in automatically at the bottom of the panel.Tip: If the output LED is ON when both inputs are OFF, the gate selector may have loaded NAND instead of AND. Reselect AND from the selector.
- Step 3: Test inputs 01 and 10Click toggle A to ON while B remains OFF (A=1, B=0). The output LED remains dark: Y=0. Then click A back to OFF and click B to ON (A=0, B=1). Output is still dark: Y=0. Both rows record in the truth table.Tip: For AND, any single HIGH input is not enough. Both inputs must be HIGH simultaneously for the output to go HIGH.
- Step 4: Test input 11Click both A and B to ON (A=1, B=1). The output LED lights up blue: Y=1. This is the only input combination that produces a HIGH output for AND.Tip: Compare this to OR by switching to the OR gate: the LED will be ON for 01, 10, and 11, and OFF only for 00.
- Step 5: Switch to NAND and verify inversionClick the NAND button in the gate selector. Without changing A and B from 11, notice that the output LED switches from ON to OFF. NAND is the complement of AND, so Y=0 when A=B=1. Set A=0, B=0 and the output goes ON.Tip: NAND is a universal gate. You can build any other gate using only NAND gates. The simulator gate selector helps you see why: NAND with a single input tied to itself behaves as NOT.
- Step 6: Complete XOR truth tableSelect XOR from the gate selector. Work through all four input combinations: 00 gives Y=0, 01 gives Y=1, 10 gives Y=1, 11 gives Y=0. The XOR gate produces HIGH only when the inputs differ.Tip: XOR output for 11 being LOW is the point most students miss. If the output is ON for 11, verify the selector is on XOR and not OR.
Expected output
The completed truth table shows AND: only 11 gives Y=1. OR: 01, 10, and 11 give Y=1. NAND: only 11 gives Y=0. NOR: only 00 gives Y=1. XOR: 01 and 10 give Y=1. XNOR: 00 and 11 give Y=1. The output LED matches every truth table entry in real time.
Troubleshooting tips
- Output LED does not change when toggling inputs: The browser may have cached a stale simulator state. Hard-refresh the page with Ctrl+Shift+R and reopen the lab.
- Truth table shows Y=1 for AND when inputs are 01: Check that the gate selector has not reverted to OR. The label above the gate symbol confirms the active gate type.
- XOR and XNOR outputs look identical: XNOR is the complement of XOR. For XNOR, 00 and 11 give Y=1 while 01 and 10 give Y=0. They have opposite outputs for every row. If they look the same, you may be reading the wrong truth table column.
- Simulator shows three input terminals instead of two: Some gate types (such as 3-input AND) may load depending on the lab configuration. Look for a '2-input' option in the settings panel to return to the standard two-input interface.