Review of number systems and number base conversions. Binary codes

Comprehensive study notes, diagrams, and exam preparation for Review of number systems and number base conversions. Binary codes.

Review of Number Systems and Number Base Conversions. Binary Codes

Definition

A number system is a method of representing numbers using a set of digits or symbols and a base, also called radix, which determines the value of each position in the number.

A binary code is a set of binary digits used to represent information in a form that a digital system can store, process, or transmit.

In a positional number system, the value of each digit depends on its position and the base of the system. For example, in base 10, the number 347 means:

  • 3 × 10²
  • 4 × 10¹
  • 7 × 10⁰

So, positional notation is the core idea behind number systems.


Main Content

1. Number Systems and Positional Representation

Decimal number system

  • The decimal system is base 10 and uses the digits 0 through 9.
  • It is the system used in everyday arithmetic and human counting.
  • Each position represents a power of 10. For example, 582 = 5 × 10² + 8 × 10¹ + 2 × 10⁰.
  • Decimal numbers may also include fractional parts, such as 45.67, where digits right of the decimal point represent negative powers of 10.

Binary, octal, and hexadecimal number systems

  • The binary system is base 2 and uses only 0 and 1.
  • The octal system is base 8 and uses digits 0 to 7.
  • The hexadecimal system is base 16 and uses digits 0 to 9 and A to F, where A = 10, B = 11, ..., F = 15.
  • These systems are widely used in computing because they simplify binary representation and make long binary strings easier to read.

Positional weights

  • In any base-r number system, the value of a number is the sum of each digit multiplied by its positional weight.
  • For example, in base 2, the number 1011₂ means:
    • 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰
    • = 8 + 0 + 2 + 1 = 11₁₀
  • The concept of positional weight is essential for conversion and interpretation.

Radix point and fractional values

  • Just as decimal numbers use a decimal point, other number systems use a radix point.
  • Digits to the left of the radix point have nonnegative powers of the base, while digits to the right have negative powers.
  • Example: 101.11₂ = 1×2² + 0×2¹ + 1×2⁰ + 1×2⁻¹ + 1×2⁻² = 5.75₁₀

2. Number Base Conversions

Conversion from decimal to another base

  • To convert a decimal integer to base-r, repeatedly divide by r and record remainders.
  • The remainders read in reverse order give the converted number.
  • Example: Convert 25₁₀ to binary:
    • 25 ÷ 2 = 12 remainder 1
    • 12 ÷ 2 = 6 remainder 0
    • 6 ÷ 2 = 3 remainder 0
    • 3 ÷ 2 = 1 remainder 1
    • 1 ÷ 2 = 0 remainder 1
    • Result = 11001₂
  • For fractional parts, repeatedly multiply by the base and record the integer part at each step.

Conversion from another base to decimal

  • To convert a number from any base to decimal, expand it using positional weights.
  • Example: Convert 2F₁₆ to decimal:
    • 2 × 16¹ + 15 × 16⁰
    • = 32 + 15
    • = 47₁₀
  • This method is direct and works for integers and fractions.

Conversion between binary, octal, and hexadecimal

  • Because 8 = 2³ and 16 = 2⁴, conversions between binary and octal or hexadecimal are very convenient.
  • Binary to octal: group bits into sets of 3 from the radix point outward.
    • Example: 1101011₂ = 1 101 011 → 153₈
  • Binary to hexadecimal: group bits into sets of 4.
    • Example: 1101011₂ = 0110 1011 → 6B₁₆
  • Octal or hexadecimal to binary is done by replacing each digit with its fixed binary equivalent.

Common conversion methods

  • Repeated division for integer parts.
  • Repeated multiplication for fractional parts.
  • Positional expansion for checking and direct computation.
  • Bit grouping for binary-octal and binary-hexadecimal conversion.
  • These methods reduce errors and speed up manual calculations.

3. Binary Codes

Weighted binary codes

  • Weighted codes assign a fixed weight to each bit position.
  • Example: 8421 BCD uses weights 8, 4, 2, and 1.
  • Decimal digit 9 is represented as 1001 in 8421 BCD.
  • Weighted codes are useful when decimal digits must be represented individually in binary form.

Non-weighted binary codes

  • Non-weighted codes do not follow a fixed positional weight pattern.
  • Example: Gray code is a non-weighted code in which adjacent values differ by only one bit.
  • Gray code is widely used in encoders, control systems, and analog-to-digital conversion to reduce transition errors.
  • Unlike weighted codes, non-weighted codes are designed for special purposes rather than direct arithmetic interpretation.

Alphanumeric and error-related binary codes

  • Alphanumeric codes represent letters, digits, and symbols.
  • Examples include ASCII and Unicode, though ASCII is the classic binary coding standard used in basic digital systems.
  • Error-detecting and error-correcting codes add redundancy to improve reliability during storage and communication.
  • Parity bits are a simple example: a bit is added so that the number of 1s is even or odd.
  • These codes are important when transmitting data over noisy channels or storing critical information.

Importance of binary codes in digital systems

  • They make it possible to represent all kinds of information using only two stable logic states.
  • They support memory storage, processing, communication protocols, and input/output operations.
  • Binary codes also help simplify circuit design because digital hardware naturally works with ON/OFF or HIGH/LOW states.

Working / Process

1. Identify the number system and base

  • Determine whether the number is decimal, binary, octal, or hexadecimal.
  • Identify the base from the subscript or context.
  • Example: 1011₂ is binary, 3A₁₆ is hexadecimal.

2. Apply the correct conversion rule

  • For decimal to binary/octal/hex, use repeated division for integers and repeated multiplication for fractions.
  • For base-r to decimal, use positional expansion.
  • For binary to octal or hex, group bits in 3s or 4s, respectively.
  • Example: 111100₂ = 111 100 → 74₈.

3. Interpret or encode using binary codes

  • Choose the appropriate code depending on the application.
  • Use BCD for decimal digits, Gray code for minimizing transitions, ASCII for characters, or parity for error checking.
  • Example: Decimal 7 in 8421 BCD = 0111; letter A in ASCII = 65₁₀ = 1000001₂.

Advantages / Applications

Simplifies computer representation

  • Number systems and binary codes allow computers to represent data using only two stable states.
  • This matches the physical behavior of transistors and logic gates.

Makes conversion and data handling efficient

  • Binary grouping makes octal and hexadecimal useful shortcuts for reading and writing machine data.
  • Hexadecimal is especially common in programming, memory addresses, and debugging.

Supports reliable communication and storage

  • Binary codes help in representing text, numbers, and instructions accurately.
  • Error-detecting codes reduce data corruption in communication systems.

Widely used in digital electronics

  • Used in logic design, microprocessors, memory addressing, digital displays, and control systems.
  • BCD is useful in calculators and digital clocks.
  • Gray code is useful in shaft encoders and position sensors.

Summary

  • Number systems represent values using a base and positional digits.
  • Base conversion is done using division, multiplication, expansion, or bit grouping.
  • Binary codes represent data in forms suitable for digital systems.

Important terms to remember: radix, positional notation, binary, octal, hexadecimal, BCD, Gray code, ASCII, parity bit.