Introduction to Logic Circuits
Welcome to one of the most exciting parts of the Electronics elective! In this chapter, we are going to learn how electronic systems "think" and make decisions. Just like you might decide to carry an umbrella IF it is raining AND you are going outside, electronic circuits use Logic Gates to process information.
Logic circuits are the "brains" inside everything from your smartphone to a simple microwave oven. By the end of these notes, you will be able to read logic diagrams, build truth tables, and write the "math" behind these decisions using Boolean expressions.
1. Digital Signals: 0s and 1s
Before we dive into gates, remember that digital electronics only care about two states. We represent these states in a few ways:
- Logic 1: High voltage, ON, True, or YES.
- Logic 0: Low voltage (usually \(0V\)), OFF, False, or NO.
Analogy: Think of a light switch. It is either up (1) or down (0). There is no "in-between" state in basic logic!
2. The Basic Logic Gates
Logic gates are the building blocks of digital circuits. Each gate has a specific rule for how it handles inputs to produce an output.
A. The NOT Gate (The Inverter)
The NOT gate is the simplest gate. It has one input and one output. It simply "flips" the signal.
- The Rule: The output is always the opposite of the input.
- Boolean Expression: \(Y = \bar{A}\) (read as "Y equals NOT A").
B. The AND Gate
The AND gate needs all its inputs to be "High" to work.
- The Rule: The output is \(1\) ONLY if Input A AND Input B are both \(1\).
- Boolean Expression: \(Y = A \cdot B\) (the dot symbol looks like multiplication).
- Mnemonic: Think of a safety deposit box that requires two keys to open. You need Key A and Key B.
C. The OR Gate
The OR gate is more relaxed than the AND gate.
- The Rule: The output is \(1\) if Input A OR Input B (or both) are \(1\).
- Boolean Expression: \(Y = A + B\) (the plus symbol represents "OR").
- Mnemonic: Think of a doorbell system with a button at the front door and one at the back door. The bell rings if you press the front or the back button.
Quick Takeaway: If you see a dot (\(\cdot\)), think AND. If you see a plus (\(+\)), think OR. If you see a bar (\(\bar{A}\)), think NOT.
3. Truth Tables
A Truth Table is a handy chart that shows every possible combination of inputs and what the resulting output will be. It is the best way to double-check your work!
Truth Table for AND and OR Gates:
Input A | Input B | AND Output (\(A \cdot B\)) | OR Output (\(A + B\))
\(0\) | \(0\) | \(0\) | \(0\)
\(0\) | \(1\) | \(0\) | \(1\)
\(1\) | \(0\) | \(0\) | \(1\)
\(1\) | \(1\) | \(1\) | \(1\)
4. Combined Logic Gates (NAND, NOR, XOR)
In the Elective Module, we often use "inverted" gates. These are just basic gates with a NOT gate attached to the end (represented by a small circle or "bubble" at the output).
A. The NAND Gate (NOT + AND)
This is the opposite of an AND gate. Its output is \(0\) only when all inputs are \(1\).
- Boolean Expression: \(Y = \overline{A \cdot B}\)
B. The NOR Gate (NOT + OR)
This is the opposite of an OR gate. Its output is \(1\) only when all inputs are \(0\).
- Boolean Expression: \(Y = \overline{A + B}\)
C. The XOR Gate (Exclusive OR)
This gate is special. It likes inputs to be different.
- The Rule: The output is \(1\) if the inputs are different (\(0,1\) or \(1,0\)), but \(0\) if they are the same.
- Boolean Expression: \(Y = A \oplus B\)
5. Boolean Expressions and Circuit Analysis
Don't worry if these look like complicated math equations! Boolean algebra is just a shorthand way to describe a logic circuit. When you see a complex circuit, follow the signal from left to right, writing the expression at each gate.
Step-by-Step Example:
Imagine a circuit where Input \(A\) and Input \(B\) go into an AND gate, and the result goes into an OR gate along with Input \(C\).
- The output of the first gate (AND) is \(A \cdot B\).
- That result then goes into the OR gate with \(C\).
- The final Boolean expression is \(Y = (A \cdot B) + C\).
Common Mistake: Forgetting the "bar" over the whole expression in NAND or NOR gates. Remember, \(\bar{A} \cdot \bar{B}\) is NOT the same as \(\overline{A \cdot B}\)! The long bar means the "NOT" happens after the "AND".
6. Practical Considerations: CMOS and Transistors
In the HKDSE syllabus, you should know how these gates are actually made and used:
- CMOS (Complementary Metal-Oxide-Semiconductor): This is a very common family of logic ICs (Integrated Circuits). Why do we use it? Because CMOS circuits consume very little power and are great for battery-operated devices.
- Transistor as a Switch: Remember that inside those tiny logic gate chips, transistors are acting as electronic switches. When a transistor is "saturated" (fully ON), it represents Logic \(1\). When it is "cut-off" (fully OFF), it represents Logic \(0\).
7. Solving Logic Design Problems
When you are given a real-world problem (e.g., "An alarm should sound if the key is turned AND the door is opened"), follow these steps:
- Identify Inputs: Key turned (\(K\)), Door opened (\(D\)).
- Identify Output: Alarm (\(Y\)).
- Determine the Logic: The word "AND" tells you to use an AND gate.
- Write the Expression: \(Y = K \cdot D\).
- Draw the Truth Table: Ensure the Alarm is only \(1\) when both \(K\) and \(D\) are \(1\).
Chapter Summary (Key Takeaways)
- AND Gate: All inputs must be \(1\) for a \(1\) output (\(A \cdot B\)).
- OR Gate: Any input can be \(1\) for a \(1\) output (\(A + B\)).
- NOT Gate: Inverts the signal (\(\bar{A}\)).
- NAND/NOR: Inverted versions of AND/OR (look for the "bubble" on the symbol).
- Truth Tables: Use them to map all possible Input/Output combinations.
- CMOS: The standard logic family known for low power consumption.
Keep practicing drawing the symbols and truth tables! Once you master the basic rules, you can solve even the most complex looking logic puzzles.