You are on page 1of 20

BTC 215 – Digital Electronics

LESSON 2

OCTAL AND HEXADECIMAL NUMBER SYSTEMS

Introduction

While the binary

number system is very

important because of

its connection with

computers, it is not the

only other number

system of importance.

Two other number systems that are frequently seen are

octal numbers and hexadecimal numbers. The octal number system is a

base-8 number system and uses the digits 0 - 7 to represent numbers. The

hexadecimal number system is a base-16 number system and uses the

digits 0 - 9 along with the letters A - F to represent numbers.

Learning Outcomes

At the end of this lesson, you are expected to:


1. Discuss the principles and applications of Octal and Hexadecimal

numbers

2. Perform conversion techniques using Octal and Hexadecimal

numbers to other number used in digital system

1|Page
BTC 215 – Digital Electronics

ACTIVITY

Instruction: Fill in the necessary DECIMAL equivalent of the following positional


weights.

1.
Positional 80 81 82 83 84
Weights
Equivalent
in Decimal

2.
Positional 8-1 8-2 8-3 8-4 8-5
Weights
Equivalent
in Decimal

3.
Positional 160 161 162 163 164
Weights
Equivalent
in Decimal

4.
Positional 16-1 16-2 16-3 16-4 16-5
Weights
Equivalent
in Decimal

ANALYSIS

1. How do you find the activity? Explain your stand.

2|Page
BTC 215 – Digital Electronics

2. Which of the following table in the activity you find difficult to answer?
Why?

3. What is your observation from your answers in all tables in the activity as
it progresses from left to the right side? Why?

3|Page
BTC 215 – Digital Electronics

ABSTRACTION

Octal Number System

The octal number system, or oct for short, is one type of Number

Representation techniques, in which its base value is 8. That means there

are only 8 symbols or possible digit values which are the 0, 1, 2, 3, 4, 5,

6, 7. Any other digit would make the number an invalid octal number. It

is based on the binary

system with a 3-bit

boundary which requires

only 3 bits to represent

value of any octal digit.

Position of every digit has

a weight which is a power of 8. Each position in the Octal system is 8 times

more significant than the previous position, that means numeric value of

an octal number is determined by multiplying each digit of the number by

the value of the position in which the digit appears and then adding the

products.

83 82 81 80 . 8-1 8-2 8-3

512 64 8 1 . 1/8 1/64 1/512

Most Sig. Decimal Least Sig.


Digit Point Digit

4|Page
BTC 215 – Digital Electronics

Applications of Octal Number System

Although this was once a popular number base, especially in old

computing systems such as the UNIVAC 1050, PDP-8, ICL 1900 and IBM

mainframes employed 6-bit, 12-bit, 24-bit or 36-bit words, this number

system is rarely used today. However, Octal is used when the number of

bits in one word is a multiple of 3. It is also used as a shorthand for

representing file permissions on UNIX systems and representation of UTF8

numbers, etc.

Advantages

 It has fewer computations and less computational errors since it

uses less digits than decimal and Hexadecimal number system.

 It is easy to convert octal numbers to binary numbers and vice-versa

since a 3-bit binary number represents only a single digit in octal

system.

 It is also easier to handle input and output in the octal form.

Disadvantage

 Computer does not understand octal number system directly, so we

need octal to binary converter.

5|Page
BTC 215 – Digital Electronics

Hexadecimal Number System

Hexadecimal Number System is another type of Number

Representation techniques, in which its base value is 16. That means there

are only 16 possible digit values which are the 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,

A, B, C, D, E, F. The letters A-F

in hexadecimal numbers are

single bit representations of

decimal value 10-15 respectively.

Hexadecimal requires only 4 bits

to represent value of any digit.

Position of every digit in this

system has a weight which is a

power of 16. Each position in the

Hexadecimal system is 16 times more significant than the previous

position, that means numeric value of a hexadecimal number is

determined by multiplying each digit of the number by the value of the

position in which the digit appears and then adding the products.

163 162 161 160 . 16-1 16-2 16-3

4096 256 16 1 . 1/16 1/256 1/4096

Most Decimal Least


Significant Point Significant
Digit Digit

6|Page
BTC 215 – Digital Electronics

Applications of Hexadecimal Number System

Hexadecimal numbering system is often used by programmers to


simplify the binary numbering system. Since 16 is equivalent to 24, there
is a linear relationship between the numbers 2 and 16. This means that
one hexadecimal digit is equivalent to four binary digits. Computers use
binary numbering system while humans use hexadecimal numbering
system to shorten binary and make it easier to understand.

