What Are Digital Circuits & How Do They Work?
Digital circuits are found everywhere in the new world; they are the basis technology for every almost every electronic device in existence. Without digital circuits, this article couldn’t have been written and no reliable computers would exist, so what are they?
Digital circuits are electronic circuits in which every wire can only be one of two states: HIGH (1) or LOW (0). A wire that has current flowing through it is a HIGH wire and can be represented by a 1, and a wire that doesn’t have current flowing through it is LOW and represented by a 0. That’s it, only two states. This is different from an analogue circuit which can have an infinite number of states between two voltage levels, for example, an analogue circuit powered by a 15 volt (V) battery may have any output ranging from 0V to 15V (e.g. 7.528V). If the same power supply was connected to a digital circuit, the output could only be 0V (LOW) or 15V (HIGH), no in-between.
So what makes digital circuits so useful? The transistor. The transistor is like an electrical switch, and we can use them to perform logical operations that enabled the creation of modern computers and microcontrollers. Take a common type of transistor: the MOSFET
In a MOSFET, current can flow from the Drain to the Source only when a voltage is applied to the Gate. This may seem like a simple function, but by using transistors like these, you can build logic gates. Logic gates are the basis for all useful digital circuits.
Before I continue, you should know that transistors are made of semiconductors. Semiconductors conduct electricity under the right conditions, so by sandwiching different types of semiconductors together in precise dimensions you can create a transistor. Every iPhone 15 Pro has approximately 19 billion transistors and Intel manufactures over 150,000,000,000,000,000 transistors per year alone. Modern transistors can be as small as 5 nano-metres in width (that’s 1/20,000 the width of a human hair!).
Logic Gates
Logic gates are made up of transistors and perform basic logical operations on inputs. For instance, take an ‘AND’ gate and its truth table:
As can be deduced from the truth table, an AND gate will only output a 1 (HIGH signal) if both inputs are 1. This is what an AND gate looks like in a digital circuit:
Here are all the other types of logic gates:
A ‘yes’ gate (also known as a buffer) doesn’t perform any useful logic operations, but can be useful in other ways. All the other types of gates can be connected to perform more complex (and useful) functions. For example, you can create a 4-bit adder as shown here:
This circuit can add two 4-bit numbers together, if you don’t know what a 4-bit number is, continue reading. It should also be noted that any digital circuit can be made using only NAND or only NOR gates (either of these types of gates can be connected in configurations which are equivalent to every other type of gate), which can save on manufacturing costs.
The Binary Number System
Since digital circuits only work in 0’s and 1’s, they use a unique number system called the binary or base-2 system. Since you’re reading this article, chances are you use the decimal number system, meaning you count from 0 to 9 (10 digits) before adding more digits to represent larger numbers. It is a widely accepted fact that we count in decimal or base-10 because we have 10 fingers to count with. We haven’t always used this system though, the Babylonians used a base-60 number system, meaning they had to memorise 60 unique symbols to count before getting into the double-digits! When using the binary system, we only have 2 symbols to count with, so we need to add a digit at intervals of 2^n where n is a whole number (2, 4, 8, 16, 32, etc.) as opposed to intervals of 10^n in the decimal system (10, 100, 1000, etc.).
This also means that you can represent 2^n numbers with n number of wires. For example, if we have one wire we can represent a 0 or a 1 (current or no current); if we have two wires we can represent a 00, 01, 10, or 11, i.e. any number from 1–4 in the decimal system; if we have 3 wires we can represent any number from 1–8; if we have 10 wires we can represent any number up to 1024 (2¹⁰).
Storing Data
When we store values in digital circuits, we can only store single bits, where a bit is a 1-digit binary number (i.e. a 0 or a 1). A common way to store bits of data is by using a flip-flop. A flip-flop is a digital circuit itself where feedback allows state (a bit) to be stored and changed so long as the circuit is powered. This is the schematic of a flip-flop:
In this flip-flop, you can set state (0 or 1) using the J and K input lines and then retrieve the state at any later time by reading the Q output (the Q with the bar over it is just the inverse of Q and CLK is the clock signal). By connecting n number of these flip-flops together in parallel you can store any value up to 2^n as explained in the previous section.
Bits can be stored in other ways, for example, in computers flip-flops are used for memory that needs to be accessed and changed quickly, whereas for longer-term memory bits may be stored as electrical charge (or lack thereof) on a capacitor.
That’s pretty much it for the basics. Digital circuits are fundamentally made up of the transistors and wires arranged in the aforementioned configurations. Every digital circuit from the electronics inside a tacky musical birthday card to the processors of the most powerful supercomputers are just stupendous amounts of connected logic gates at the core, and this is why semiconductors are so important to every modern aspect of our world.