0% found this document useful (0 votes)
13 views25 pages

STLC 01 Content

Uploaded by

elijah boquila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views25 pages

STLC 01 Content

Uploaded by

elijah boquila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Republic of the Philippines

NUEVA VIZCAYA STATE UNIVERSITY


Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023

College of Engineering
Bambang Campus

DEGREE Bachelor of Science in COURSE NO. ECE9


PROGRAM Electronics Engineering
SPECIALIZATION Instrumentation & COURSE TITLE Logic Circuits and Switching Theory
Control
YEAR LEVEL 3rd Year TIME FRAME 18 hrs WK NO. 1-3 IM 01
NO.

I. UNIT TITLE/CHAPTER TITLE

Number System & Number Conversion System

II. LESSON TITLE

Number System & Number Conversion System

1. Introduction
2. Different Radices of Number Systems
3. Conversion of Different Conversion Systems
4. Mathematical Operations of the Different Conversion Systems

III. LESSON OVERVIEW

This lesson is an introduction to the different number systems, which are used for communication
between a digital electronic component to its end-users. This module includes introduction to binary
number system, octal number system, decimal number system, and hexadecimal number system. It
also includes the conversion between the different number systems, which helps end-users better
understand the behavior of a digital component.

IV. DESIRED LEARNING OUTCOMES

At the end of the lesson, the students should be able to:

1. Identify the different number systems and codes;


2. Differentiate between the different number systems; and,
3. Convert a number given in a specific number system into another number system.

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 1 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
V. LESSON CONTENT

1-1 INTRODUCTION

Digital systems have such a prominent role in everyday life that we refer to the present technological
period as the digital age. Digital systems are used in communication, business transactions, traffic
control, spacecraft guidance, medical treatment, weather monitoring, the Internet, and many other
commercial, industrial, and scientific enterprises. We have digital telephones, digital televisions, digital
versatile discs, digital cameras, handheld devices, and, of course, digital computers. We enjoy music
downloaded to our portable media player (e.g., iPod Touch TM) and other handheld devices having high-
resolution displays. These devices have graphical user interfaces (GUIs), which enable them to
execute commands that appear to the user to be simple, but which, in fact, involve precise execution of
a sequence of complex internal instructions. Most, if not all, of these devices have a special-purpose
digital computer embedded within them. The most striking property of the digital computer is its
generality. It can follow a sequence of instructions, called a program, that operates on given data. The
user can specify and change the program or the data according to the specific need. Because of this
flexibility, general-purpose digital computers can perform a variety of information-processing tasks that
range over a wide spectrum of applications.
One characteristic of digital systems is their ability to represent and manipulate discrete
elements of information. Any set that is restricted to a finite number of elements contains discrete
information. Examples of discrete sets are the 10 decimal digits, the 26 letters of the alphabet, the 52
playing cards, and the 64 squares of a chessboard. Early digital computers were used for numeric
computations. In this case, the discrete elements were the digits. From this application, the term
digital computer emerged. Discrete elements of information are represented in a digital system by
physical quantities called signals. Electrical signals such as voltages and currents are the most
common. Electronic devices called transistors predominate in the circuitry that implements these
signals. The signals in most present-day electronic digital systems use just two discrete values and are
therefore said to be binary. A binary digit, called a bit, has two values: 0 and 1. Discrete elements of
information are represented with groups of bits called binary codes. For example, the decimal digits 0
through 9 are represented in a digital system with a code of four bits (e.g., the number 7 is represented
by 0111). How a pattern of bits is interpreted as a number depends on the code system in which it
resides. To make this distinction, we could write (0111) 2 to indicate that the pattern 0111 is to be
interpreted in a binary system, and (0111)10 to indicate that the reference system is decimal. Then
01112 = 710, which is not the same as 011110, or one hundred eleven. The subscript indicating the base
for interpreting a pattern of bits will be used only when clarification is needed. Through various
techniques, groups of bits can be made to represent discrete symbols, not necessarily numbers, which
are then used to develop the system in a digital format. Thus, a digital system is a system that
manipulates discrete elements of information represented internally in binary form. In today’s
technology, binary systems are most practical because, as we will see, they can be implemented with
electronic components.
Discrete quantities of information either emerge from the nature of the data being processed or
may be quantized from a continuous process. On the one hand, a payroll schedule is an inherently
discrete process that contains employee names, social security numbers, weekly salaries, income
taxes, and so on. An employee’s paycheck is processed by means of discrete data values such as
letters of the alphabet (names), digits (salary), and special symbols (such as ₽). On the other hand, a
research scientist may observe a continuous process, but record only specific quantities in tabular form.
The scientist is thus quantizing continuous data, making each number in his or her table a discrete
quantity. In many cases, the quantization of a process can be performed automatically by an analog-
to-digital converter, a device that forms a digital (discrete) representation of an analog (continuous)
quantity.
The general-purpose digital computer is the best-known example of a digital system. The major
parts of a computer are a memory unit, a central processing unit, and input-output units. The memory

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 2 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
unit stores programs as well as input, output, and intermediate data. The central processing unit
performs arithmetic and other data-processing operations as specified by the program. The program
and data prepared by a user are transferred into memory by means of an input device such as a
keyboard. An output device, such as a printer, receives the results of the computations, and the printed
results are presented to the user. A digital computer can accommodate many input and output devices.
One very useful device is a communication unit that provides interaction with other users through the
Internet. A digital computer is a powerful instrument that can perform not only arithmetic computations,
but also logical operations. In addition, it can be programmed to make decisions based on internal and
external conditions.
A digital system is an interconnection of digital modules. To understand the operation of
each digital module, it is necessary to have a basic knowledge of digital circuits and their
logical function. The aim of this subject is to present the basic tools of digital design, such as logic
gate structures, combinational and sequential circuits, and programmable logic devices.
1-2 BINARY NUMBERS