Hexadecimals are used in the following:


 To define locations in memory. Hexadecimals can characterise
every byte as two hexadecimal digits only compared to eight digits
when using binary.
 To define colours on web pages. Each primary colour – red, green
and blue is characterised by two hexadecimal digits. The format
being used is #RRGGBB. RR stands for red, GG stands for green
and BB stands for blue.
 To represent Media Access Control (MAC) addresses. MAC
addresses consist of 12-digit hexadecimal numbers. The format
being used is either MM:MM:MM:SS:SS:SS or MMMM-MMSS-
SSSS. The first 6 digits of the MAC address represent the ID of the
adapter manufacturer while the last 6 digits represent the serial
number of the adapter.
 To display error messages. Hexadecimals are used to define the
memory location of the error. This is useful for programmers in
finding and fixing errors.

Advantages

 It is very concise and by using a base of 16 means that the number


of digits used to signify a given number is usually less than in binary
or decimal. It allows you to store more information using less space.

7|Page
BTC 215 – Digital Electronics

 It is fast and simple to convert between hexadecimal numbers and


binary. Hexadecimal can be used to write large binary numbers in
just a few digits.
 It makes life easier as it allows grouping of binary numbers which
makes it easier to read, write and understand. It is more human-
friendly, as humans are used to grouping together numbers and
things for easier understanding. Also, writing in less digits lowers
the possibility of error occurring.

Disadvantages

 Hexadecimal number system is not an easily understood by people.


 It is difficult to perform operations like multiplications, divisions
using hexadecimal number system.
 Hexadecimal system is most difficult number system for dealing with
Computer’s data.

Octal and Hexadecimal Number Conversion

Octal to other Number System

Like binary and decimal, the octal number can also be converted into other

number systems. Let's start understanding how conversion is done.

Octal to Binary Conversion

The process of converting octal to binary is the reverse process of


binary to octal. We write the of each octal number digit three bits binary
code.

8|Page
BTC 215 – Digital Electronics

Example: Convert (152.25)8 to binary

Solution:
1. Write the three-bit binary digit for 1, 5, 2, 2 and 5.

Octal 1 5 2 . 2 5
Binary 001 101 010 . 010 101

2. Combine all the binary digits


001 101 010 . 010 1012
3. So, the binary number of the octal number 152.25
is (001101010.010101)2 or (1101010.010101)2

Binary to Octal Conversion

The base numbers of binary and octal are 2 and 8, respectively. In a


binary number, the pair of three bits is equal to one octal digit. There are
only two steps to convert a binary number into an octal number which are
as follows:
1. Make the pairs of three bits on both sides of the binary point. If there
will be one or two bits left in a pair of three bits pair, you must add
the required number of zeros on the most significant sides.
2. Write the octal digits corresponding to each pair.

Example 1: Convert 101100101012 to octal

Solution:
1. Make pairs of three bits on both sides of the binary point.

010 110 010 101

Note: On the left side of the binary point, the last pair has only two bits. To make
it a complete pair of three bits, we added a zero on the extreme side.

9|Page
BTC 215 – Digital Electronics

2. Write the octal digits which correspond to each pair.

Answer: 26258

Example 2: Convert 111110101011.00112 to octal

Solution:
1. Make pairs of three bits on both sides of the binary point.

111 110 101 011 . 001 1

Note: On the right side of the binary point, the last pair has only one bit. To make
it a complete pair of three bits, you must two zeros on the extreme side.

111 110 101 011 . 001 100

2. Write the octal digits, which correspond to each pair.

Answer: 7653.148

Octal to Decimal Conversion

The process of converting octal to decimal is the same as binary to

decimal. The process starts from multiplying the digits of octal numbers

with its corresponding positional weights. And lastly, we add all those

products.

10 | P a g e
BTC 215 – Digital Electronics

Example: Convert (152.25)8 to decimal

1. Multiply each digit of 152.25 with its respective positional weight.

Positional
82 81 80 . 8-1 8-2
Weight
Octal
1 5 2 . 2 5
Numbers
Equivalent 64 8 1 . 1/8 1/64

(152.25)8=(1×82)+(5×81)+(2×80)+(2×8-1)+(5×8-2)
(152.25)8=(1x64)+(5x8)+(2x1)+(2×1⁄8)+(5×1⁄64)

