Digital Computers & Binary
Why Binary?
Digital computers achieve greater reliability by employing only two states, similar to human logic with binary choices like true/false or yes/no.
0 1 0 1 1 0 0 1
Key Concept: A single binary digit (0 or 1) is called a bit. Information is stored in groups of bits.
Number Systems
Decimal (Base 10)
Digits: 0-9
Example: 724.5 = 7×10² + 2×10¹ + 4×10⁰ + 5×10⁻¹
Binary (Base 2)
Digits: 0, 1
Example: 101101₂ = 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 45₁₀
Octal (Base 8)
Digits: 0-7
Example: 736.4₈ = 7×8² + 3×8¹ + 6×8⁰ + 4×8⁻¹ = 478.5₁₀
Hexadecimal (Base 16)
Digits: 0-9, A-F
Example: F3₁₆ = F×16¹ + 3×16⁰ = 15×16 + 3 = 243₁₀
Number Base Conversions
Interactive Number Converter
Conversion Methods
Decimal to Binary:
Integer part: Divide by 2, read remainders bottom to top
Fraction part: Multiply by 2, read integer parts top to bottom
Example: 41.6875₁₀ = 101001.1011₂
Integer part: Divide by 2, read remainders bottom to top
Fraction part: Multiply by 2, read integer parts top to bottom
Example: 41.6875₁₀ = 101001.1011₂
Binary to Octal: Group bits in sets of 3
Binary to Hex: Group bits in sets of 4
Example: 1010111100010111₂ = 5361.354₈ = AF1.76₁₆
Binary to Hex: Group bits in sets of 4
Example: 1010111100010111₂ = 5361.354₈ = AF1.76₁₆
Complements
1's Complement
Change all 0s to 1s and all 1s to 0s
Original: 1011001
1's Comp: 0100110
2's Complement
1's complement + 1
1's Comp: 0100110
2's Comp: 0100111
Complement Calculator
Fixed-Point Representation
Signed Number Representations
Signed-Magnitude:
Sign bit (0=+, 1=-) + magnitude
Sign bit (0=+, 1=-) + magnitude
1's Complement:
Positive: as signed-magnitude
Negative: 1's complement of positive
Positive: as signed-magnitude
Negative: 1's complement of positive
2's Complement:
Positive: as signed-magnitude
Negative: 2's complement of positive
Positive: as signed-magnitude
Negative: 2's complement of positive
Interactive Signed Number Representation
Binary-Coded Decimal (BCD)
Each decimal digit represented by 4 bits
Decimal: 3984
BCD: 0011 1001 1000 0100
Floating-Point Representation
Scientific Notation for Binary
Separates number into mantissa and exponent for wider range
Binary: +1001.11
Floating-point: +0.100111 × 2⁴
Components:
• Mantissa: 0.100111
• Exponent: 4 (100)
Floating-point: +0.100111 × 2⁴
Components:
• Mantissa: 0.100111
• Exponent: 4 (100)
Normalization: The most significant digit of the mantissa is non-zero (1 for binary)
Other Binary Codes
Gray Code
Only one bit changes between successive numbers
Dec | Gray
0 | 0000
1 | 0001
2 | 0011
3 | 0010
4 | 0110
0 | 0000
1 | 0001
2 | 0011
3 | 0010
4 | 0110
ASCII Code
7-bit code for 128 characters
'A' = 1000001 (65₁₀)
'a' = 1100001 (97₁₀)
'0' = 0110000 (48₁₀)
'a' = 1100001 (97₁₀)
'0' = 0110000 (48₁₀)
Error Detection
Parity bit ensures error detection
Even Parity:
Total 1s = even number
Message: 1011001
Parity bit: 1 (makes total even)
Transmitted: 10110011
Total 1s = even number
Message: 1011001
Parity bit: 1 (makes total even)
Transmitted: 10110011