A decimal number such as 7,392 represents a quantity equal to 7 thousands, plus 3 hundreds, plus 9
tens, plus 2 units. The thousands, hundreds, etc., are powers of 10 implied by the position of the
coefficients (symbols) in the number. To be more exact, 7,392 is a shorthand notation for what should
be written as
3 2 1 0
7 ×10 +3 × 10 + 9 ×10 +2 ×10
However, the convention is to write only the numeric coefficients and, from their position, deduce the
necessary powers of 10 with powers increasing from right to left. In general, a number with a decimal
point is represented by a series of coefficients:
a 5 a 4 a3 a2 a1 a0 . a−1 a−2 a−3

The coefficients a j are any of the 10 digits (0, 1, 2, … , 9), and the subscript value j gives the place
value and, hence, the power of 10 by which the coefficient must be multiplied. Thus, the preceding
decimal number can be expressed as
5 4 3 2 1 0 −1 −2 −3
10 a5 +10 a4 +10 a 3+10 a 2+ 10 a 1+10 a0 +10 a−1+10 a−2 +10 a−3

with a 3=7, a 2=3, a 1=9, and a 0=2.

The decimal number system is said to be of base, or radix, 10 because it uses 10 digits and the
coefficients are multiplied by powers of 10. The binary system is a different number system. The
coefficients of the binary system have only two possible values: 0 and 1. Each coefficient a j is
multiplied by a power of the radix, e.g., 2 j, and the results are added to obtain the decimal equivalent of
the number. The radix point (e.g., the decimal point when 10 is the radix) distinguishes positive powers
of 2 from negative powers of 2. For example, the decimal equivalent of the binary number 11010.11 is
26.75, as shown from the multiplication of the coefficients by powers of 2:
4 3 2 1 0 −1 −2
1 ×2 +1 ×2 + 0× 2 + 1× 2 + 0× 2 +1× 2 +1× 2 =26.75
There are many different number systems. In general, a number expressed in a base-r system has
coefficients multiplied by powers of r:
n n−1 2 1 0 −1 −2 −m
a n ⋅r + an−1 ⋅ r + …+a 2 ⋅r +a 1 ⋅r +a 0 r + a−1 ⋅r +a−2 ⋅ r +…+ a−m ⋅r

The coefficients a j range in value from 0 to r −1. To distinguish between numbers of different bases,
we enclose the coefficients in parentheses and write a subscript equal to the base used (except
sometimes for decimal numbers, where the content makes it obvious that the base is decimal). An
example of a base-5 number is
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 3 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
( 4021.2 )5 =4 × 53 +0 ×52 +2 ×51 +1 ×50 +2 ×5−1=( 511.4 )10
The coefficient values for base 5 can be only 0, 1, 2, 3, and 4. The octal number system is a base-8
system that has eight digits: 0, 1, 2, 3, 4, 5, 6, 7. An example of an octal number is 127.4. To
determine its equivalent decimal value, we expand the number in a power series with a base of 8:

( 127.4 )8=1 ×82 +2 ×8 1+7 × 80 + 4 ×8−1=( 87.5 )10


Note that the digits 8 and 9 cannot appear in an octal number.
It is customary to borrow the needed r digits for the coefficients from the decimal system when
the base of the number is less than 10. The letters of the alphabet are used to supplement the 10
decimal digits when the base of the number is greater than 10. For example, in the hexadecimal
(base-16) number system, the first 10 digits are borrowed from the decimal system. The letters A, B, C,
D, E, and F are used for the digits 10, 11, 12, 13, 14, and 15, respectively. An example of a
hexadecimal number is

( B 65 F )16=11×16 3 +6 ×16 2+5 ×16 1+ 15× 160= ( 46,687 )10


The hexadecimal system is used commonly by designers to represent long strings of bits in the
addresses, instructions, and data in digital systems. For example, B 65 F is used to represent
1011011001010000.
As noted before, the digits in a binary number are called bits. When a bit is equal to 0 , it does
not contribute to the sum during the conversion. Therefore, the conversion from binary to decimal can
be obtained by adding only the numbers with powers of two corresponding to the bits that are equal to
1. For example,

( 110101 )2 =32+ 16+4 +1=( 53 )10


There are four 1’s in the binary number. The corresponding decimal number is the sum of the
four powers of two. Zero and the first 24 numbers obtained from 2 to the power of n are listed in the
table below. In computer work, 210 is referred to as K (kilo), 220 as M (mega), 230 as G (giga), and 240 as
T (tera). Thus, 4 K¿ 212=4,096 and 16 M¿ 224=16,777,216 . Computer capacity is usually given in bytes.
A byte is equal to eight bits and can accommodate (i.e., represent the code of) one keyboard character.
A computer hard disk with four gigabytes of storage has a capacity of 4 G¿ 232 bytes (approximately 4
billion bytes). A terabyte is 1024 gigabytes, approximately 1 trillion bytes.
n n n
n 2 n 2 n 2
0 1 8 256 16 65,536
1 2 9 512 17 131,072
2 4 10 1,024 (1K) 18 262,144
3 8 11 2,048 19 524,288
4 16 12 4,096 (4K) 20 1,048,576 (1M)
5 32 13 8,192 21 2,097,152
6 64 14 16,384 22 4,194,304
7 128 15 32,768 23 8,388,608

Arithmetic operations with numbers in base r follow the same rules as for decimal numbers.
When a base other than the familiar base 10 is used, one must be careful to use only the r -allowable
digits. Examples of addition, subtraction, and multiplication of two binary numbers are as follows:
.

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 4 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
augend: 101101 minuend: 101101 multiplicand: 1011
addend: +100111 subtrahend: −100111 multiplier: ×101
sum: 1010100 difference: 000110 1011
0000
partial product: 1011
product: 110111

