- NOT gate
- AND gate
- OR gate
- NAND gate
- NOR gate
NOT gate
NOT Gate Functionality
A NOT gate (inverter) takes one input and produces an output that is the logical inverse:
- Input HIGH (1) → Output LOW (0).
- Input LOW (0) → Output HIGH (1).
- Truth Table:
Input (A) Output (Q) 0 1 1 0
Demonstration Setup
Here’s how to build a circuit to demonstrate the 74LS04 NOT gate using a button and an LED:
Materials Needed
- 74LS04 IC (hex inverter).
- Breadboard.
- Power supply: 5V DC (e.g., USB or battery with regulator).
- Push button (momentary switch).
- LED (e.g., red).
- Resistors:
- 220Ω or 330Ω (for the LED, current-limiting).
- 10kΩ (pull-down resistor for input, see entry 2).
- Jumper wires.
Circuit Design
We’ll use one of the six NOT gates (e.g., pins 1 and 2) for this demo.
- Power the Chip:
- Connect Pin 14 (VCC) to +5V.
- Connect Pin 7 (GND) to ground (0V).
- Set Up Input with Button:
- Input A1 (Pin 1):
- Connect a 10kΩ resistor from Pin 1 to ground (pull-down, ensures LOW when button is not pressed, see entry 2).
- Connect a push button from Pin 1 to +5V (when pressed, Pin 1 goes HIGH).
- Input A1 (Pin 1):
- Set Up Output with LED:
- Connect Pin 2 (output Y1) to the anode (longer leg) of the LED.
- Connect the cathode (shorter leg) of the LED to ground through a 220Ω resistor (limits current to ~10-15mA at 5V).
- Unused Gates:
- Tie unused inputs (pins 3, 5, 9, 11, 13) to ground or VCC to prevent floating states, which can affect TTL chips. (I will skip this).
How to Demonstrate
- Power On: Apply 5V to the circuit. The LED should be ON initially (input LOW → output HIGH).
- Test Input States:
- Button Not Pressed:
- Input (Pin 1) = LOW (0V, pulled down by 10kΩ resistor).
- Output (Pin 2) = HIGH (~5V, inverted by NOT gate).
- LED ON (current flows).
- Button Pressed:
- Input (Pin 1) = HIGH (5V from button).
- Output (Pin 2) = LOW (0V, inverted).
- LED OFF (no voltage across it).
- Button Not Pressed:
- Release Button: LED turns ON again as input returns to LOW and output to HIGH.
Observation: The LED is ON when the button is not pressed and OFF when pressed, demonstrating the NOT gate’s inversion: input 0 → output 1, input 1 → output 0.
Next, the AND gate.
AND gate
AND Gate Functionality
An AND gate outputs a HIGH (1) signal only when all its inputs are HIGH (1). If any input is LOW (0), the output is LOW (0).
- Truth Table:
A B Output (Q) 0 0 0 0 1 0 1 0 0 1 1 1
This is the AND gate symbol:
"A widely used and beginner-friendly chip that contains AND gates is the 74LS08." I will use 74HC08 instead (same pinput).
Demonstration Setup
Here’s how to build a circuit to demonstrate the 74LS08 AND gate using buttons and an LED:
Materials Needed
- 74LS08 IC (quad 2-input AND gate).
- Breadboard.
- Power supply: 5V DC (e.g., USB power or battery with regulator).
- Two push buttons (momentary switches).
- LED (any color, e.g., red).
- Resistors:
- 220Ω or 330Ω (for the LED, current-limiting).
- Two 1kΩ (pull-down resistors for inputs).
- Jumper wires.
Circuit Design
We’ll use one of the four AND gates (e.g., pins 1, 2, and 3) to keep it simple.
- Power the Chip:
- Connect Pin 14 (VCC) to +5V.
- Connect Pin 7 (GND) to ground (0V).
- Set Up Inputs with Buttons:
- Input A (Pin 1):
- Connect a 1kΩ resistor from Pin 1 to ground (pull-down, ensures LOW when button is not pressed).
- Connect a push button from Pin 1 to +5V (when pressed, Pin 1 goes HIGH).
- Input B (Pin 2):
- Connect a 1kΩ resistor from Pin 2 to ground (pull-down).
- Connect a push button from Pin 2 to +5V (when pressed, Pin 2 goes HIGH).
- Input A (Pin 1):
- Set Up Output with LED:
- Connect Pin 3 (output Y1) to the anode (longer leg) of the LED.
- Connect the cathode (shorter leg) of the LED to ground through a 220Ω resistor (limits current to ~10-15mA at 5V).
- Unused Gates:
- Tie unused inputs (pins 4, 5, 9, 10, 12, 13) to ground or VCC to prevent floating states, which can cause erratic behavior in TTL chips.
How to Demonstrate
- Power On: Apply 5V to the circuit. The LED should be OFF initially (both inputs LOW).
- Test Input Combinations:
- No buttons pressed: A = 0, B = 0 → LED OFF (0 AND 0 = 0).
- Press Button 1 only: A = 1, B = 0 → LED OFF (1 AND 0 = 0).
- Press Button 2 only: A = 0, B = 1 → LED OFF (0 AND 1 = 0).
- Press both Button 1 and Button 2: A = 1, B = 1 → LED ON (1 AND 1 = 1).
- Observe: The LED lights up only when both buttons are pressed, demonstrating the AND gate’s logic.
OR gate
A | B | Q |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
This is the OR gate symbol:
The 74LS32 has 4 OR gates:The demonstration of the OR gate is very similar to the AND gate. The design is identical, except for the AND gate now being an OR gate.
How to Demonstrate
- Power On: Apply 5V to the circuit. The LED should be OFF initially (both inputs LOW).
- Test Input Combinations:
- No buttons pressed:
- A = 0, B = 0 → LED OFF (0 OR 0 = 0).
- Press Button 1 only:
- A = 1, B = 0 → LED ON (1 OR 0 = 1).
- Press Button 2 only:
- A = 0, B = 1 → LED ON (0 OR 1 = 1).
- Press both Button 1 and Button 2:
- A = 1, B = 1 → LED ON (1 OR 1 = 1).
- Release Buttons: LED turns OFF when both buttons are released, returning to 0 OR 0 = 0.
Observation: The LED lights up whenever at least one button is pressed, demonstrating the OR gate’s logic: output is HIGH if any input is HIGH.
Two more, NAND and NOR
- Power On: Apply 5V to the circuit. The LED should be OFF initially (both inputs LOW).
- Test Input Combinations:
- No buttons pressed:
- A = 0, B = 0 → LED OFF (0 OR 0 = 0).
- Press Button 1 only:
- A = 1, B = 0 → LED ON (1 OR 0 = 1).
- Press Button 2 only:
- A = 0, B = 1 → LED ON (0 OR 1 = 1).
- Press both Button 1 and Button 2:
- A = 1, B = 1 → LED ON (1 OR 1 = 1).
- No buttons pressed:
- Release Buttons: LED turns OFF when both buttons are released, returning to 0 OR 0 = 0.
Observation: The LED lights up whenever at least one button is pressed, demonstrating the OR gate’s logic: output is HIGH if any input is HIGH.
Two more, NAND and NOR
NAND gate
Truth Table (2-input):A B Q 0 0 1 0 1 1 1 0 1 1 1 0
A | B | Q |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
This is the NAND gate symbol:
How to Demonstrate
- Power On: Apply 5V to the circuit. The LED should be ON initially (both inputs LOW → output HIGH).
- Test Input Combinations:
- No buttons pressed:
- A = 0, B = 0 → LED ON (NOT (0 AND 0) = 1).
- Press Button 1 only:
- A = 1, B = 0 → LED ON (NOT (1 AND 0) = 1).
- Press Button 2 only:
- A = 0, B = 1 → LED ON (NOT (0 AND 1) = 1).
- Press both Button 1 and Button 2:
- A = 1, B = 1 → LED OFF (NOT (1 AND 1) = 0).
- No buttons pressed:
- Release Buttons: LED turns ON again when both inputs return to LOW (0 NAND 0 = 1).
NOR gate
NOR Gate Functionality
A NOR gate (NOT OR) outputs a HIGH (1) signal only when all inputs are LOW (0); otherwise, it outputs LOW (0). It’s an OR gate followed by a NOT gate.
Truth Table (2-input):A B Q 0 0 1 0 1 0 1 0 0 1 1 0
A | B | Q |
---|---|---|
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 0 |
How to Demonstrate
- Power On: Apply 5V to the circuit. The LED should be ON initially (both inputs LOW → output HIGH).
- Test Input Combinations:
- No buttons pressed:
- A = 0, B = 0 → LED ON (NOT (0 OR 0) = 1).
- Press Button 1 only:
- A = 1, B = 0 → LED OFF (NOT (1 OR 0) = 0).
- Press Button 2 only:
- A = 0, B = 1 → LED OFF (NOT (0 OR 1) = 0).
- Press both Button 1 and Button 2:
- A = 1, B = 1 → LED OFF (NOT (1 OR 1) = 0).
- No buttons pressed:
- Release Buttons: LED turns ON again when both inputs return to LOW (0 NOR 0 = 1).
Observation: The LED is ON only when neither button is pressed, demonstrating the NOR gate’s logic: output is HIGH only when all inputs are LOW.
Summary
You could certainly dig deeper and investigate how basic gates are designed from transistors, and how transistors work, but this is as "low-level" as I will go.
Here is a summary of AND, OR, NAND and NOR
I am not sure yet why we need these gates and what role they will play in a computer. I was guided here by Grok trying to figure out a major part of a computer, namely a register. The explanation was based on D flip-flops, which in term was explained through an SR latch. So, I am moving on to the SR latch, which will hopefully make more sense now.