1. Intuition First: Why Binary & The Odometer Model
Physical computers do not operate on decimal digits because transistors are electronic switches. An analog voltage that continuously slides between and is vulnerable to thermal noise, supply ripple, and component aging. By dividing voltages into two distinct noise-tolerant zones—LOW () and HIGH ()—digital logic achieves near-perfect signal restoration across millions of cascading logic gates.
The Rolling Odometer Analogy
Think of a mechanical car odometer. Each dial contains ten numerals ( through ). When a wheel passes , it cannot display in a single slot; it rolls back to and mechanical teeth physically push the wheel immediately to its left forward by one increment.
Binary arithmetic functions identically, except each wheel only has two symbols: and :
- Counting starts at .
- The next increment is .
- Adding another count forces a rollover: the slot resets to and generates a carry to the next column, yielding (decimal ).
Decimal odometer rollover: 09 -> 10 -> ... -> 99 -> 100
Binary counter rollover: 01 -> 10 -> ... -> 11 -> 100
Two's Complement: The Odometer Running in Reverse
What happens if a brand new car with on the odometer rolls backwards by one kilometer? The dials roll backwards past zero to display . In mechanical systems, everyone intuitively understands that represents .
In an -bit digital register, counting down backwards from 0000 0000 similarly wraps around to 1111 1111. Two's complement arithmetic uses this exact ring topology:
- Unsigned representation views
1111 1111as . - Signed representation views
1111 1111as .
Because addition and subtraction follow identical modular bitwise mechanics regardless of sign, digital ALUs can execute subtraction using simple adder hardware without separate subtractor circuits.
2. Formula & Unit Quick-Reference Strip
Positional value of any digit string with radix r, n integer digits, and m fractional digits.
Minimum bit width required to encode N distinct binary states or decimal values.
Negating a signed number: invert every bit (one's complement) and add 1.
Two's complement dynamic range. For 8 bits: -128 to +127.
Unsigned integer dynamic range. For 8 bits: 0 to 255.
XOR sum of data bits ensuring total number of 1s in transmitted frame is even.
3. Mathematical Derivation: Two's Complement Negation & Overflow
4. Typical Bench Values & Standard Register Widths
Digital hardware architectures enforce standardized register widths and word sizes:
| Parameter / Part | Typical Value | Lab Range | Practical Notes |
|---|---|---|---|
| 8-bit Byte (uint8_t / int8_t) | 0 to 255 (Unsigned) | -128 to +127 (Signed) | Fundamental addressable memory byte in AVR, 8051, and x86 architectures |
| 16-bit Half-Word (uint16_t) | 0 to 65,535 | -32,768 to +32,767 | Standard 16-bit timer capture registers and high-resolution ADC channels |
| BCD Nibble (4-bit) | 0000 to 1001 (0 to 9 dec) | 1010 to 1111 illegal | Real-time clocks (DS3231/DS1307) and dual-slope DMM display controllers |
| TTL Logic Thresholds | LOW ≤ 0.8V, HIGH ≥ 2.0V | 0V to 5.0V DC rail | Guaranteed 400mV noise margin in standard 74LS series ICs |
5. Worked Engineering Problems
Problem 1: Mixed Radix Conversion (Integer & Fractional)
Convert the decimal value 156.625 into its equivalent binary and hexadecimal representations.
Problem 2: Two's Complement Subtraction
Compute (25 - 42) using 8-bit two's complement arithmetic. Show the step-by-step negation, addition, and decimal verification.
Problem 3: Signed Addition & Hardware Overflow Detection
In an 8-bit ALU register, add (+100) and (+60). Determine the resulting binary word, interpret it as a signed integer, and verify whether arithmetic overflow occurred.
6. Common Exam Traps & Where Marks Are Lost
Avoid these classic calculation errors frequently spotted on semester examination answer scripts:
- Reading 1111 1111 as 255 when the problem specifies signed integers. In signed two's complement, 1111 1111 is -1. Only interpret it as 255 if the question explicitly states unsigned.
- Forgetting that the most negative number has no positive partner: In 8-bit two's complement, -128 is 1000 0000. Negating it (~1000 0000 + 1 = 0111 1111 + 1 = 1000 0000) yields -128 again because +128 cannot fit in 8 bits.
- Reading BCD as plain binary: 1001 0101 in BCD is 95 decimal (1001 = 9, 0101 = 5). Interpreting it as straight binary gives 128 + 16 + 4 + 1 = 149, which is completely incorrect.
- Grouping binary fractions from the left: When grouping a fractional binary number into hex nibbles, you MUST group to the right starting from the binary point and pad zeros on the trailing right (e.g., 0.101 becomes 0.1010 = 0.A, not 0.5).
- Using sign-magnitude for negative numbers when two's complement is requested: -5 in sign-magnitude is 1000 0101, whereas in two's complement it is 1111 1011. Modern microprocessors exclusively use two's complement.
7. Interactive Simulator & 'Try Breaking It'
Experiment with binary bit patterns, carry generation, and logic gates in the interactive circuit simulator below:
Simulator will mount when scrolled into view (conserving CPU & memory)
Set 0111 1111 (+127), predict the signed reading, then add 1.
8. Parametrised Practice Problem
Solidify your conversion mastery with randomized parameter sets:
Thévenin Equivalent of a Loaded Voltage Divider
A 12 V DC voltage source powers a divider with R1 = 20 Ω and R2 = 20 Ω. Calculate the open-circuit Thévenin voltage V_th (in Volts) appearing across terminals of R2.