Binary and Boolean logic
Computers work with only two states, because a wire near 0 V and a wire near the supply are easy to tell apart even with noise. Watch a real chip's safe zones, then count in binary with switches and lamps (1011 is 8 + 2 + 1 = 11), meet bits and bytes, and finish with George Boole's true and false and the truth tables of NOT, AND and OR.
5 quick questions
Pick an answer to see why. Your score saves with your progress.
01A 74HC chip runs at 4.5 V. An input wire sits at 0.8 V with a little noise. What does the chip read?
Anything up to 1.35 V counts as 0, and 0.8 V plus a little noise stays well below that.
02What is the binary number 1011 in decimal?
The 1s sit in the places worth 8, 2 and 1: 8 + 2 + 1 = 11. The 4 place holds a 0.
03How many different patterns can one byte (8 bits) hold?
Each extra bit doubles the count, so 8 bits give 2⁸ = 256 patterns: the numbers 0 to 255.
04With 1 meaning true, what is 1 AND 0?
AND is true only when both inputs are true. One input is false, so the result is false: 0.
05Which statement about OR is right?
OR gives true if A is true, B is true, or both. Only false OR false gives false.
Glossary
- Bit
- Short for binary digit: a single 0 or 1. In a chip it is a wire near 0 V (0) or near the supply voltage (1).
- Byte
- A group of eight bits. It has 256 patterns, enough for the numbers 0 to 255.
- Binary
- Counting in base 2. Each place is worth double the one to its right: 1, 2, 4, 8, 16 and so on.
- Place value
- What a digit is worth because of where it sits. In binary the places are powers of two.
- Noise margin
- The spare room between what an output really gives and what an input needs, so small voltage wobbles never flip a bit.
- Boolean value
- A value that is only true or false, named after George Boole. Computers store it as 1 (true) or 0 (false).
- Truth table
- A list of every possible input and the result an operation gives for each one.
- NOT / AND / OR
- NOT flips a value; AND is true only if both inputs are true; OR is true if at least one input is true.
Notes and sources
- Logic levels are from Texas Instruments' SN74HC00 datasheet at a 4.5 V supply: an input must be at least 3.15 V to count as 1 and at most 1.35 V to count as 0, while a lightly loaded output gives at least 4.4 V for 1 and at most 0.1 V for 0. That leaves a 1.25 V noise margin on each side.
- Binary place values are powers of two: 2⁰ = 1, 2¹ = 2, 2² = 4, 2³ = 8, up to 2⁷ = 128 in a byte. n bits have 2ⁿ patterns, so a byte holds 0 to 255 (Harris and Harris, Digital Design and Computer Architecture, section 1.4).
- George Boole set out his algebra of logic in An Investigation of the Laws of Thought (1854). In his master's thesis (written 1937, published 1938) Claude Shannon showed that the same algebra describes switching circuits, which is why chips are designed with it.
- In Python, int("1011", 2) gives 11 and bin(11) gives '0b1011'. The words not, and, or are Boolean operators, and True == 1 is True because bool is a subtype of int.
- Texas Instruments SN74HC00 datasheet: input and output voltage levels
- Harris and Harris, Digital Design and Computer Architecture (sections 1.4 and 1.6)
- George Boole, An Investigation of the Laws of Thought (1854), Project Gutenberg
- Shannon, A Symbolic Analysis of Relay and Switching Circuits (MIT master's thesis, written 1937, published 1938)
- Python reference: Boolean operations (and, or, not)
- Python built-in functions: int() with a base, and bin()
Quiz Unlocks after the last step.