In the world of computing and electronics, binary numbers form the foundation of all digital systems. Understanding how binary is converted into digital signals and meaningful data is essential for anyone working with computers, networking, or embedded systems. This guide will take you from the basics of binary conversion to more advanced applications in digital systems.
Understanding Binary Numbers
What is Binary?
Binary is a number system that uses only two digits: 0 and 1. Unlike the decimal system (base 10) that we use in daily life, binary operates on base 2.
Each digit in a binary number represents a power of 2, similar to how decimal numbers use powers of 10:
Example:
- Decimal: 357 = (3 × 10²) + (5 × 10¹) + (7 × 10⁰)
- Binary: 1011 = (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) = 8 + 0 + 2 + 1 = 11 in decimal
Binary numbers are used in computers because electronic circuits work with two voltage levels, representing 0 (off) and 1 (on)
Converting Binary to Decimal (Basic Level)
To convert a binary number into a decimal number, follow these steps:
- Write down the binary number
- Label each digit with its corresponding power of 2 (starting from 0 on the right)
- Multiply each binary digit by 2 raised to its position power
- Sum up the values
Example 1: Convert 1101₂ to Decimal
Binary: 1 1 0 1
Power: 2³ 2² 2¹ 2⁰
Value: 8 + 4 + 0 + 1 = 13₁₀
Result: 1101₂ = 13 in decimal
Quick Trick: Using Doubling Method
Another method is starting from the left and doubling as you go:
- Start with 0.
- Multiply by 2 and add the next digit.
For 1101₂:
- Start with 1
- (1 × 2) + 1 = 3
- (3 × 2) + 0 = 6
- (6 × 2) + 1 = 13 → Answer
This method works well for mental conversions.
Converting Binary to Digital Signals
Digital systems interpret binary numbers as electrical signals in circuits.
- 0 = Low voltage (0V)
- 1 = High voltage (e.g., 5V in TTL logic, 3.3V in CMOS logic)
Computers and microcontrollers use logic gates (AND, OR, NOT, etc.) to process binary data and make decisions.
Example: Binary Representation in Digital Electronics
A 7-segment display (used in digital clocks and counters) is controlled by binary signals. Each digit (0-9) has a unique binary pattern that turns on/off specific segments.
Example: Displaying the number 5 on a 7-segment display Binary pattern: 01101101 (where 1 means “on” and 0 means “off”)
Converting Binary to ASCII (Text Representation)
In digital systems, binary data is often converted into readable text using ASCII encoding.
Each character has a corresponding 8-bit binary code:
- ‘A’ = 01000001
- ‘B’ = 01000010
- ‘C’ = 01000011
Example: Converting “HI” to Binary
- ‘H’ = 01001000
- ‘I’ = 01001001
Computers use these binary values to store and display text.
Advanced: Binary to Floating-Point Conversion
For scientific calculations, computers represent decimal numbers using floating-point binary format (IEEE 754 standard).
A floating-point number consists of:
- Sign bit (1 bit) – Indicates positive (0) or negative (1)
- Exponent (8 bits) – Determines the position of the decimal point
- Mantissa (23 bits) – Stores the significant digits
Example: Representing 5.75 in IEEE 754 (Single Precision)
- Convert 5.75 to binary: 101.11₂
- Normalize to scientific notation: 1.0111 × 2²
- Store in IEEE 754 format:
- Sign: 0 (positive)
- Exponent: 2 + 127 = 129 (10000001 in binary)
- Mantissa: 01110000000000000000000
Final IEEE 754 format: 0 10000001 01110000000000000000000
Practice Exercises
Exercise 1: Convert Binary to Decimal
Convert the following binary numbers to decimal:
- 1010₂
- 1111₂
- 100110₂
- 1100101₂
- 10110111₂
Exercise 2: Convert Decimal to Binary
Convert the following decimal numbers to binary:
- 14₁₀
- 29₁₀
- 45₁₀
- 98₁₀
- 255₁₀
Exercise 3: Convert ASCII to Binary
Find the binary representation of the following characters:
- ‘X’
- ‘M’
- ‘7’
- ‘!’
- ‘g’
Exercise 4: Convert Floating Point to IEEE 754 Format
Convert the following decimal numbers to IEEE 754 single precision format:
- 3.5
- -7.25
- 10.75
- 0.15625
- -12.5
Binary numbers are the foundation of digital technology. Whether converting binary to decimal, text, or floating-point numbers, understanding these processes is essential for programming, networking, and electronics. By mastering binary conversion, you can unlock deeper insights into how computers process and store data.