The sum of two binary numbers is calculated by the same rules as in decimal, except that the
digits of the sum in any significant position can be only 0 or 1. Any carry obtained in a given significant
position is used by the pair of digits one significant position higher. Subtraction is slightly more
complicated. The rules are still the same as in decimal, except that the borrow in a given significant
position adds 2 to a minuend digit. (A borrow in the decimal system adds 10 to a minuend digit.)
Multiplication is simple: The multiplier digits are always 1 or 0 ; therefore, the partial products are equal
either to a shifted (left) copy of the multiplicand or to 0 .

1-3 NUMBER-BASE CONVERSIONS

The binary number system uses only two symbols (0, 1). It is said to have a radix of 2 and is commonly
called the base 2 number system. Each binary digit is called a bit.

Decimal Binary count


count 16s 8s 4s 2s 1s
0 0
1 1
2 1 0
3 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
16 1 0 0 0 0
17 1 0 0 0 1
18 1 0 0 1 0
19 1 0 0 1 1
24 23 22 21 20
Powers of 2

Counting in binary is illustrated above. The binary number is shown on the right with its decimal
equivalent on the left. The rightmost bit is called the least significant bit (LSB) and the leftmost bit is
called the most significant bit (MSB).
If a 1 appears in the right column, a 1 is added to the binary count. The second place from the right is
the 2s place and a 1 appearing in this column means that 2 is added to the count. It is customary in
digital electronics to memorize at least the binary counting sequence from 0000 to 1111 (read as one-
one-one-one) or decimal 15.
Binary-to-decimal Conversion
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 5 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
A binary number can be converted to decimal by forming the sum of the powers of 2 of those
coefficients whose value is 1. For a binary number with position convention …a3a2a1a0 . a–1a–2a–3…, the
sum of the powers of 2 is

⋯+ ( a3 ×23 ) + ( a2 ×22 ) + ( a1 ×21 ) + ( a0 ×20 ) + ( a−1 × 2−1 ) + ( a¿2 ×2−2) + ( a−3 × 2−3 ) + …

For example

( 1010.011 )2 =( 1× 23 ) + ( 0 ×2 2) + ( 1× 21 )+ ( 0 ×20 ) + ( 0 ×2−1 ) + ( 1 ×2−2 )+ ( 1× 2−3 )

8+ 0+2+0+0.25+ 0.125=( 10.375 )10


Decimal-to-binary Conversion
For a whole decimal number …d3d2d1d0:
- First divide the decimal number by 2 to obtain the LSB (a0) – but the quotient is not the LSB.
The remainder determines the bit. For a number that is divided by 2, there are only two
possible remainders: a 1 or a 0. After first dividing by 2, if the remainder is 1 then a0 is a 1, but if
the remainder is 0 then a0 is a 0.
- If the integer quotient in the first division is not a 0, divide it again by 2 getting its remainder for
the second LSB a1.
- If the integer quotient in the second division is not a 0, divide it again by 2 getting its remainder
for the third LSB a2.
- Continue on until the integer quotient becomes 0.
For example, to convert decimal 41 to binary

Integer
Remainder/2 Coefficient
quotient
41 1
¿ 20 +¿ a 0=1
2 2
20
¿ 10 +¿ 0 a 1=0
2
10
¿ 5 +¿ 0 a 2=0
2
5 1
¿ 2 +¿ a 3=1
2 2
2
¿ 1 +¿ 0 a 4=0
2
1 1
¿ 0 +¿ a 5=1
2 2

Answer: ( 41 )10 =( a5 a 4 a3 a2 a1 a0 )2= (101001 )2

For a decimal number less than 1, 0.d–1d–2d–3…


- First multiply the number by 2 to give an integer and a fraction. The integer determines a–1.
- Multiply the new fraction by 2 having the new integer determine a–2.
- Continue multiplying until the fraction becomes zero.
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 6 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
NOTE: A zero is never a fraction. The term used here is only to help you understand the concept of
number conversion.

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 7 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
For example, to convert ( 0.6875 )10 to binary

Integer Fraction Coefficient

0.6875 ×2=¿ 1 +¿ 0.375 a−1=1

0.375 ×2=¿ 0 +¿ 0.75 a−2=0

0.75 ×2=¿ 1 +¿ 0.5 a−3=1

0.5 ×2=¿ 1 +¿ 0 a−4 =1

Answer: ( 0.6875 )10= ( 0. a−1 a−2 a−3 a−4 )2=( 0.1011 )2

EXAMPLE 1.1 Convert the following binary numbers to their decimal equivalents:
(a) 111100011112 = ____________10
(b) 11100.0112 = ___________10
(c) 110011.100112 = __________10
SOLUTION:
(a) 111100011112 = (1 x 210) + (1 x 29) + (1 x 28) + (1 x 27) + (0 x 26) + (0 x 25) + (0 x 24) + (1 x 23) + (1 x
22) + (1 x 21)
+ (1 x 20)
= 1024 + 512 + 256 + 128 + 0 + 0 + 0 + 8 + 4 + 2 + 1
= 193510
(b) 11100.0112 = (1 x 24) + (1 x 23) + (1 x 22) + (0 x 21) + (0 x 20) + (0 x 2–1) + (1 x 2–2) + (1 x 2–3)
= 16 + 8 + 4 + 0 + 0 + 0 + 0.25 + 0.125
= 28.37510
(c) 110011.100112 = (1 x 25) + (1 x 24) + (1 x 21) + (1 x 20) + (1 x 2–1) + (1 x 2–4) + (1 x 2–5)
= 32 + 16 + 2 + 1 + 0.5 + 0.0625 + 0.03125
= 51.5937510
EXAMPLE 1.2 Convert the following decimal numbers to their binary equivalents:
(a) 6410 = ___________2
(b) 14510 = ___________2
(c) 25510 = ___________2
(d) 34.7510 = ____________2
(e) 27.187510 = ____________2
SOLUTION:
(a) 6410 = ?

