Physics (5054)
Topic 17 of 25Cambridge O Levels

Digital Electronics (Logic Gates)

Explore the building blocks of digital circuits and how they process binary information.

### Introduction to Digital Electronics


In the world of electronics, we encounter two primary types of signals: analogue and digital. An analogue signal is continuous and can have an infinite number of values within a range, like the sound waves from a human voice or the dimming of a light bulb. In contrast, a digital signal is discrete, meaning it can only have specific, separate values. In the context of this topic, we focus on binary digital signals, which have only two possible states: HIGH (represented by the number 1) or LOW (represented by the number 0). These two states can also be described as 'ON' or 'OFF', or 'True' or 'False'. All modern computing, from smartphones to supercomputers, is built upon the simple yet powerful principle of processing these binary ones and zeros.


### What are Logic Gates?


Logic gates are the fundamental building blocks of digital circuits. They are simple electronic circuits that take one or more binary inputs and produce a single binary output. The output of a logic gate is determined by a specific logical rule or function. By combining these gates in various configurations, we can build complex circuits that perform calculations, store data, and make decisions. We will study five fundamental logic gates: NOT, AND, OR, NAND, and NOR.


### Basic Logic Gates


1. The NOT Gate (Inverter)


The NOT gate is the simplest type of logic gate. It has only one input and one output. Its function is to invert the input signal. If the input is HIGH (1), the output will be LOW (0), and if the input is LOW (0), the output will be HIGH (1).


* Symbol: A triangle pointing to the right, with a small circle (a 'bubble') at its tip where the output line is drawn.

* Boolean Expression: The logical operation is written as Q = NOT A or Q = Ā.

* Truth Table: A truth table is a table that shows the output of a logic gate for every possible combination of inputs.


| Input A | Output Q |

|:-------:|:--------:|

| 0 | 1 |

| 1 | 0 |


2. The AND Gate


The AND gate typically has two or more inputs and one output. The output of an AND gate is HIGH (1) only if all of its inputs are HIGH (1). If any input is LOW (0), the output will be LOW (0).


* Symbol: A shape resembling the letter 'D'.

* Boolean Expression: Q = A AND B or Q = A · B.

* Truth Table (for 2 inputs):


| Input A | Input B | Output Q |

|:-------:|:-------:|:--------:|

| 0 | 0 | 0 |

| 0 | 1 | 0 |

| 1 | 0 | 0 |

| 1 | 1 | 1 |


3. The OR Gate


The OR gate also has two or more inputs and one output. The output of an OR gate is HIGH (1) if at least one of its inputs is HIGH (1). The output is LOW (0) only when all inputs are LOW (0).


* Symbol: A curved, shield-like shape with a pointed tip on the output side.

* Boolean Expression: Q = A OR B or Q = A + B.

* Truth Table (for 2 inputs):


| Input A | Input B | Output Q |

|:-------:|:-------:|:--------:|

| 0 | 0 | 0 |

| 0 | 1 | 1 |

| 1 | 0 | 1 |

| 1 | 1 | 1 |


### Combination (Universal) Logic Gates


4. The NAND Gate (NOT-AND)


A NAND gate is a combination of an AND gate followed by a NOT gate. Its output is the opposite of an AND gate. The output is LOW (0) only when all inputs are HIGH (1). In all other cases, the output is HIGH (1).


* Symbol: The same 'D' shape as an AND gate, but with a small circle at the output.

* Boolean Expression: Q = A NAND B or Q = A · B.

* Truth Table (for 2 inputs):


| Input A | Input B | Output Q |

|:-------:|:-------:|:--------:|

| 0 | 0 | 1 |

| 0 | 1 | 1 |

| 1 | 0 | 1 |

| 1 | 1 | 0 |


5. The NOR Gate (NOT-OR)


A NOR gate is a combination of an OR gate followed by a NOT gate. Its output is the opposite of an OR gate. The output is HIGH (1) only when all its inputs are LOW (0).


* Symbol: The same curved shape as an OR gate, but with a small circle at the output.

* Boolean Expression: Q = A NOR B or Q = A + B.

* Truth Table (for 2 inputs):


| Input A | Input B | Output Q |

|:-------:|:-------:|:--------:|

| 0 | 0 | 1 |

| 0 | 1 | 0 |

| 1 | 0 | 0 |

| 1 | 1 | 0 |


These five gates form the foundation of all digital logic. By connecting them together, engineers create the complex microchips found in every digital device, enabling them to perform tasks ranging from simple arithmetic to running complex software.

Key Points to Remember

  • 1Digital electronics use **binary** signals, representing data as one of two states: 1 (HIGH) or 0 (LOW).
  • 2A **logic gate** is a basic electronic circuit that performs a logical operation on binary inputs to produce a single binary output.
  • 3A **truth table** systematically lists all possible input combinations for a gate and shows the corresponding output for each.
  • 4The **NOT** gate has one input and inverts it (0 becomes 1, 1 becomes 0).
  • 5The **AND** gate's output is 1 only if all its inputs are 1.
  • 6The **OR** gate's output is 1 if one or more of its inputs is 1.
  • 7**NAND** (NOT-AND) and **NOR** (NOT-OR) gates are inverted versions of the AND and OR gates, respectively.
  • 8Logic gates are the fundamental building blocks of integrated circuits, microprocessors, and all modern digital devices.

Pakistan Example

Logic Gates in Uninterruptible Power Supplies (UPS)

In many homes and offices across Pakistan, a UPS is essential due to frequent power outages ('load-shedding'). A simple logic circuit within a UPS decides when to switch from mains power (WAPDA) to battery power. An **AND gate** can be used for this. **Input A** can represent the mains power status (1 = available, 0 = unavailable). **Input B** can be a switch that indicates the UPS is turned on (1 = ON, 0 = OFF). The circuit to charge the battery (Output Q) will only be active (Q=1) when mains power is available **AND** the UPS is switched on. This simple logic ensures the battery doesn't try to charge when there is no electricity, demonstrating a practical, everyday application of logic gates in the Pakistani context.

Quick Revision Infographic

Physics — Quick Revision

Digital Electronics (Logic Gates)

Key Concepts

1Digital electronics use **binary** signals, representing data as one of two states: 1 (HIGH) or 0 (LOW).
2A **logic gate** is a basic electronic circuit that performs a logical operation on binary inputs to produce a single binary output.
3A **truth table** systematically lists all possible input combinations for a gate and shows the corresponding output for each.
4The **NOT** gate has one input and inverts it (0 becomes 1, 1 becomes 0).
5The **AND** gate's output is 1 only if all its inputs are 1.
6The **OR** gate's output is 1 if one or more of its inputs is 1.
Pakistan Example

Logic Gates in Uninterruptible Power Supplies (UPS)

In many homes and offices across Pakistan, a UPS is essential due to frequent power outages ('load-shedding'). A simple logic circuit within a UPS decides when to switch from mains power (WAPDA) to battery power. An **AND gate** can be used for this. **Input A** can represent the mains power status (1 = available, 0 = unavailable). **Input B** can be a switch that indicates the UPS is turned on (1 = ON, 0 = OFF). The circuit to charge the battery (Output Q) will only be active (Q=1) when mains power is available **AND** the UPS is switched on. This simple logic ensures the battery doesn't try to charge when there is no electricity, demonstrating a practical, everyday application of logic gates in the Pakistani context.

SeekhoAsaan.com — Free RevisionDigital Electronics (Logic Gates) Infographic

Test Your Knowledge!

5 questions to test your understanding.

Start Quiz