Module 1
Module 1
You probably know what number is, from the beginning counting numbers is one of the first
lessons whether from our parents or from a teacher. As a kid we learn to count form 1 to 10 then
advanced it to hundreds, thousands and so on. We are also taught to read large digits number and
by now it is safe to assume that everyone can already read a large digits of numbers. However, do
we really understand the basics of the number systems we normally use?
Decimal Systems
The number system that we learn from the beginning is a Decimal System. It is a base 10 system
which means we have nine numbers to count (0, 1, 2…9). As we can see, counting using decimal
systems always starts with zero and ends with 9. Whenever we reach the end of the count we
immediately return to zero and start another count. Thus in decimal system the number after 9 is 10
in which we return to zero and put another number on its left which tells us that we are on N count
already which in this case gives a number 10.
1 0
Hexadecimal System
This is a base 16 system, meaning it has 16 digits to count. There is a slight
difference in the counting of hexadecimal systems. It uses a Arabic numerals
on its first 10 counts and uses an Alphabet starting from A on its succeeding
counts. Thus, the digits of hexadecimal numbers are from 0, 1, 2...9 the
followed by A,B, C…F. Succeeding counts will be 10 to 1F and so on.
Binary Systems
The binary system (base 2) is the simplest number system since it only has 2
numbers to count. This systems is use to represent the states of the machines
(High or Low, Positive or Negative). The digit in this system is 0 and 1 only.
Part 2: Conversion
To easily identify which number system the number belong we will be required to put a
subscript on every number we are going to write. The subscript will be the base of the
number system in which the number belongs.
2.1 Decimal System to another System
Let’s have a following example:
Example 2.1
2510 to Octal
1. Take the number and divide it with the base or the target number system, then
take its remainder.
25 / 8 remainder 1
2. Next, divide the quotient of the first operation again with the base of the
target number system and take again take its remainder. Do this until the
quotient is equal to zero
25 / 8 = 3 remainder 1
3 /8 = 0 remainder 3
3. If the quotient is equal to zero, read the digits of the remainder from bottom to
top and that will be the octal value of the given decimal number.
25 / 8 = 3 remainder 1
3 /8 = 0 remainder 3 318
Module 1 3
Number Systems and Digital Arithmetic
Another example:
Example 2.2
25010 Octal
250 / 8 = 31 remainder 2
31 / 8 = 3 remainder 7 3728
3 / 8 = 0 remainder 3
25010 3728
The same step is applicable when converting decimal to other number system
Example 2.3
2510 to Hexadecimal
In this case the base of the target number system is 16. Thus, the decimal
number will divide by 16 instead of 8.
25 / 16 = 1 remainder 9
1916
1 / 16 = 0 remainder 1
2510 is equal to 1916
Example 2.4
25010 Hex
25010 FA16
Example 2.5
2510 to Binary
25 / 2 = 12 remainder 1
12 / 2 = 6 remainder 0
6 / 2 = 3 remainder 0
110012
3 / 2 = 1 remainder 1
Module 1 4
Number Systems and Digital Arithmetic
1/ 2 = 0 remainder 1
2510 is equal to 110012
Example 2.6
25010 Bin
2 x 80 = 2
7x 81 = 56
3x 82 = 192
2. Add the result. The sum will be the decimal equivalent of the given
number
192 + 56 + 2 = 250
3728 25010
Module 1 5
Number Systems and Digital Arithmetic
Example 2.8
FA16 Decimal
Following the step on example 1
A or 10 x 160 = 10
F or 15 x 161 = 240
Sum: 240 + 10 = 250
FA16 25010
Example 2.9
1111 10102 Decimal
0 x 20 = 0
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
1 x 24 = 16
1 x 25 = 32
1 x 26 = 64
1 x 27 = 128
Sum: 128+64+32+16+8+2 = 250
1111 101016 25010
Example 2.11
FA16 to Binary
Every digit of the Hexadecimal number is equivalent to 4 bit binary number. To
convert the Hex number to binary, take the digit of the Hex number and convert it
separately to its binary equivalent.
F A
1111 1010
b. 234510
b.1. Binary b.2. Hexadecimal
Module 1 7
Number Systems and Digital Arithmetic
Example 3.2
Perform the following operation using 4-digit binary operation.
5 0101 010 1 1. The Most significant bit (MSB) is use to show the sign of the
-3 1 011 1 100 number.
1 001 1 2. Only the numbers with negative sign are to be complemented
1 3. After all the negatively signed numbers are complemented
0100 perform an addition operation to the numbers.
4. If there is an extra number beyond 4-digit, add this number to
the result.
Example 3.2.1
Perform the following operation using 4-digit binary operation.
-5 1 1 01 1 010 1 010 The first 1’s complement is for the
-- 3 1 01 1 1 100 001 1 first negative and the second
1 10 1 complement is for the second
Since the result is a 1 010 negative.
negatively number we
need to perform another Note: The second complement
complement on the includes all the number including
result. the sign ( - (-3)).
Exercises 3.2.1
Perform the following operation using a 8-bit binary operation
1. -35 – 48
2. – 54 – (- 39)
Module 1 10
Number Systems and Digital Arithmetic
2’s Complement
The idea of the 2’s complement is to invert the digits of the binary number with
a negative sign and then add 1 on the Least Significant Bit (LSB) of the answer. Let’s
take the following example;
Example 3.2.2
Perform the following operation using 4-digit binary operation and 2’s
complement.
Example 3.2.3
Perform the following operation using 4-digit binary operation.
-5 1 1 01 1 010 1 0 1 1 1100 0010
-- 3 1 01 1 1 10 1 0 01 1 + 1 + 1
1 1 10 110 1 0 011
Since the result is a 1 001
negatively number we +1
need to perform another 1 010
2 ‘s complement on the
result.
Exercises 3.2.1
Perform the following operation using a 8-bit binary operation
1. -35 – 48
2. – 54 – (- 39)
Module 1 11
Number Systems and Digital Arithmetic
Example 3.3.2
A correction is added in the first and third digit of
2507 -0010 0101 0000 01 11 the BCD since it exceeded the maximum value
+545 - 0101 01 00 0101 that a single digit of decimal system can
30 5 2 0 0 1 0 1 0 1 0 0 1 0 0 1 1 00 represent
0110 0110
0 0 1 1 0 00 0 0101 0010
Exercise 3.3.1
Perform the following operation using Binary Coded Decimal:
a. 2345 + 869
b. 63525 + 3562