Integer
Remainder/2 Coefficient
quotient
64
¿ 32 +¿ 0 a 0=0
2
32
¿ 16 +¿ 0 a 1=0
2

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 8 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
16
¿ 8 +¿ 0 a 2=¿0
2
8
¿ 4 +¿ 0 a 3=¿0
2
4
¿ 2 +¿ 0 a 4=0
2
2
¿ 1 +¿ 0 a 5=0
2
1 0 1
¿
ends the +¿ a 6=1
2conversion
2
6410 = a6a5a4a3a2a1a0 = 10000002
(b) 14510 = ?

Integer
Remainder/2 Coefficient
quotient
145 1
¿ 72 +¿ a 0=1
2 2
72
¿ 36 +¿ 0 a 1=0
2
36
¿ 18 +¿ 0 a 2=0
2
18
¿ 9 +¿ 0 a 3=0
2
9 1
¿ 4 +¿ a 4=1
2 2
4
¿ 2 +¿ 0 a 5=0
2
2
¿ 1 +¿ 0 a 6=0
2
1 0 1
¿
ends the +¿ a 7=1
2conversion
2
14510 = a7a6a5a4a3a2a1a0 = 100100012
(c) 25510 = ?

Integer
Remainder/2 Coefficient
quotient
255 1
¿ 127 +¿ a 0=1
2 2
127 1
¿ 63 +¿ a 1=1
2 2

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 9 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
63 1
¿ 31 +¿ a 2=1
2 2
31 1
¿ 15 +¿ a 3=1
2 2
15 1
¿ 7 +¿ a 4=1
2 2
7 1
¿ 3 +¿ a 5=1
2 2
3 1
¿ 1 +¿ a 6=1
2 2
1 0 1
¿
ends the +¿ a 7=1
2 conversion
2
25510 = a7a6a5a4a3a2a1a0 = 111111112
(d) 34.7510 = ?

Integer Remainder/
Coefficient
quotient 2
34
¿ 17 +¿ 0 a 0=0
2
17 1
¿ 8 +¿ a 1=1
2 2
8
¿ 4 +¿ 0 a 2=0
2
4
¿ 2 +¿ 0 a 3=0
2
2
¿ 1 +¿ 0 a 4=0
2
0
1 ends the 1
¿ +¿ a 5=1
2 conversio 2
n

Integer Fraction Coefficient

0.75 ×2=¿ 1 +¿ 0.5 a−1=1

0.5 ×2=¿ 1 +¿ 0 a−2=1

34.7510 = a5a4a3a2a1a0 . a–1a–2 = 100010.112


(e) 27.187510 = ?

Integer Remainder/
Coefficient
quotient 2
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 10 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
27 1
¿ 13 +¿ a 0=1
2 2
13 1
¿ 6 +¿ a 1=1
2 2
6
¿ 3 +¿ 0 a 2=0
2
3 1
¿ 1 +¿ a 3=1
2 2
0
1 ends the 1
¿ +¿ a 4=1
2 conversio 2
n

Integer Fraction Coefficient

0.1875 ×2=¿ 0 +¿ 0.375 a−1=0

0.375 ×2=¿ 0 +¿ 0.75 a−2=0

0.75 ×2=¿ 1 +¿ 0.5 a−3=1

0.5 ×2=¿ 1 +¿ 0 a−4 =1

27.187510 = a4a3a2a1a0 . a–1a–2a–3a–4 = 11011.00112


1-4 HEXADECIMAL NUMBERS

The hexadecimal number system has a radix of 16. It is referred to as the base 16 number system. It
uses the symbols 0-9, A, B, C, D, E, and F as shown in the hexadecimal column of the table below.
The letter A stands for a count of 10, B for 11, C for 12, D for 13, E for 14, and F for 15.

Decimal Binary Hexadecimal Decimal Binary Hexadecimal


0 0000 0 16 10000 10
1 0001 1 17 10001 11
2 0010 2 18 10010 12
3 0011 3 19 10011 13
4 0100 4 20 10100 14
5 0101 5 21 10101 15
6 0110 6 22 10110 16
7 0111 7 23 10111 17
8 1000 8 24 11000 18
9 1001 9 25 11001 19
10 1010 A 26 11010 1A
11 1011 B 27 11011 1B
12 1100 C 28 11100 1C
13 1101 D 29 11101 1D
14 1110 E 30 11110 1E
15 1111 F 31 11111 1F
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 11 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023

If a 1 appears in the rightmost hexadecimal digit, a 1 is added to the hexadecimal count. The second
place from the right is the 16s place and a 1 appearing in this digit position means that 16 is added to
the count.
Hexadecimal-to-decimal Conversion
A hexadecimal number can be converted to decimal by forming the sum of the powers of 16. For a
hexadecimal number with position convention …h3h2h1h0 . h–1h–2h–3…, the sum of the powers of 16 is

⋯+ ( h3 × 163 ) + ( h2 ×162 ) + ( h1 ×161 ) + ( h0 ×16 0 ) + ( h−1 × 16−1 ) + ( h¿ 2 ×16−2 ) + ( h−3 ×16−3 ) +…

For example, to convert hexadecimal B65F to decimal, first remember that A 16 = 1010, B16 = 1110, C16 =
1210, D16 = 1310, E16 = 1410, and F16 = 1510. Then form the sum of the powers of 16.

( B 65 F )16=( 11× 163 ) + ( 6 × 162 ) + ( 5 ×16 1 )+ ( 15 ×160 ) =( 46,687 )10


