Digital Logic Design Lecture 6
Main note
Octal Numbers
Properties
- It has base 8
- 0,1,2,3,4,5,6,7
- 2^3 = 8 Thus we require 3 bits of binary combinations to represent an octal number
Conversion
Octal to Decimal
- We multiply (8^{n-1}) to each of the digits with respect to their positions.
Example
Converting 6327.4051
Now, calculate each term:
Simplify:
Adding all terms together:
Thus, the decimal equivalent of the octal number 6327.4051 is:
Decimal To Octal
We keep dividing by 8 and storing the remainder in the answer vector, and then take the remnant of the quotient and divide it by 8 until it’s 0.
Example
Convert ( 247_{10} ) to octal
-
Divide 247 by 8:
-
Divide 30 by 8:
-
Divide 3 by 8:
Now, reading the remainders from bottom to top, we get:
Important Note
When Float Values are present instead of dividing with 8 we multiply.](<#### Decimal To Octal (Float Values) When float values are present, instead of dividing by 8, we multiply by 8 and take the integer part as the next digit in the octal representation.
Example
Convert ( 0.6875_{10} ) to octal
-
Multiply 0.6875 by 8: Take the integer part 5.
-
Multiply the fractional part 0.5 by 8: Take the integer part 4.
Since the fractional part is now 0, we stop here.
Reading the integer parts from top to bottom, we get:
Octal To Binary
Three binary bits are required for each octal digit, based on the logic that .
Example
Convert We simply replaced each digit with their binary counterparts
Binary To Octal
Three binary bits correspond to each octal digit, based on the logic that (2^3 = 8).
Example
Convert ( (111011110)_2 ) to octal
-
Group the binary digits into sets of three, starting from the right:
-
Convert each group of three binary digits to their octal equivalent:
- (111) in binary is (7) in octal.
- (011) in binary is (3) in octal.
- (110) in binary is (6) in octal.
Therefore:
Fractional Binary to Octal
For fractional Part group three bits and equivalent decimal number to get octal number from left to right side w.r.t Decimal Point.
Example
HexaDecimal Numbers
Conversion
Hexadecimal Number to Decimal
We multiply each digit with (16^{n-1}) and add them all.
Example
Convert ((3A.2F)_{16}) to decimal
-
Separate the number into its integer and fractional parts:
-
Convert each digit to its decimal equivalent:
- (3) in hexadecimal is (3) in decimal.
- (A) in hexadecimal is (10) in decimal.
- (2) in hexadecimal is (2) in decimal.
- (F) in hexadecimal is (15) in decimal.
-
Multiply each digit by (16^{n-1}) where (n) is the position from the decimal point:
-
Calculate each term:
-
Add all terms together:
Therefore:
Decimal To Hexadecimal
To convert a decimal number to hexadecimal, we repeatedly divide the number by 16 and store the remainder. For the fractional part, we multiply by 16 and take the integer part. We continue this process until the quotient is 0 (for the integer part) and the fractional part reaches the desired precision.
Example
Convert ( 58.18359375_{10} ) to hexadecimal
- Convert the integer part (58):
-
Divide 58 by 16:
-
The remainder 10 corresponds to ‘A’ in hexadecimal.
-
Divide 3 by 16:
So, the integer part ( 58_{10} = 3A_{16} ).
- Convert the fractional part (0.18359375):
-
Multiply 0.18359375 by 16: Take the integer part 2.
-
Multiply the remaining fractional part 0.9375 by 16: Take the integer part 15, which corresponds to ‘F’ in hexadecimal.
So, the fractional part ( 0.18359375_{10} = 0.2F_{16} ).
Combining both parts:
HexaDecimal to Binary
Example 2.30
Conversion of Hexadecimal to Binary
Problem: Convert ((2F9A)_{16}) to an equivalent binary number.
Solution: Using Table 2.7, find the binary equivalent of each hexadecimal digit.
Steps:
-
Hex Digit: 2
- Binary Equivalent:
0010
- Binary Equivalent:
-
Hex Digit: F
- Binary Equivalent:
1111
- Binary Equivalent:
-
Hex Digit: 9
- Binary Equivalent:
1001
- Binary Equivalent:
-
Hex Digit: A
- Binary Equivalent:
1010
- Binary Equivalent:
Thus, combining these binary equivalents, we get:
Or, without spaces:
Hexadecimal to Binary Conversion
Hexadecimal numbers can be converted into equivalent binary numbers by replacing each hex digit by its equivalent 4-bit binary number.
Example 2.30
Problem: Convert to an equivalent binary number.
Solution: Using Table 2.7, find the binary equivalent of each hexadecimal digit.
Steps:
-
Hex Digit: 2
- Binary Equivalent:
0010
- Binary Equivalent:
-
Hex Digit: F
- Binary Equivalent:
1111
- Binary Equivalent:
-
Hex Digit: 9
- Binary Equivalent:
1001
- Binary Equivalent:
-
Hex Digit: A
- Binary Equivalent:
1010
- Binary Equivalent:
Thus, combining these binary equivalents, we get:
References
Information
- date: 2024.08.01
- time: 08:19