2. Add the products of all the bits with its weight.


(152.25)8=64+40+2+0.25+0.078125
(152.25)8=106.32812510

Decimal to Octal Conversion

For converting decimal to octal, there are two steps required to

perform, which are as follows:

1. Perform the division operation on the whole numbers and the

successive quotient with the base of octal(8).

2. Perform the multiplication on the fractional numbers and the

successive fraction with the base of octal(8).

Example: Convert 152.2510 to octal


152 = whole numbers
.25 = fractional numbers

11 | P a g e
BTC 215 – Digital Electronics

1. Divide the number 152 and its successive quotients with base 8.
Operation Quotient Remainder

152/8 19 0 LSB
19/8 2 3
2/8 0 2 MSB

So, the Octal value of 15210 = 2308

2. Perform the multiplication of 0.25 and successive fraction with


base 8.
Operation Quotient Remainder

0.25×8 0 2

So, the Octal value of .2510 = 28

Therefore, the octal number of the decimal number 152.25 is 230.28

Octal to hexadecimal conversion

For converting octal to hexadecimal, there are three steps required to


perform, which are as follows:
1. Find the binary equivalent of any octal number
2. Make the pairs of four bits on both sides of the binary point. If
there will be one, two, or three bits left in a pair of four bits pair,
add the required number of zeros on extreme sides
3. Write the hexadecimal digits corresponding to each pair.

Example 1: Convert 26258 to hexadecimal

1. Write the three-bit binary digit for 2, 6, 2, and 5.


Octal 2 6 2 5
Binary 010 110 010 101

The binary number of the octal number 26258 is 0101100101012

12 | P a g e
BTC 215 – Digital Electronics

2. Make pairs of four bits on both sides of the binary point.

0101100101012 = 0101 1001 0101

3. Write the hexadecimal digits, which correspond to each pair.


0101 1001 0101
5 B 5

Answer: 5B516

Example 2: Convert 152.258 to hexadecimal


1. Write the three-bit binary digit for 1, 5, 2, and 5.

Octal 1 5 2 . 2 5
Binary 001 101 010 . 010 101

152.258 = 001101010.0101012
2. Make pairs of four bits on both sides of the binary point.
001101010.0101012 = 0 0110 1010 . 0101 01

Note: On the left side of the binary point, the first pair has only one digit, and on
the right side, the last pair has only two-digit. To make them complete pairs of four
bits, add zeros on extreme sides.

0000 0110 1010 . 0101 0100

3. Write the hexadecimal digits, which correspond to each pair.

0000 0110 1010 . 0101 0100


0 6 A . 5 4

Answer: 6A.5416

13 | P a g e
BTC 215 – Digital Electronics

Hexadecimal to other Number System

Like binary, decimal, and octal, hexadecimal numbers can also be


converted into other number systems. Let's start understanding how
conversion is done.

Hexadecimal to Binary Conversion

The process of converting hexadecimal to binary is the reverse


process of binary to hexadecimal. You only need to write the four bits
binary code of each hexadecimal number digit.

Example: Convert 152A.2516 to binary

1. Write the four-bit binary digit for 1, 5, A, 2, and 5.


Hexa 1 5 2 A . 2 5
Binary 0001 0101 0010 1010 . 0010 0101

So, the binary number of the hexadecimal number 152A.2516 is


1010100101010.001001012

Binary to Hexadecimal Conversion

The base numbers of binary and hexadecimal are 2 and 16,


respectively. In a binary number, the pair of four bits is equal to one
hexadecimal digit. There are also only two steps to convert a binary
number into a hexadecimal number which are as follows:

1. Make the pairs of four bits on both sides of the binary point. If there
will be one, two, or three bits left in a pair of four bits pair, we add
the required number of zeros on extreme sides.
2. Write the hexadecimal digits corresponding to each pair.

14 | P a g e
BTC 215 – Digital Electronics

Example: Convert 10110101011.00112 to hexadecimal

1. Make pairs of four bits on both sides of the binary point.


111 1010 1011 . 0011

On the left side of the binary point, the first pair has three bits. To
make it a complete pair of four bits, add one zero on the extreme side.

0111 1010 1011 . 0011

2. Write the hexadecimal digits, which correspond to each pair.

0111 1010 1011 . 0011


7 A B . 3

So, the hexadecimal number of the binary number 011110101011.00112


is 7AB.316

Hexadecimal to Octal Conversion