Decimal-to-hexadecimal Conversion
For a whole decimal number …d3d2d1d0:
- First divide the decimal number by 16 to obtain the rightmost digit (h0). The remainder
determines the digit. For a number that is divided by 16, there are sixteen possible remainders:
from 0 to 15. If the remainder is from 0 to 1 then h0 is from 0 to 1, respectively. But if the
remainder is 10 then h0 is a A; if it is 11 then h0 is a B; C for 12; D for 13; E for 14; and, F for 15.
- If the integer quotient in the first division is not a 0, divide it again by 16 getting its remainder for
the second rightmost digit h1.
- If the integer quotient in the second division is not a 0, divide it again by 16 getting its remainder
for the third rightmost digit h2.
- Continue on until the integer quotient becomes 0.
For example, to convert decimal 2560 to hexadecimal

Integer
Remainder/16 Coefficient
quotient
2560
¿ 160 +¿ 0 h 0=0
16
160
¿ 10 +¿ 0 h1=0
16
10 10
¿ 0 +¿ h2 =A
16 16

Answer: ( 2560 )10=( h2 h1 h 0 )16=( A 00 )16

For a decimal number less than 1, 0.d–1d–2d–3…


- First multiply the number by 16 to give an integer and a fraction. The integer determines h–1.
- Multiply the new fraction by 16 having the new integer determine h–2.
- Continue multiplying until the fraction becomes zero.

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 12 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
For example, to convert ( 0.6875 )10 to hexadecimal

Integer Fraction Coefficient

0.6875 ×16=¿ 11 +¿ 0 h−1=B

Answer: ( 0.6875 )10= ( 0. h−1 )16=( 0. B )16

EXAMPLE 1.3 Convert the following hexadecimal numbers to their decimal equivalents:
(a) F.416 = ____________10
(b) D3.E16 = ___________10
(c) 1111.116 = __________10
(d) 888.816 = __________10
(e) EBA.C16 = __________10
SOLUTION:
(a) F.416 = (15 x 160) + (4 x 16–1)
= 15 + 0.25
= 15.2510
(b) D3.E16 = (13 x 161) + (3 x 160) + (14 x 16–1)
= 208 + 3 + 0.875
= 211.087510
(c) 1111.116 = (1 x 163) + (1 x 162) + (1 x 161) + (1 x 160) + (1 x 16–1)
= 4096 + 256 + 16 + 1 + 0.0625
= 4369.062510
(d) 888.816 = (8 x 162) + (8 x 161) + (8 x 160) + (8 x 16–1)
= 2048 + 128 + 8 + 0.5
= 2184.510
(e) EBA.C16 = (14 x 162) + (11 x 161) + (10 x 160) + (12 x 16–1)
= 3584 + 176 + 10 + 0.75
= 3770.7510
EXAMPLE 1.4 Convert the following decimal numbers to their hexadecimal equivalents:
(a) 810 = ___________16
(b) 6410 = ___________16
(c) 25510 = ___________16
(d) 204.12510 = ____________16
(e) 631.2510 = ____________16
(f) 10 000.003 906 2510 = ____________16
SOLUTION:
(a) 810 = ?

Integer
Remainder/16 Coefficient
quotient
8 8
¿ 0 +¿ h 0=8
16 16
810 = h0 = 816

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 13 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
(b) 6410 = ?

Integer
Remainder/16 Coefficient
quotient
64
¿ 4 +¿ 0 h 0=0
16
4 4
¿ 0 +¿ h1=4
16 16
6410 = h1h0 = 4016
(c) 25510 = ?

Integer
Remainder/16 Coefficient
quotient
255 15
¿ 15 +¿ h 0=F
16 16
15 15
¿ 0 +¿ h1=F
16 16
25510 = h1h0 = FF16
(d) 204.12510 = ____________16

Integer
Remainder/16 Coefficient
quotient
204 12
¿ 12 +¿ h 0=C
16 16
12 12
¿ 0 +¿ h1=C
16 16

Integer Fraction Coefficient

0.125 ×16=¿ 2 +¿ 0 h−1=2

204.12510 = h1h0 . h–1 = CC.216


(e) 631.2510 = ____________16

Integer
Remainder/16 Coefficient
quotient
631 7
¿ 39 +¿ h 0=7
16 16
39 7
¿ 2 +¿ h1=7
16 16
2 2
¿ 0 +¿ h2 =2
16 16

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 14 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
Integer Fraction Coefficient

0.25 ×16=¿ 4 +¿ 0 h−1=4

631.2510 = h2h1h0 . h–1 = 277.416


(f) 10 000.003 906 2510 = ____________16

Integer
Remainder/16 Coefficient
quotient
10000
¿ 625 +¿ 0 h 0=0
16
625 1
¿ 39 +¿ h1=1
16 16
39 7
¿ 2 +¿ h2 =7
16 16
2 2
¿ 0 +¿ h3 =2
16 16

Integer Fraction Coefficient

0.00390625 ×16=¿ 0 +¿ 0.0625 h−1=0

0.0625 ×16=¿ 1 +¿ 0 h−2=1

10 000.003 906 2510 = h3h2h1h0 . h–1h–2 = 2710.1016


Binary-to-Hexadecimal Conversion
The prime advantage of the hexadecimal system is its easy conversion to binary. Since 2 4 = 16, each
hexadecimal digit corresponds to four binary digits. The first 16 numbers in the decimal, binary, and
hexadecimal number systems are listed in the table below.

Decimal Binary Hexadecimal


