Octal System

0 comments
Octal System:
The octal number system is also to provide a convenient way to express binary numbers like hexadecimal system (can be seen here). Octal number system uses only 8 digits (symbols) and each digit is the represented by 3 bit binary number so we can say that 3 bit binary number requires single octal digit, 6 bit binary number requires 2 octal digits, similarly 9 bit binary number requires 3 octal digits and so on. As we work mostly on binary data in which total number of bits are multiples of 4, hexadecimal number system is most frequently used than octal number system. 8  digits are comprised only of numeric characters 0 through 7. As this system has 8 different digits, its base is 8. Table 1.3 summarizes the relationship among binary, decimal and octal numbers.
Octal
Decimal Number
Binary Numbers
MSB

LSB
0
0
0
0
0
1
1
0
0
1
2
2
0
1
0
3
3
0
1
1
4
4
1
0
0
5
5
1
0
1
6
6
1
1
0
7
7
1
1
1
Table 1.3
In octal system, counting after 78 (where subscript “8” represent octal number system) continues in the same way as explained before. This means after 78 there comes 108, 118, 128, 138, 148, 158, 168, 178, 208 and so on. So in this way, we can count up to 778 using two octal digits which equal 6310 and 1111112. Note that when there is a 7 in digit place, it becomes 0 when incremented. This also shows the overflow condition. Digit positions in an octal number have the weight as follows.
86
85
84
83
82
81
80
8-1
8-2
8-3
8-4
8-5
8-6
8-7
.
Octal Point
Binary-to-Octal Conversion:
From table 1.3, it is clear that the largest digit i.e., 78 needs 3 bits to be represented. Therefore, we break the binary numbers into groups of 3 bits starting from right-most bit (LSB) and proceeding towards left-hand bit (MSB). If there are some bits left on the left hand side of a binary number which cannot make a group of 3, we append “0” to the left of a number to get 3 bit group completed. This is illustrated by example 1.10.
Example 1.10 (Click Image to enlarge)
Octal-to-Binary Conversion:
To convert from octal to binary, simply reverse the process explained above to place a 3 bit binary number in place of each octal digit. Example 1.11 explains this procedure.
Example 1.11 (Click Image to enlarge)
Decimal-to-Octal Conversion:
Recall from the repeated division method for decimal-to-binary conversion (can be seen here) that the division of decimal number by the base of the system in which conversion needs to be made will give the desired number. Here the base is “8”. Following example (1.12) explains the procedure.
Example 1.12 (Click Image to enlarge)
Like before, division stopped when the quotient is less than the base of number system, i.e., “8” in this case.
Octal-to-Decimal Conversion:
For converting octal numbers to decimal, we use the same procedure of addition of equivalent value (can be seen here) of each digit. Following example (1.13) explains this conversion procedure in detail.
Example 1.13 (Click Image to enlarge)
Another method for conversion is to first convert the octal number to equivalent binary number and then convert that binary number to equivalent decimal as shown in example 1.14 below.
Example 1.14 (Click Image to enlarge)
References:
1.       Ronald J. Tocci and Neal S. Widmer, Digital Systems Principles and Applications, 7th Edition, Prentice-Hall, New Jersey.
2.      Thomas L. Floyd, Digital Fundamentals, 7th Edition, Prentice-Hall, New Jersey.

Hexadecimal System

1 comments

While working with binary numbers, we can note that representation of larger number may become problematic. For example, if one has to do mathematical operations with 32-bit number or any other larger number, he may face problem in writing them and doing calculation. Some of the bits may be missed or written incorrectly. To avoid this problem, Hexadecimal number system is used. In this system, there are 16 digits (symbols). Each digit is the representation of 4 bit binary number so we can say that 4 bit binary number requires single hexadecimal digit, 8 bit binary number requires 2 hexadecimal digits, similarly 12 bit binary number requires 3 hexadecimal digits and so on. As this system has 16 different digits, its base is 16. 16 digits are comprised of numeric characters 0 through 9 and then block alphabetic characters A, B, C, D, E and F which are equivalent to decimal 10 through 15 respectively. Table 1.2 summarizes the relationship among binary, decimal and hexadecimal numbers.
Hexadecimal
Decimal Number
Binary Numbers
MSB


