Electronics Engineering / Illustrated Learning Guide
Digital Electronics Logic Gates, Binary Circuits & Examples
Digital electronics uses defined logic states—usually 0 and 1—to process, store, and control information. Learn how binary signals become logic gates, combinational circuits, registers, counters, and the digital systems inside real devices.
Original diagrams · Worked examples · Binary & flip-flop demos
01 / Start with the big picture
What Is Digital Electronics?
Digital electronics is the branch of electrical engineering that represents, processes, and stores information using discrete logic states. Most digital logic is binary: its signals are interpreted as LOW (0) or HIGH (1).
Although digital logic is described with zeros and ones, real wires still carry continuous voltages. A receiving device decides whether the measured voltage is LOW or HIGH based on its specified input thresholds; an intermediate voltage may be undefined. A high voltage is not universally 5 V—it depends on the device, supply, and logic family.
Analog signal
Information is carried by a changing magnitude, such as a sensor voltage.
Digital signal
Circuits interpret the signal as defined states for logic and storage.
02 / Represent information
Binary Numbers, Bits, Bytes and Logic Levels
A bit can hold one of two values. Groups of bits represent numbers, characters, addresses, machine instructions, and control states.
How to read a binary number
Each binary digit is weighted by a power of two, from right to left. For example, 00001101₂ = 13₁₀ because 8 + 4 + 1 = 13. Eight bits make a byte and can encode 256 distinct patterns.
Unsigned 8-bit values run from 0 to 255. Interpreted as signed two’s complement, the same eight bits can represent −128 through +127. For signed 8-bit values, subtract 256 from an unsigned result of 128 or greater (for example, 11111111₂ represents 255 unsigned or −1 signed).
Toggle a bit or enter a decimal number (0–255).
What makes a logic 0 or 1?
Digital inputs have voltage thresholds. For example, a traditional 5 V TTL-compatible input commonly recognizes ≤0.8 V as LOW and ≥2.0 V as HIGH; the gap is not a guaranteed valid state. These numbers do not apply to all CMOS, microcontrollers, or logic families. Always read the device’s VIL, VIH, VOL, and VOH specifications.
0 to 0.8 VUndefined
0.8 to 2.0 VHIGH
2.0 to 5 V
03 / Change the inputs yourself
Interactive Logic Gate Simulator
Choose a logic gate, set A and B to 0 or 1, then watch the output and corresponding truth-table row. A truth table lists every possible input combination.
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Both inputs must be HIGH to produce a HIGH output.
Ideal two-input logic: real gates have propagation delay and specified voltage thresholds. NOT uses only input A.
04 / Learn the building blocks
7 Logic Gates: Symbols, Boolean Expressions and Truth Tables
Logic gates implement basic Boolean operations. The small circle on a symbol indicates inversion; XOR’s input side has an extra curved line. The drawings below are schematic illustrations, not component pinouts.
Rule: 1 only when both inputs are 1.
Example: Two conditions must both be satisfied.
Rule: 1 when either input (or both) is 1.
Example: Either of two requests can activate an output.
Rule: Inverts a single input.
Example: An active-low enable or opposite state.
Rule: 0 only when both inputs are 1.
Example: A universal gate used to build larger logic.
Rule: 1 only when both inputs are 0.
Example: A universal gate and simple inhibit logic.
Rule: 1 when inputs are different.
Example: Parity checks and the sum bit of an adder.
Rule: 1 when inputs match.
Example: Equality detection.
Complete truth table for common two-input gates
Read the inputs A and B from left to right. For NOT, B is irrelevant because the gate inverts A only.
On a phone, scroll the table sideways to see all seven gates.
| A | B | AND | OR | NOT A | NAND | NOR | XOR | XNOR |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |
05 / Turn logic into equations
Boolean Algebra and Simplifying Digital Circuits
Boolean algebra uses the same 0/1 logic as gates. Unlike ordinary addition, OR is written “+” and does not turn 1 + 1 into 2.
Both conditions are true.
At least one condition is true.
Invert the condition.
A NAND function can be expressed using OR and inverted inputs.
Simplify a gate network
Suppose a control output turns on when A and B are true or when A is true and B is false:
- Start: Y = A·B + A·¬B
- Factor A: Y = A·(B + ¬B)
- Use B + ¬B = 1: Y = A·1 = A
The entire network can be replaced by a direct connection from A to Y, subject to real-world drive and timing requirements. Simplifying logic reduces unnecessary gates and often improves clarity.
For larger problems: create a truth table, derive a sum-of-products expression, and use Boolean identities or a Karnaugh map (K-map) to reduce the logic. A truth table with three independent inputs has 2³ = 8 rows.
06 / Circuits without stored state
Combinational Logic: Adders, Multiplexers and Decoders
A combinational circuit’s output depends on its current inputs, apart from the finite time its gates take to respond. It does not intentionally store an earlier input as a state.
Half adder: add two bits
One XOR gate computes the sum; one AND gate computes the carry. Both share the same inputs.
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
2-to-1 multiplexer (MUX)
A multiplexer chooses which data input reaches its output. The select bit S decides whether D0 or D1 is passed.
For S = 0, Y = D0. For S = 1, Y = D1. Multiplexers route data within processors, measurement systems and communications hardware.
Converts a binary input into one of several selected outputs, such as a memory address or display line.
Determines whether binary values are equal or which is larger.
Adds two input bits and a carry-in, producing a sum and a carry-out.
MUX versus DEMUX: a multiplexer selects one of several data inputs for a single output. A demultiplexer does the reverse: it routes one data input to a selected output line. Decoders often generate the selection signals used in these circuits.
07 / Circuits with memory
Sequential Logic: Flip-Flops, Registers, Clocks and Counters
Sequential circuits combine logic with stored state. A register retains bits, a counter changes state on clock events, and a finite-state machine uses present inputs and stored state to select its next action.
A D flip-flop stores one bit
In the simplified positive-edge-triggered D flip-flop shown here, the output Q takes the value of D only when the clock has a rising edge. Changing D alone does not change Q. Real flip-flops also have setup and hold time requirements.
Toggle D, then press “Clock rising edge” to capture it into Q.
D is 1, but Q still holds 0 until the next rising edge.
- Initial state: Q = 0
A clock establishes when synchronous circuits may capture state. The period is T = 1/f; a 1 MHz clock has a 1 μs period.
D must be stable for specified intervals before and after the active clock edge. Violations can cause metastability or incorrect capture.
Logic and registers never switch instantly. Timing constraints determine the safe maximum clock rate.
Latches vs flip-flops: A level-sensitive latch can be transparent while its enable is active; an edge-triggered flip-flop updates on the selected clock edge. Registers typically group flip-flops; counters and state machines add logic to determine what to store next.
08 / Make the logic work in physical hardware
Digital Electronics Components and Real-World Design Limits
Truth tables describe the intended function, but real logic ICs must meet voltage, power, timing and interface requirements.
Logic ICs and CMOS
Integrated circuits combine transistor networks into logic gates. CMOS families differ in voltage range, switching speed, output drive and quiescent/dynamic power.
Microcontrollers and processors
ALUs, registers, memories and control units build on combinational and sequential logic; firmware provides higher-level behavior.
Memory and storage
Flip-flops store individual bits, while SRAM, DRAM and nonvolatile memories use specialized structures for larger capacities.
Programmable logic
FPGAs and related devices implement many logic functions and state machines in reconfigurable hardware.
On a phone, scroll the table sideways for practical solutions.
| Design concern | Why it matters | Practical response |
|---|---|---|
| Logic-level compatibility | A 5 V HIGH may exceed a 3.3 V input’s absolute maximum rating. | Verify VIH, VIL, voltage tolerance and level translation for each direction. |
| Floating inputs | Unconnected CMOS inputs can pick up noise and switch unpredictably. | Use appropriate pull-up or pull-down networks and configured input modes. |
| Mechanical switch bounce | One press can produce several fast transitions. | Debounce in hardware or software when single events are required. |
| Propagation delay and fan-out | Loads and gate delays can break timing assumptions. | Check datasheet delays, drive current, capacitive loading and timing budgets. |
| Clock-domain crossings | Asynchronous signals can violate a flip-flop’s timing window. | Use proper synchronizers or clock-domain crossing methods for the application. |
| Power integrity and decoupling | Switching currents cause supply ripple and ground noise. | Follow IC decoupling, grounding, routing and layout guidance. |
| Input protection | ESD, overvoltage or wiring faults can damage interface pins. | Use rated protection and respect absolute maximum ratings. |
09 / See where the concepts appear
Applications of Digital Electronics
Digital electronics is used whenever reliable switching, decision-making, counting, computation, storage or communication of data is required.
Computers and phones
Processors combine billions of transistors into arithmetic, logic, memory and control structures.
Embedded systems
Microcontrollers read digital inputs, maintain state and drive displays, relays and communication buses.
Industrial controls
Digital logic helps implement interlocks, counters, sequencing and monitoring.
Communications
Digital circuits encode, route, synchronize and recover transmitted information.
Test equipment
Logic analyzers, counters and digital oscilloscopes observe and process sampled signals.
Everyday devices
Appliances, alarms, automotive electronics and wearables coordinate sensor inputs and control outputs.
Analog and digital work together: a sensor may produce a continuous signal that is conditioned by an analog circuit, digitized by an ADC and processed with digital logic. A digital output may then control an analog driver or actuator.
10 / Know when digital is the right tool
Advantages and Limitations of Digital Electronics
Digital circuits are excellent at representing repeatable logic states and storing data, but a binary abstraction does not remove the limits of physical hardware.
Why digital electronics is useful
- Noise tolerance: valid LOW and HIGH ranges allow some voltage variation without changing the interpreted bit.
- Reliable storage and computation: registers and memory can preserve bit patterns; logic circuits can repeat the same operations.
- Scalability: integrated circuits combine enormous numbers of logic elements into compact processors and controllers.
- Testability: truth tables, simulation and timing measurements help designers verify behavior systematically.
Important limitations and tradeoffs
- Not noise-proof: undefined levels, interference, inadequate noise margins or slow edges can still cause errors.
- Timing matters: propagation delay, setup and hold requirements, and clock-domain crossings can break a logically correct design.
- Real-world measurements need analog circuits: sensors often require conditioning and an ADC; DACs or drivers may be needed at the output.
- Finite precision and switching cost: quantization limits resolution, while high-speed switching consumes power and can generate electromagnetic interference.
Bottom line: digital and analog electronics are complementary. A digital device still depends on analog voltage levels, physical timing, power integrity and interfaces to the outside world.
11 / Check your understanding
Practice Digital Electronics with Four Solved Questions
Try each question before opening its answer. These cover the exact concepts used in basic logic design and hardware troubleshooting.
01What is 1011₂ in decimal?
Answer: 11. The place values are 8, 4, 2 and 1. Add 8 + 0 + 2 + 1 = 11.
02What does XOR output when A = 1 and B = 1?
Answer: 0. XOR is HIGH only when its two inputs differ. If both are 1, they are equal.
03A half adder receives A = 1 and B = 1. What are Sum and Carry?
Answer: Sum = 0, Carry = 1. XOR gives 0; AND gives 1. The two input bits add to binary 10₂.
04A D flip-flop stores Q = 1. D changes to 0. What happens before and after a rising clock edge?
Answer: Q remains 1 before the edge. At the next valid rising edge, it captures D and becomes 0, assuming setup and hold timing is met.
12 / What to learn next
How to Learn Digital Electronics Step by Step
A sensible progression takes you from circuits and number systems to practical logic design rather than starting with microprocessor internals.
- Learn voltage, current and components.Understand resistors, transistors, power rails and how a real HIGH or LOW is measured. Basic Electronic Components
- Practice binary and logic gates.Convert small numbers, read truth tables and evaluate AND, OR, NOT, XOR and NAND.
- Work with Boolean algebra.Write expressions, verify them in truth tables and simplify them with identities or K-maps.
- Study combinational circuits.Build simple adders, multiplexers, decoders and comparators from gates.
- Add memory and timing.Learn flip-flops, clock edges, registers, counters and finite-state machines.
- Test real hardware.Simulate inputs, verify truth tables, measure logic levels and check timing, power and safety margins. Circuit Simulation
Common questions
Digital Electronics FAQ
What is digital electronics in simple words?
Digital electronics uses circuits that interpret signals as discrete states—typically 0 and 1—to make decisions, perform arithmetic, and store information. It includes logic gates, adders, flip-flops, counters, memories and microprocessors.
What is the difference between analog and digital electronics?
Analog circuits care about a signal’s continuously varying value and shape. Digital circuits interpret specified voltage ranges as logic states. The two are routinely used together—for example, in an analog sensor with a digital controller.
What are the seven basic logic gates?
AND, OR, NOT, NAND, NOR, XOR and XNOR are the seven gates commonly introduced in basic digital logic. Their outputs are defined by Boolean expressions and truth tables.
What is the difference between combinational and sequential logic?
A combinational output depends on the present inputs. A sequential circuit incorporates memory; its output can depend on both current inputs and a stored state from earlier clock events.
Does a digital 1 always equal 5 volts?
No. The actual logic HIGH and LOW thresholds depend on device technology, supply voltage and logic family. A signal that is valid for one device can be invalid or unsafe for another.
Can I learn digital electronics without programming?
Yes. Start with binary numbers, gates, Boolean algebra, truth tables and basic flip-flops. Programming becomes more important when you begin using microcontrollers, firmware and programmable hardware.
Technical references
Sources and Further Reading
The teaching examples use simplified Boolean and circuit models. For component-level design, validate input thresholds, output drive, clock timing and absolute ratings against the actual device datasheet.
- MIT OpenCourseWare — Computation StructuresA university-level progression from transistors and logic gates to combinational and sequential circuits, state machines and processors.
- SparkFun — Digital LogicCombinational versus sequential logic, gate behavior and Boolean expressions.
- SparkFun — Logic LevelsLogic thresholds, HIGH/LOW voltage ranges and interfacing devices.
- University of Colorado Boulder — Digital Electronics LabLogic gates, truth tables, clocks and flip-flops in a teaching laboratory.
- Texas Instruments — Logic GuideActual logic families, voltage standards and device selection considerations.