(base 10) (base 2) (base 16)
00 0000 0
01 0001 1
02 0010 2
03 0011 3
04 0100 4
05 0101 5
06 0110 6
07 0111 7
08 1000 8
09 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 15 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
The conversion from binary to hexadecimal is easily accomplished by partitioning the binary number
into groups of four digits each, starting from the binary point and proceeding to the left and to the right.
The corresponding hexadecimal digit is then assigned to each group. The following example illustrates
the procedure:
( 10 1100 0110 1011 . 1111 0010 )2 = ( 2C6B.F2 )16
2 C 6 B F 2
Hexadecimal-to-Binary Conversion
Conversion for hexadecimal to binary is done by reversing the preceding procedure. Each
hexadecimal digit is converted to its four-digit binary equivalent. The procedure is illustrated in the
following example:
(306.D)16 = (0011 0000 0110 . 1101)2
3 D 6 D
EXAMPLE 1.5 Convert the following hexadecimal numbers to their binary equivalents:
(a) B16 = ____________2
(b) E16 = ___________2
(c) 1C16 = __________2
(d) A6416 = __________2
(e) 1F.C16 = __________2
(f) 239.416 = __________2
SOLUTION:
(a) B16 = (B  1011) = 10112
(b) E16 = (E  1110) = 11102
(c) 1C16 = (1  0001) (C  1100) = 0001 11002 = 1 11002
(d) A6416 = (A  1010) (6  0110) (4  0100) = 1010 0110 01002
(e) 1F.C16 = (1  0001) (F  1111) . (C  1100) = 0001 1111 . 11002 = 1 1111 . 112
(f) 239.416 = (2  0010) (3  0011) (9  1001) . (4  0100) = 0010 0011 1001 . 01002 = 10 0011
1001 . 012
EXAMPLE 1.6 Convert the following binary numbers to their hexadecimal equivalents:
(a) 1001.11112 = ___________16
(b) 10000001.11012 = ___________16
(c) 110101.0110012 = ___________16
(d) 10000.12 = ____________16
(e) 10100111.1110112 = ____________16
(f) 1000000.00001112 = ____________16
SOLUTION:
(a) 1001.11112 = (1001  9) . (1111  F) = 9.F16
(b) 10000001.11012 = 1000 0001 . 11012 = (1000  8) (0001  1) . (1101  D) = 81.D16
(c) 110101.0110012 = 11 0101.0110 012 = 0011 0101.0110 01002 = (0011  3) (0101  5) . (0110 
6) (0100  4)
= 35.6416
(d) 10000.12 = 1 0000 . 12 = 0001 0000 . 10002 = (0001  1) (0000  0) . (1000  8) = 10.816
(e) 10100111.1110112 = 1010 0111 . 1110 112 = 1010 0111 . 1110 11002 = (1010  A) (0111  7) .
(1110  E)
(1100  C) = A7.EC16
(f) 1000000.00001112 = 100 0000.0000 1112 = 0100 0000 . 0000 11102 = (0100  4) (0000  0) .
(0000  0)
(1110  E) = 40.0E16

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 16 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 17 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
1-5 OCTAL NUMBERS

The octal number system has a radix of 8. It is referred to as the base 8 number system. It uses the
symbols 0, 1, 2, 3, 4, 5, 6, and 7 as shown in the octal column of the table below. The letter A stands
for a count of 10, B for 11, C for 12, D for 13, E for 14, and F for 15.

Decima
Decimal Binary Octal Binary Octal
l
0 000 0 16 10000 20
1 001 1 17 10001 21
2 010 2 18 10010 22
3 011 3 19 10011 23
4 100 4 20 10100 24
5 101 5 21 10101 25
6 110 6 22 10110 26
7 111 7 23 10111 27
8 1000 10 24 11000 30
9 1001 11 25 11001 31
10 1010 12 26 11010 32
11 1011 13 27 11011 33
12 1100 14 28 11100 34
13 1101 15 29 11101 35
14 1110 16 30 11110 36
15 1111 17 31 11111 37

If a 1 appears in the rightmost octal digit, a 1 is added to the octal count. The second place from the
right is the 8s place and a 1 appearing in this digit position means that 8 is added to the count.
Octal-to-Decimal Conversion
An octal number can be converted to decimal by forming the sum of the powers of 8. For an octal
number with position convention …o3o2o1o0 . o–1o–2o–3…, the sum of the powers of 8 is

⋯+ ( o3 ×83 ) + ( o 2 × 82 ) + ( o1 ×81 ) + ( o 0 × 80 ) + ( o−1 × 8−1 ) + ( o¿ 2 × 8−2 ) + ( o−3 × 8−3 ) + …

For example, to convert octal 623 to decimal

( 623 )8 =( 6 ×8 2 ) + ( 2 ×81 ) + ( 3 × 80 )= ( 403 )10


Decimal-to-Octal Conversion
For a whole decimal number …d3d2d1d0:
- First divide the decimal number by 8 to obtain the rightmost digit (o0). The remainder is the
rightmost digit of the octal number.
- If the integer quotient in the first division is not a 0, divide it again by 8 getting its remainder for
the second rightmost digit o1.
- If the integer quotient in the second division is not a 0, divide it again by 8 getting its remainder
for the third rightmost digit o2.
- Continue on until the integer quotient becomes 0.
For example, to convert decimal 225 to octal

Integer
Remainder/8 Coefficient
quotient
225
¿ 28 +¿ 1 o 0=1
8

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 18 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
28 4
¿ 3 +¿ o 1=4
8 8
3 3
¿ 0 +¿ o 2=3
8 8

Answer: ( 225 )10=( o2 o1 o 0 )8=( 341 )8

For a decimal number less than 1, 0.d–1d–2d–3…


- First multiply the number by 8 to give an integer and a fraction. The integer determines o–1.
- Multiply the new fraction by 8 having the new integer determine o–2.
- Continue multiplying until the fraction becomes zero.

For example, to convert ( 0.046875 )10 to octal

