By the end of this chapter, you will be able to:
Mastering these skills will help you design and troubleshoot digital circuits confidently, a key ability in many technical fields.
Compiled by: Elijah Kiprono
Logic gates form the foundational building blocks of digital circuits, enabling ICT technicians to design and troubleshoot hardware systems such as microprocessors, memory devices, and communication equipment. Understanding how to identify and apply logic gates is essential for professionals working in Kenya’s ICT sector, especially in environments like telecommunications firms, banks, and educational institutions where digital systems are pervasive. This chapter focuses on recognizing the various logic gates and mastering the terminology associated with their function.
A logic gate is the smallest building block of a digital circuit. Every processor, memory chip, network card and embedded controller that an ICT technician repairs or configures is built from millions of them, and a fault in a router, a power supply controller or a phone charging circuit can sometimes be traced to one failed gate. This topic defines the terms used with gates and describes the seven standard gates, so that a technician can recognise each one on a circuit diagram and predict what it will do.
A logic gate takes one or more binary inputs and produces a single binary output according to a fixed logical rule. The terms below are used throughout the study of gates, Boolean algebra and digital circuits.
A logic gate is an electronic circuit, built from transistors, that implements one logical operation. Most gates have two inputs and one output, but the NOT gate has one input and some gates have three, four or eight inputs. Gates are sold in integrated circuits (ICs) that hold several identical gates in one package.
A Boolean variable is a variable that takes only two possible values: 0 (false) or 1 (true). In a circuit these values stand for the two states of a signal, such as OFF and ON or LOW and HIGH voltage. Example: the signal from a push button on a test jig is a Boolean variable, 1 while the button is pressed and 0 when it is released.
A logic level is the range of voltage that a circuit reads as logic 0 or logic 1. In a 5 V TTL circuit, an input below about 0.8 V is read as logic 0 and an input above about 2.0 V is read as logic 1, while the region between is undefined and must be avoided. Many microcontroller boards use 3.3 V logic, so a technician must check that two connected circuits use compatible levels before joining them.
The inputs are the signals applied to a gate and the output is the signal it produces. The output depends only on the present values of the inputs, apart from a very short delay. Example: a gate with two inputs has four possible input combinations, and its output for each combination is fixed by the type of gate.
A logical operation is a rule that combines input values to give an output value. AND, OR and NOT are the basic operations, and each gate implements one of them or a combination of them. The operation is written with symbols in a Boolean expression: A · B for AND, A + B for OR and A' for NOT A.
A truth table lists every possible combination of input values together with the output of the gate for each combination. A gate with n inputs has 2ⁿ rows. Truth tables are the standard way to describe a gate or a circuit exactly, and they are used throughout the topics on Boolean algebra that follow.
A gate symbol is the standard drawing used for a gate in a circuit diagram. Each gate has its own shape: AND has a flat back and a rounded front, OR has a curved back and a pointed front, and NOT is a triangle with a bubble at its point. A small circle (bubble) at the output means that the output is inverted, so NAND, NOR and XNOR are drawn as AND, OR and XOR with a bubble. Reading symbols correctly is the first skill in tracing a circuit.
Seven gates are used in digital electronics: AND, OR, NOT, NAND, NOR, XOR and XNOR. Each performs one logical function, and together they are enough to build any digital circuit. The table compares them for two inputs A and B.
| Gate | Expression | Output is 1 when |
|---|---|---|
| AND | A · B | both inputs are 1 |
| OR | A + B | at least one input is 1 |
| NOT | A' | the input is 0 |
| NAND | (A · B)' | at least one input is 0 |
| NOR | (A + B)' | both inputs are 0 |
| XOR | A ⊕ B | the inputs differ |
| XNOR | (A ⊕ B)' | the inputs are the same |
The AND gate outputs 1 only when all of its inputs are 1; otherwise it outputs 0. It is used wherever several conditions must be true together before an action happens. Example: the charging lamp of a laptop test bench lights only when the charger is connected (A) and the battery is below full charge (B).
| A | B | A · B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
A three-input AND gate has eight input rows and gives 1 only on the row where A, B and C are all 1.
The OR gate outputs 1 when at least one input is 1 and outputs 0 only when all inputs are 0. It is used where any one of several conditions should trigger an action. Example: the warning lamp on a server cabinet lights when the temperature sensor (A) or the fan failure sensor (B) is active.
| A | B | A + B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
The NOT gate, also called an inverter, has one input and outputs the opposite value: 0 becomes 1 and 1 becomes 0. It is used to reverse a signal, for example to turn an active-low enable pin of a memory chip into an active-high control signal.
| A | A' |
|---|---|
| 0 | 1 |
| 1 | 0 |
The NAND gate is an AND gate followed by a NOT gate, so it outputs 0 only when all inputs are 1 and outputs 1 otherwise. It is a universal gate: any other gate can be built from NAND gates alone, which is why one IC of NAND gates can serve a whole circuit. Joining both inputs of a NAND gate together makes a NOT gate.
| A | B | (A · B)' |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
The NOR gate is an OR gate followed by a NOT gate, so it outputs 1 only when all inputs are 0 and outputs 0 otherwise. Like NAND it is a universal gate. Two NOR gates cross-connected form a basic memory cell, which is how some stored bits are held in a digital circuit.
| A | B | (A + B)' |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
The XOR (exclusive OR) gate outputs 1 when its inputs differ. For more than two inputs it outputs 1 when the number of inputs at 1 is odd. It is used in the sum bit of binary adders and in parity checking, where a change in one bit of a data word flips the parity.
| A | B | A ⊕ B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
The XNOR (exclusive NOR) gate is the complement of XOR: it outputs 1 when its inputs are the same. It is used as an equality checker. Example: four XNOR gates compare two 4-bit values bit by bit, and when all four outputs are 1 the two values are identical, which a 4-input AND gate on the four outputs can signal as a single line.
| A | B | (A ⊕ B)' |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
AND Gate Example:
A technician at Kenya Commercial Bank is troubleshooting a circuit with an AND gate. Inputs: A = 1 (door sensor triggered), B = 0 (window sensor not triggered).
Formula: \(Y = A \cdot B\)
Substitute:$$Y = 1 \cdot 0$$ Calculate:$$Y = 0$$ Answer: Output logic level is 0 (LOW).
OR Gate Example:
At Safaricom's Nairobi data center, an OR gate is used to monitor two network lines. Inputs: A = 0 (line 1 down), B = 1 (line 2 up).
Formula: \(Y = A + B\)
Substitute:$$Y = 0 + 1$$ Calculate:$$Y = 1$$ Answer: Output logic level is 1 (HIGH).
NOT Gate Example:
A NOT gate in a KRA digital form validation system receives input A = 0.
Formula: \(Y = \overline{A}\)
Substitute:$$Y = \overline{0}$$ Calculate:$$Y = 1$$ Answer: Output logic level is 1 (HIGH).
NAND Gate Example:
A NAND gate is used in KenGen's memory device design. Inputs: A = 1, B = 1.
Formula: \(Y = \overline{A \cdot B}\)
Substitute:$$Y = \overline{1 \cdot 1}$$ Calculate:$$Y = \overline{1} = 0$$ Answer: Output logic level is 0 (LOW).
NOR Gate Example:
A NOR gate in a Nairobi university lab receives inputs A = 0, B = 0.
Formula: \(Y = \overline{A + B}\)
Substitute:$$Y = \overline{0 + 0}$$ Calculate:$$Y = \overline{0} = 1$$ Answer: Output logic level is 1 (HIGH).
XOR Gate Example:
Safaricom uses XOR gates for error detection. Inputs: A = 1, B = 0.
Formula: \(Y = A \oplus B\)
Substitute:$$Y = 1 \oplus 0 = 1$$ Answer: Output logic level is 1 (HIGH).
XNOR Gate Example:
In a KRA digital form validation system, an XNOR gate receives inputs A = 1, B = 1.
Formula: \(Y = \overline{A \oplus B}\)
Substitute:$$Y = \overline{1 \oplus 1} = \overline{0} = 1$$ Answer: Output logic level is 1 (HIGH).
Given a logic gate with two inputs A and B, where the output is 1 only when both inputs are 1, identify the type of gate. (2 marks)
Draw the truth table for a NOR gate with two inputs. (3 marks)
If an XOR gate has inputs A=1 and B=0, what is the output? Show the truth table for all input combinations. (4 marks)
Explain why NAND gates are considered universal gates and how many NAND gates are needed to create a NOT gate. (5 marks)
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter began by identifying various logic gates and defining key terms related to their operation. It covered the main types of logic gates including AND, OR, NOT, NAND, NOR, XOR, and XNOR, explaining their individual functions. The application of Boolean algebra was then explored through logic expressions, circuit diagrams, and truth tables, supported by the fundamental laws of Boolean algebra and De Morgan's theorems. Karnaugh maps were introduced as a method to simplify logic expressions effectively. The chapter concluded by demonstrating how logic gates are applied in practical contexts such as computer processors, digital signal processing, memory devices, and systems for error detection and correction. Through this progression, the chapter provided a comprehensive understanding of both the theory and practical use of logic gates in digital electronics.
A digital circuit uses an AND gate with two inputs, each at logic level 1 (HIGH). Calculate the output logic level. (1 mark)
An OR gate has inputs A = 0 and B = 1. Determine the output of the gate. (1 mark)
In a Kisumu-based ICT repair workshop, a technician uses an AND gate to control a security alarm system that activates only when both the door sensor and window sensor are triggered. If the door sensor outputs 1 and the window sensor outputs 0, what is the output of the AND gate? (4 marks)
Draw the truth table for a NOR gate used in a digital signal processing circuit at a Nairobi university lab. (4 marks)
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.