COMPUTER ORGANIZATION | LOGIC GATES
WHAT ARE LOGIC GATES?
Logic gates are the basic building blocks of digital circuits. They perform basic logical operations on one or more binary inputs and produce a single binary output. The purpose of logic gates is to implement Boolean logic, which is a form of algebra used to model the behavior of digital circuits.
Boolean logic defines two values, 0 and 1, to represent false and true, respectively. Logic gates use these values to perform operations such as AND, OR, NOT, NAND, NOR, and XOR. Each of these operations corresponds to a different logic gate, which implements the operation in hardware.
The outputs of logic gates can be used as inputs to other logic gates, allowing complex circuits to be built from simple components. This makes logic gates a fundamental component of modern computing, as they are used in a wide range of digital devices, from microcontrollers and embedded systems to computers and servers.
The purpose of logic gates is to perform basic logical operations on binary inputs and produce a binary output, which can be used to build complex digital circuits and implement Boolean logic.

WHAT IS A TRUTH TABLE?
A truth table is a table used in logic to represent the output of a logic gate or combination of logic gates for all possible combinations of inputs. The truth table lists all possible input combinations and the corresponding output of the logic gate for each combination. The output is typically represented using binary digits, where a 1 represents true or high voltage and a 0 represents false or low voltage. The truth table allows for easy evaluation of the logical function performed by the gate, as well as identifying any errors or inconsistencies in the gate's behavior. Truth tables are an important tool in designing and analyzing digital circuits.
WHAT IS IS A LOGIC EXPRESSION?
A logic expression is a mathematical representation of a logical function, typically defined using Boolean algebra. It represents the relationship between inputs and outputs in a logic circuit, and can be used to describe the behavior of a logic gate or a more complex digital system. Logic expressions can be written using logical operators such as AND, OR, and NOT, and variables that represent the input and output signals of the circuit. The expression is evaluated to determine the output of the circuit based on the input signals.
NOT GATE
The NOT gate is the only gate with just one input. The NOT gate simply reverses the input, if the input is ON then the OUTPUT is OFF, if the input is OFF then the output is on.
The image below illustrates a NOT gate, it is the circle that symbolizes the NOT and this circle is also used on other gates discussed later. Below is also the truth table for the NOT gate.
NOT GATE TRUTH TABLE

OR GATE
The OR gate will give an output value of ON if any of the inputs are ON. The OR gate can be viewed as the mathematical equivalent of addition.
OR GATE TRUTH TABLE

NOR GATE
The NOR Gate or NOT OR Gate will have an output if none of the inputs are 1. The NOR gate has a circle on the output to define the NOT part of the gate. You can see this as the opposite of an OR gate.
NOR GATE TRUTH TABLE


AND GATE
The AND gate will only give an output when both inputs are ON, in other works input one AND input two need to be ON to make the output ON.
AND GATE TRUTH TABLE

NAND GATE
The NAND Gate or NOT AND Gate will have an output when the two inputs are not ON. Or with a three input NAND gate when all 3 inputs are not ON.
NAND GATE TRUTH TABLE


XOR GATE
The XOR gate or eXclusive OR will only produce an output it the two inputs are different values.
XOR TRUTH TABLE

LOGIC CIRCUITS
Logic gates form the basis of how computers work and they are in most of the technology we use in our everyday lives. By combining logic gates we can create complex logic circuits to perform an unlimited number of tasks.
An example of how logic circuits are used can be found in a baby monitor, which uses logic gates to help alert parents when their baby is crying or needs attention. A logic circuit can be used in the monitor to turn on an alarm when either an audio sensor or a motion sensor are triggered and the monitor is currently switched on.
To create the logic circuit for this example, we can use an OR gate to combine the signals from the audio sensor and motion sensor, and an AND gate to ensure the alarm only works when it is actually switched on.
The logic circuit can be expressed as: X = (A OR B) AND C
Where:
-
A represents the signal from the audio sensor
-
B represents the signal from the motion sensor
-
C represents the signal from the switch
-
X represents the output signal that triggers the alarm
In this circuit, the OR gate outputs a high signal when both A or B inputs are high. This means that the alarm will be triggered when either the audio sensor or motion sensor detect activity.
The AND gate then combines this result with the switch signal, which allows the user to turn the monitor on and off. This means that the alarm will not be triggered if the switch is turned off, even if both the audio sensor and motion sensor detect activity.
By using logic gates to combine the signals from multiple sensors and a switch, we can create a circuit that triggers an alarm only when specific conditions are met, making the baby monitor more reliable and effective.
The truth table for the logic expression for the baby monitor would be as follows:
The logic circuit for the baby monitor would be as follows:
Remember to list binary in a logical order when completing your truth table. Listing binary in a logical order is important when completing truth tables because it helps to ensure that all possible combinations of inputs are considered and that the resulting outputs are accurate. In a truth table, the binary digits represent the possible combinations of input values for the logic circuit being analyzed.
By listing the binary in a logical order, such as in ascending or descending order, it makes it easier to identify all possible combinations of input values without missing any or repeating any. This ensures that the truth table is complete and accurate, which is essential for analyzing the behavior of the logic circuit.
Additionally, listing binary in a logical order helps to maintain consistency and clarity throughout the truth table, which makes it easier to read and interpret the results. It also helps to avoid errors or confusion when analyzing the circuit or designing a new circuit based on the truth table.