Integ Fractio Coefficie


er n nt

0.046875 × 8=¿ 0 +¿ 0.375 o−1=0

0.375 × 8=¿ 3 +¿ 0 o−2=3

Answer: ( 0.046875 )10= ( 0. o−1 o−2 )8=( 0.03 )8

Binary-to-Octal Conversion
As with the hexadecimal system, the prime advantage of the octal system is its easy conversion to
binary. Since 23 = 8, each octal digit corresponds to three binary digits. The first 16 numbers in the
decimal, binary, octal, and hexadecimal number systems are listed in the table below.

Octal
Decimal Binary Hexadecimal
(base
(base 10) (base 2) (base 16)
8)
00 0000 00 0
01 0001 01 1
02 0010 02 2
03 0011 03 3
04 0100 04 4
05 0101 05 5
06 0110 06 6
07 0111 07 7
08 1000 10 8
09 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

The conversion from binary to octal is easily accomplished by partitioning the binary number into
groups of three digits each, starting from the binary point and proceeding to the left and to the right.
The corresponding octal digit is then assigned to each group. The following example illustrates the
procedure:
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 19 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
( 10 110 001 101 011 . 111 100 000 110 ) 2 = ( 26153.7406 )16
2 6 1 5 3 7 4 0 6
Octal-to-Binary Conversion
Conversion from octal to binary is done by reversing the preceding procedure. Each octal digit is
converted to its three-digit binary equivalent. The procedure is illustrated in the following example:
(673.124)8 = (110 111 011 . 001 010 100)2
6 7 3 1 2 4
Octal-to-Hexadecimal Conversion
There are numbered ways on how to convert an octal number to hexadecimal. The simplest is to first
convert the octal number into its binary equivalent and then converting the binary number into
hexadecimal.
For example, to convert 158 to hexadecimal
(15)8 = (001 101)2
1 5
(0000 1101)2 = (D)16
0 D
Hexadecimal-to-Octal Conversion
As with the octal-to-hexadecimal conversion, the simplest technique is to first convert the hexadecimal
number into its binary equivalent and then converting the binary number into octal.
1-6 COMPLEMENTS

Complements are used in digital computers for simplifying the subtraction operation and for logical
manipulation. There are two types of complements for each base-r system: the radix complement (r’s
complement) and the diminished radix complement ((r – 1)’s complement).
- For binary: 2’s complement & 1’s complement
- For decimal: 10’s complement & 9’s complement
(r – 1)’s Complement
Given a number N in base r having n integer digits and m fractional digits, the (r – 1)’s complement of N
is defined as r n −r−m −N . For decimal numbers, r = 10 and r – 1 = 9, so the 9’s complement of N is
n −m
10 −10 −N .
For example, to get the 9’s complement of 546700, first count the number of integer digits (6 in this
example).
The 9’s complement of 546700 is (106 – 1) – 546700 = 999999 – 546700 = 453299.
Also,
The 9’s complement of 012398 is (106 – 1) – 012398 = 999999 – 012398 = 987601.
REMARKS: The zeros at the beginning of a number are also considered for the complements as long
as it is defined.

For binary numbers, r = 2 and r – 1 = 1, so the 1’s complement of N is 2n−2−m−N .

For example, to get the 1’s complement of 1011000 (with 7 number of integer bits), first convert (2 7)10 to
its binary equivalent before performing the subtraction.
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 20 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
The 1’s complement of 1011000 is (27 – 1) – 1011000 = 1111111 – 1011000 = 0100111.
Also,
The 1’s complement of 0101101 is (27 – 1) – 0101101 = 1111111 – 0101101 = 1010010.
REMARKS:
- The 1’s complement of a binary number is formed by changing 1’s to 0’s and 0’s to 1’s.
- Notice that the number of digits is also the number of 1’s (9’s in decimal) used in the
subtraction.
- Generally, the (r – 1)’s complement of any number is obtained by subtracting each given digit
from the base-r system’s (r – 1)’s.