Same as the conversion of octal to hexadecimal, there are three steps

required to perform hexadecimal to octal conversion, which are as follows:

1. Find the binary equivalent of the hexadecimal number.

2. Make the pairs of three bits on both sides of the binary point. If

there will be one or two bits left in a pair of three bits pair, add the

required number of zeros on extreme sides

3. Write the octal digits corresponding to each pair.

15 | P a g e
BTC 215 – Digital Electronics

Example: Convert 152A.2516 to octal

1. Write the four-bit binary digit for 1, 5, A, 2, and 5.


Hexa 1 5 2 A . 2 5
Binary 0001 0101 0010 1010 . 0010 0101

So, the binary number of the hexadecimal number 152A.2516 is


(1010100101010.00100101)2

2. Make pairs of three bits on both sides of the binary point.

001 010 100 101 010 . 001 001 010

3. Write the octal digit, which corresponds to each pair.

001 010 100 101 010 . 001 001 010


1 2 4 5 2 . 1 1 2

So, the octal number of the hexadecimal number 152A.2516 is


12452.1128

Hexa-decimal to Decimal Conversion

The process of converting hexadecimal to decimal is the same as

binary to decimal. The process starts from multiplying the digits of

hexadecimal numbers with its corresponding positional weights. And

lastly, add all those products.

16 | P a g e
BTC 215 – Digital Electronics

Example: Convert 152A.2516 to decimal

1. Multiply each digit of 152A.25 with its respective positional weight

Positional
163 162 161 160 . 16-1 16-2
Weight
Hexadecimal
1 5 2 A . 2 5
Numbers
Equivalent 4096 256 16 1 . 1/16 1/256

152A.2516=(1×163)+(5×162)+(2×161)+(A×160)+(2×16-1)+(5×16-2)
152A.2516=(1×4096)+(5×256)+(2×16)+(10×1)+(2×1⁄16)+(5×1⁄256)

2. Add the products of all the bits with its weight.

152A.2516=4096+1280+32+10+0.125+0.125
152A.2516=5418.14453125

So, the decimal number of the hexadecimal number 152A.25 is

5418.144531251

Decimal to hexadecimal conversion

For converting decimal to hexadecimal, there are two steps required

to perform, which are as follows:

1. Perform the division operation on the integer and the successive

quotient with the base of hexadecimal (16).

2. Perform the multiplication on the integer and the successive

quotient with the base of hexadecimal (16).

17 | P a g e
BTC 215 – Digital Electronics

Example: Convert 152.2510 to hexadecimal

1. Divide the number 152 and its successive quotients with base 8.
Operation Quotient Remainder
152/16 9 8 LSB
9/16 0 9 MSB

So, the Hexadecimal value of 15210 = 9816

2. Now perform the multiplication of 0.25 and successive fraction


with base 16.
Operation Quotient Remainder
0.25×16 0 4

So, the Hexadecimal value of .2510 = 416

Therefore, the Hexadecimal number of the decimal number 152.25 is

98.416

Closure

Having been explained the concept & importance of the other digital

number systems such as the octal and hexadecimal numbers, we can now explore

in the next lesson which will be about binary codes. The next lesson will deepen

our insights on how the digital system using binary translates the reality of today’s

world.

18 | P a g e
BTC 215 – Digital Electronics

References

BOOKS/eBOOKS

1. Balch, M. Complete Digital Design. Copyright 2003


2. Bignell, J..Digital Electronics. Copyright 2007
3. Comer, D..Advanced Electronic Circuit and Design. Copyright 2003
4. Crowe, J. et.al. Introduction to Digital Electronics.
5. Predko, Myke. Digital Electronics Demystified. Copyright 2005
6. Tokheim, Roger L. Digital Electronics Principles Applications
Seventh Edition

WEBSITE

Anon. 2018. “Uses of Hexadecimal | Hexadecimal & Character Sets |


Computer Science.” Teach Computer Science. Retrieved August 28,
2020 (https://teachcomputerscience.com/uses-of-hexadecimal/).

Anon. n.d. “Octal Number System.” Retrieved August 28, 2020


(https://www.tutorialspoint.com/octal-number-system).

Anon. n.d. “Number System in Digital Electronics Tutorial - Javatpoint.”


Www.Javatpoint.Com. Retrieved August 12, 2020
(https://www.javatpoint.com/number-system-in-digital-electronics).

19 | P a g e
BTC 215 – Digital Electronics

20 | P a g e

You might also like