Why two states are enough
An analog circuit works with a voltage or current that changes continuously, like the needle of a meter. A digital circuit keeps only two states: logic 0, called LOW, and logic 1, called HIGH. A button is either pressed or not pressed, a sensor bit is either set or clear, and a counter sits at one step or the next. Coding information this way makes it easy to copy and compare, because a little electrical noise will not turn a clear LOW into a clear HIGH. This is why digital electronics is the basis of control panels and programmable controllers, not only of computers.
The basic gates and what they do
An AND gate gives 1 only when every input is 1. An OR gate gives 1 as soon as at least one input is 1. A NOT gate has a single input and reverses it. Adding an inverter after an AND gives NAND; adding one after an OR gives NOR. An XOR gate gives 1 when the inputs differ, which makes it useful for comparisons. In practice NAND and NOR are often preferred because a single integrated package can hold several of them, so one chip is enough for a whole function. Every gate also has a propagation delay: the output changes shortly after the input, and that delay sets the maximum speed of the circuit.
Reading a truth table and using Boolean rules
A truth table lists every possible input combination in one place, with the matching output. For two inputs there are four rows: 00, 01, 10 and 11. Read the table row by row and never skip one, because the missing row is usually the case that fails in hardware. Boolean algebra describes the same gates with symbols: a dot means AND, a plus means OR, and a bar over a letter means NOT. The basic identities are A times 0 equals 0, A times 1 equals A, A plus 0 equals A, A plus 1 equals 1, and A plus its own inverse equals 1. These rules let you shorten an expression before building it, which means fewer gates, less space and lower cost.
Voltage thresholds and combining gates
A logic level is not a single exact voltage but a range. Each logic family defines a maximum voltage accepted as LOW and a minimum voltage accepted as HIGH, with a gap between them where the state is uncertain. A 5 V TTL input, for example, treats a low value near zero as 0 and a sufficiently high value as 1. CMOS families use fractions of the supply voltage and draw very little current, while TTL draws more current but is less sensitive to static charge. Gates can be chained: the output of one becomes the input of the next, and the number of inputs a gate can drive is its fan-out. When that number is too small, a buffer is inserted to restore the signal.
Three mistakes to watch for
The first mistake is mixing up the HIGH and LOW thresholds. A voltage that is neither clearly low nor clearly high is uncertain, so you must check the limits of the logic family you actually use instead of assuming a fixed value. The second mistake is dropping a row while building a truth table. With n inputs you need 2 to the power of n rows; two inputs give four rows and three inputs give eight, whatever the gate looks like. The third mistake is forgetting the inverted output of a NAND gate. NAND is an AND followed by NOT, so its only zero occurs when all inputs are one. Writing the AND result first and inverting it as a separate step prevents this error.
A short practice routine
Take one page and work through a fixed sequence. First, write the truth table of a two-input AND gate by hand: four rows, then the same for OR, NOT and XOR. Next, add an inverter to the AND table and turn it into NAND, checking that every output is flipped. Then simplify three short Boolean expressions using the basic identities and draw the gates they require. Finally, look up the LOW and HIGH limits of one TTL and one CMOS device and compare them. Ten focused minutes repeated over several days fixes the rules far better than one long session.
Frequently asked questions
What is the difference between analog and digital electronics?
An analog signal varies smoothly over a range of values, while a digital circuit only works with two states called LOW and HIGH, written as logic 0 and logic 1. A button or a counter step is naturally described by those two states, which makes digital information easy to store and copy.
How many rows does a truth table with three inputs have?
It has eight rows, because the rule is 2 to the power of the number of inputs. For three inputs the combinations run from 000 to 111. Writing every row in order is the safest way to make sure none is missing.
Why does a NAND gate often replace an AND gate?
NAND is an AND gate followed by an inverter, so it produces the opposite output. Several NAND gates fit in one integrated package, and NAND can also be wired to build the other logic functions, which reduces the number of different chips needed.
Create a free account — save your progress
Save your notes