The (r – 1)’s complement of octal or hexadecimal numbers is obtained by subtracting each digit from
7’s or F’s (decimal 15), respectively.
EXAMPLE 1.7 Obtain the diminished radix complement of the following binary numbers:
(a) 10000000
(b) 11011010
(c) 10000101
(d) 00000000
(e) 01110110
(f) 11111111
SOLUTION:
(a) The 1’s complement of 1000 0000 is (28 – 1) – 1000 0000 = 1111 1111 – 1000 0000 = 0111 1111
(b) The 1’s complement of 1101 1010 is (28 – 1) – 1101 1010 = 1111 1111 – 1101 1010 = 0010 0101
(c) The 1’s complement of 1000 0101 is (28 – 1) – 1000 0101 = 1111 1111 – 1000 0101 = 0111 1010
(d) The 1’s complement of 0000 0000 is (28 – 1) – 0000 0000 = 1111 1111 – 0000 0000 = 1111 1111
(e) The 1’s complement of 0111 0110 is (28 – 1) – 0111 0110 = 1111 1111 – 0111 0110 = 1000 1001
(f) The 1’s complement of 1111 1111 is (28 – 1) – 1111 1111 = 1111 1111 – 1111 1111 = 0000 0000
EXAMPLE 1.8 Find the 9’s complement of the following decimal numbers:
(a) 52,784,630
(b) 25,000,000
(c) 63,325,600
(d) 00,000,000
SOLUTION:
(a) The 9’s complement of 52,784,630 is (108 – 1) – 52,784,630 = 99,999,999 – 52,784,630 =
47,216,369
(b) The 9’s complement of 25,000,000 is (108 – 1) – 25,000,000 = 99,999,999 – 25,000,000 =
74,999,999
(c) The 9’s complement of 63,325,600 is (108 – 1) – 63,325,600 = 99,999,999 – 63,325,600 =
36,674,399
(d) The 9’s complement of 00,000,000 is (108 – 1) – 00,000,000 = 99,999,999 – 00,000,000 =
99,999,999
EXAMPLE 1.9 (a) Find the diminished radix complement of B2FA16.
(b) Convert B2FA16 to binary.
(c) Find the 1’s complement of the result in (b).
(d) Convert the answer in (c) to hexadecimal and compare with the answer in (a).
SOLUTION:

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 21 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
(a) The 15’s complement of B2FA16 is (164 – 1) – B2FA = FFFF – B2FA = 4D05
(b) B2FA16 = 1011 0010 1111 10102
(c) The 1’s complement of 1011 0010 1111 1010 is 0100 1101 0000 0101
(d) 0100 1101 0000 01012 = 4D0516
r's Complement
The r’s complement of an n-digit number N in base r is defined as rn – N for N ≠ 0 and 0 for N = 0.
Comparing with the (r – 1)’s complement, we note that the r’s complement is obtained by adding 1 to
the (r – 1)’s complement since rn – N = [(rn – 1) – N] + 1. Thus,
The 10’s complement of decimal 2389 is 7610 + 1 = 7611 and is obtained by adding 1 to the
9’s-complement value.
The 2’s complement of binary 101100 is 010011 + 1 = 010100 and is obtained by adding 1 to
the 1’s-complement value.
The 10’s complement of N can be formed also by leaving all least significant 0’s unchanged,
subtracting the first nonzero least significant digit from 10, and subtracting all higher significant digits
from 9.
The 10’s complement of 012398 is 987602.
The 10’s complement of 246700 is 753300.
Similarly, the 2’s complement can be formed by leaving all least significant 0’s and the first 1
unchanged, and replacing 1’s with 0’s and 0’s with 1’s in all other higher significant digits.
The 2’s complement of 1101100 is 0010100.
The 2’s complement of 0110111 is 1001001.
NOTE: The complement of the complement restores the number to its original value.
Subtraction with Complements
The direct method of subtraction taught in elementary schools uses the borrow concept. In this
method, we borrow a 1 from a higher significant position when the minuend digit is smaller than the
subtrahend digit. This seems to be easiest when people perform subtraction with paper and pencil.
When subtraction is implemented with digital hardware, this method is found to be less efficient than
the method that uses complements.
The subtraction of two n-digit unsigned numbers M – N in base r can be done as follows:
1. Add the minuend M to the r’s complement of the subtrahend N. This performs M + (rn – N) = M
– N + rn.
2. If M ≥ N, the sum will produce an end carry, rn, which is discarded; what is left is the result M –
N.
3. If M < N, the sum does not produce an end carry and is equal to rn – (N – M), which is the r’s
complement of (N – M). To obtain the answer in a familiar form, take the r’s complement of the
sum and place a negative sign in front.
The following examples illustrate the procedure.
EXAMPLE 1.10 Using 10’s complement, subtract 72532 – 3250.
SOLUTION:
10’s complement of 03250 96750
add minuend + 72532
sum 1 69282
end carry (1) is discarded since M > N 69282
In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 22 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
Therefore, 72532 – 3250 = 69282

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 23 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
EXAMPLE 1.11 Using 10’s complement, subtract 3250 – 72532.
SOLUTION:
10’s complement of 72532 27468
add minuend + 03250
sum 30718
10’s complement of the sum since M < N 69282
Therefore, 3250 – 72532 = –69282
EXAMPLE 1.12 Given the two binary numbers X = 1010100 and Y = 1000011, perform the subtraction (a) X – Y
and (b) Y – X using 2’s complements.
SOLUTION:
(a) X – Y = 1010100 – 1000011
2’s complement of 1000011 0111101
add minuend + 1010100
sum 1 0010001
X > Y: discard end carry 0010001

Therefore, X – Y = 1010100 – 1000011 = 0010001


(b) Y – X = 1000011 – 1010100
2’s complement of 1010100 0101100
add minuend + 1000011
sum 1101111
X < Y: 2’s complement of sum 0010001

Therefore, Y – X = 1000011 – 1010100 = –0010001


Subtraction of unsigned numbers can also be done by means of the (r – 1)’s complement. Remember
that the (r – 1)’s complement is one less than the r’s complement. Because of this, the result of adding
the minuend to the complement of the subtrahend produces a sum that is 1 less than the correct
difference when an end carry occurs. Removing the end carry and adding 1 to the sum is referred to as
an end-around carry.
EXAMPLE 1.13 Repeat EXAMPLE 1.12 using 1’s complement.

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 24 of 25


JKTAlamo
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bambang, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: IM01-ECE9-1S-2022-2023
VI. REFERENCES

Mano, M. (2016). Digital Design with an Introduction to the Verilog HDL (5th ed.). pp. 17-42
Singapore: Pearson Education South Asia. Retrieved from https://nitsri.ac.in/Department/Computer
%20Science%20&%20Engineering/digital_design-__morris_mano-fifth_edition.pdf
Petriu, E.M. Digital Logic Circuits.
Shannon, C.E. A Symbolic Analysis of Relay and Switching Circuits.

Prepared by:

ENGR. JEL KRISTELLE T. ALAMO


Instructor I

Recommending Approval:

ENGR. ZARAH Z. VILLAR, MAT-Math


ECE Department Chair

Approved by:

MARY B. PASION, D.Eng.-ME


Dean, College of Engineering

In accordance with Section 185. Fair Use of a Copyrighted Work of Republic Act 8293, the copyrighted works included in this material may be
reproduced for educational purposes only and not for commercial distribution.

NVSU-FR-ICD-05-00 (081220) Page 25 of 25


JKTAlamo

You might also like