LSB
0
0
0
0
0
0
1
1
0
0
0
1
2
2
0
0
1
0
3
3
0
0
1
1
4
4
0
1
0
0
5
5
0
1
0
1
6
6
0
1
1
0
7
7
0
1
1
1
8
8
1
0
0
0
9
9
1
0
0
1
A
10
1
0
1
0
B
11
1
0
1
1
C
12
1
1
0
0
D
13
1
1
0
1
E
14
1
1
1
0
F
15
1
1
1
1
Table 1.2
In hexadecimal system, counting after FH (where subscript “H” represent hexadecimal number system) continues in the same way as explained before. This means after FH there comes 10H, 11H, 12H, 13H, 14H, 15H, 16H, 17H, 18H, 19H, 1AH, 1BH, 1CH, 1DH, 1EH, 1FH, 20H and so on. So in this way, we can count up to FFH using two hexadecimal digits which equal 25510 and 111111112. Note that when there is a 9 in digit place, it becomes A when increamented and overflow condition occurs when F comes at certain digit place. Digit positions in a hexadecimal number have the weight as follows.
166
165
164
163
162
161
160
16-1
16-2
16-3
16-4
16-5
16-6
16-7
.
Hexadecimal Point


Binary-to-Hexadecimal Conversion:
From table 1.2, it is clear that the largest digit i.e., FH needs 4 bits (also called nibble) to be represented. Therefore, we break the binary numbers into groups of a nibble starting from right-most bit (LSB) and proceeding towards left-hand bit (MSB). If there are some bits left on the left hand side of a binary number which cannot make a nibble, we append “0” to the left of a number to get nibble completed. This is illustrated by example 1.5.
Example 1.5 (Click image to enlarge)

Hexadecimal-to-Binary Conversion:
To convert from hexadecimal to binary, simply reverse the process explained above to place a nibble (4 bit binary number) in place of each hexadecimal digit. Example 1.6 explains this procedure.



Example 1.6 (Click image to enlarge)


Decimal-to-Hexadecimal Conversion:
Recall from the repeated division method for decimal-to-binary conversion (can be seen here) that the division of decimal number by the base of the system in which conversion needs to be made will give the desired number. Here the base is “16”. Following example (1.7) explains the procedure.

Example 1.7 (Click image to enlarge)


Like before, division stopped when the quotient is less than the base of number system, i.e., “16” in this case.
Hexadecimal-to-Decimal Conversion:
Recall from previous discussion that weight “W” of “nth” digit (bit in case of binary number system) in a given number represented in number system with base “X” can be calculated as:
            W = Xn
Where n = 0 for LSD and increases as we move from right most digit to the left most.
For converting hexadecimal numbers to decimal, we use the same procedure of addition of equivalent value (can be seen here) of each digit. For the sake of convenience, it is important to note that decimal equivalent of hexadecimal digit should be considered when multiplying that digit with the weight to get its equivalent value. Following example (1.8) explains this conversion procedure in detail.

Example 1.8 (Click image to enlarge)
  Another method for conversion is to first convert the hexadecimal number to equivalent binary number and then convert that binary number to equivalent decimal as shown in example 1.9 below.

Example 1.9 (Click image to enlarge)


References:
1.       Ronald J. Tocci and Neal S. Widmer, Digital Systems Principles and Applications, 7th Edition, Prentice-Hall, New Jersey.
2.      Thomas L. Floyd, Digital Fundamentals, 7th Edition, Prentice-Hall, New Jersey.


 
Copyright 2010 | All Rights Reserved Electrical & Electronics
BloggerTheme by BloggerThemes | Design by 9thsphere