Learn
10. 0 | LOGIC SYMBOLS AND FUNCTIONS
01 | A DECISION WITH TWO POSSIBLE STATES
A security light needs a clear decision: switch on or stay off. Its inputs might say whether movement is detected and whether it is dark. Each input has two possible states.
Boolean data has two values, TRUE and FALSE. In logic tables, 1 represents TRUE and 0 represents FALSE. A 1 does not necessarily mean “good” or “safe”: its meaning comes from the input definition. If A means DoorOpen, A = 1 means the door is open.
A logic gate applies a fixed Boolean rule to its inputs and produces a Boolean output. The gates here are NOT, AND, OR, NAND, NOR and XOR. XOR is also called EOR, exclusive OR.
02 | READ THE SYMBOL BEFORE THE RULE
Letters such as A and B label inputs; X labels the output. They are names for signals, not fixed values. A can be 0 in one case and 1 in another.
Read the standard symbols from left to right. Lines carry signals into the gate, and the line leaving it carries the result. NOT has one input. The other gates in this syllabus use two inputs.
The small circle at an output means inversion: reverse the Boolean result. The extra curved line on the input side distinguishes XOR from OR. Learn the shapes as well as the written gate names.
03 | NOT REVERSES ONE INPUT
NOT has one input and produces the opposite value. If A = 0, X = 1; if A = 1, X = 0. It does not need a second input.
If A means DoorOpen, X = NOT A means “the door is not open”. This reverses the proposition, rather than changing the physical door.
| A | X = NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
04 | AND REQUIRES BOTH INPUTS
AND produces 1 only when both inputs are 1. One true input is insufficient.
Let A mean MovementDetected and B mean Dark. A light controlled by X = A AND B switches on only when movement is detected and it is dark. Movement in daylight gives 1 AND 0, so the output is 0.
| A | B | X = A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
05 | OR ACCEPTS EITHER OR BOTH
OR produces 1 if at least one input is 1. Both inputs being 1 also gives 1. This is inclusive OR.
Let A mean SmokeDetected and B mean HeatDetected. An alarm using A OR B sounds when either sensor detects danger, including when both do. It is off only when neither does.
| A | B | X = A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
06 | XOR REQUIRES EXACTLY ONE
XOR gives 1 when exactly one input is 1. It gives 0 when both inputs are the same. Unlike OR, two true inputs do not give a true output.
If A and B represent two alternative options, XOR can test that exactly one has been selected. Neither selected and both selected fail this rule.
| A | B | X = A XOR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
07 | NAND IS NOT AND
NAND reverses the result of AND. Work out A AND B first, then invert it. NAND gives 0 only when both inputs are 1, and gives 1 for the other three combinations.
The symbol is an AND shape with a small output circle. In X = NOT (A AND B), the parentheses make clear that the combined result is inverted.
| A | B | A AND B | X = NOT (A AND B) |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
08 | NOR IS NOT OR
NOR reverses the result of OR. It gives 1 only when both inputs are 0. If either input is 1, the OR result is 1 and its inversion is 0.
Let A mean AlarmActive and B mean MaintenanceActive. NOR can indicate that neither condition is active. The symbol is an OR shape with an output circle.
| A | B | A OR B | X = NOT (A OR B) |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 |
09 | BUILD A TRUTH TABLE SYSTEMATICALLY
A truth table lists every possible input combination and the output for each. One input has two combinations. Two inputs have four. In general, n binary inputs have 2 to the power n combinations.
For two inputs, use 00, 01, 10 and 11 so no case is missed. Apply the gate’s rule independently to each row. The table is not a sequence in which values accumulate: each row is a separate possible situation.
For three inputs, the combinations run 000 through 111, giving eight rows. The next lesson uses intermediate columns to follow several connected gates.
10 | COMPARE ALL FIVE TWO-INPUT GATES
Check the last row to separate OR from XOR: both true gives OR = 1 but XOR = 0. Check paired columns to see inversion: AND and NAND always differ; OR and NOR always differ.
| A | B | AND | OR | XOR | NAND | NOR |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
11 | TRY THE INPUTS YOURSELF
Choose a gate and its inputs. Predict the output before running the tester. The matching truth-table row is highlighted so you can connect the rule to the result. For NOT, only A is used.
12 | TRANSLATE WORDS INTO A GATE
“Both” usually points to AND. “At least one” points to OR. “Exactly one” points to XOR. “Neither” points to NOR. “Not both” points to NAND, while reversing one condition uses NOT.
Define the inputs first. If A means DoorClosed rather than DoorOpen, the expression needed for a given situation may change. A gate name alone does not explain a real-world system without knowing what its signals represent.
For an enable output requiring PowerAvailable and GuardClosed, AND is appropriate. A true enable condition is a Boolean model of the rule, not a claim that a real machine has every safety requirement covered.
13 | LOGIC IS NOT ORDINARY ARITHMETIC
A gate applies a truth rule. OR with inputs 1 and 1 produces one Boolean output, 1; it does not produce the arithmetic sum 2. XOR with the same inputs produces 0 because exactly one is not true.
NAND does not mean “invert A only, then AND B”. NOT (A AND B) reverses the completed conjunction. Inverting a combined result and inverting a single input are different operations.
When explaining, state the rule and apply the values: “Both inputs are 1, therefore AND outputs 1; NAND reverses that result, so its output is 0.”