Digital Logic Design Lecture 7

Main note

Hexadecimal to Octal Conversion

To convert a hexadecimal number to an octal number, follow these steps:

  1. Convert the hexadecimal number to its binary equivalent.
  2. Group the binary digits into sets of three, starting from the right.
  3. Convert each group of three binary digits to its octal equivalent.

Example: Convert to Octal

Solution:

  1. Convert the hexadecimal number to binary:

    So,

  2. Group the binary digits into sets of three:

  3. Convert each group to octal:

    So,

Therefore,

Octal to Hexadecimal Conversion

To convert an octal number to a hexadecimal number, follow these steps:

  1. Convert the octal number to its binary equivalent.
  2. Group the binary digits into sets of four, starting from the right.
  3. Convert each group of four binary digits to its hexadecimal equivalent.

Example: Convert to Hexadecimal

Solution:

  1. Convert the octal number to binary:

    So,

  2. Group the binary digits into sets of four:

  3. Convert each group to hexadecimal:

    So,

Therefore,

Refer Hexa Decimal Numbers for HexaDecimal Definition.

Binary-Coded Decimal (BCD)

Binary-Coded Decimal (BCD) is a class of binary encodings of decimal numbers where each decimal digit is represented by a fixed number of binary digits, usually four or eight. The most common encoding is the 4-bit encoding, where each digit of a decimal number is represented by its binary equivalent.

Characteristics of BCD

  • Decimal Digits: Each of the decimal digits (0-9) is represented by a 4-bit binary number.
  • Representation: Unlike binary representation where the entire number is converted to binary, in BCD each decimal digit is individually converted to binary.

Example of BCD Representation

For example, the decimal number 259 in BCD is represented as follows:

  1. Decimal Number: 259
  2. BCD Representation:
    • 2 is represented as 0010
    • 5 is represented as 0101
    • 9 is represented as 1001

Thus, is represented in BCD as .

Advantages of BCD

  • Easy Conversion: Conversion between decimal and BCD is straightforward because each digit is independently converted.
  • Simple Arithmetic Operations: Simplifies the design of digital systems, particularly in arithmetic operations.

Disadvantages of BCD

  • Inefficiency: BCD is less space-efficient compared to pure binary representation because it requires more bits to represent a number.
  • Complex Arithmetic Logic: Arithmetic operations can be more complex and require additional logic compared to pure binary operations.

Applications of BCD

  • Digital Clocks: Time display systems use BCD to represent hours, minutes, and seconds.
  • Calculators: Most electronic calculators use BCD for internal arithmetic.
  • Digital Meters: Digital voltmeters and other measuring instruments use BCD for representing the measured values.

Example Conversions

Here is a table showing decimal digits and their corresponding BCD representations:

DecimalBCD
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001

Conversion Example

Convert the decimal number (735) to BCD:

  1. Decimal Number: 735
  2. BCD Conversion:
    • 7 is represented as 0111
    • 3 is represented as 0011
    • 5 is represented as 0101

Thus, (735_{10}) is represented in BCD as (0111\ 0011\ 0101_{BCD}).

Summary

BCD is a useful encoding method for decimal digits in digital systems where ease of conversion and display is crucial, despite its inefficiency in terms of storage space compared to pure binary representation.

Gray Code

Gray Code is a binary numeral system where two successive values differ in only one bit. It is also known as the Reflected Binary Code.

Characteristics of Gray Code

  1. Single Bit Difference:

    • Each number in the sequence differs from the previous one by only one bit.
    • This property reduces errors in digital systems, especially in applications like analog to digital converters (ADCs).
  2. Cyclic Nature:

    • Gray Code sequences are cyclic. The transition from the highest value back to zero also changes only one bit.

Conversion Between Binary and Gray Code

  1. Binary to Gray Code:

    • The most significant bit (MSB) of the Gray Code is the same as the MSB of the binary code.
    • Each subsequent bit of the Gray Code is obtained by XORing the current binary bit with the previous binary bit.

    where is the bit of the Gray Code and is the bit of the binary code.

  2. Gray Code to Binary:

    • The MSB of the binary code is the same as the MSB of the Gray Code.
    • Each subsequent binary bit is obtained by XORing the previous binary bit with the current Gray Code bit.

Example of Binary to Gray Code Conversion

Let’s convert the binary number to Gray Code:

  1. MSB remains the same:

  2. Next bit:

  3. Next bit:

  4. Next bit:

So, in binary converts to in Gray Code.

Example of Gray Code to Binary Conversion

Let’s convert the Gray Code back to binary:

  1. MSB remains the same:

  2. Next bit:

  3. Next bit:

  4. Next bit:

So, in Gray Code converts back to in binary.

Applications of Gray Code

  1. Error Minimization:

    • Used in rotary encoders to prevent errors during the transition from one position to another.
    • Minimizes errors in digital systems due to single-bit changes.
  2. Digital Systems:

    • Used in Karnaugh maps to simplify Boolean expressions.
    • Useful in ADCs and other digital communication systems.

Summary

  • Gray Code ensures that only one bit changes at a time, which is useful for reducing errors in digital systems.
  • Conversion between binary and Gray Code involves simple XOR operations.
  • Applications of Gray Code include error minimization in rotary encoders and simplification of Boolean expressions in digital systems.

Binary to Gray

  • Step 1 Convert Decimal Number to Binary
  • Step 2 we write it down horizontally sequentially

References

Information
  • date: 2024.08.06
  • time: 13:12