chapter2_numberSystem
chapter2_numberSystem
In this chapter, students will learn the different number of system use between the world of computers and
humans, and how to make the conversion between systems in order for the two different world to
understand and communicate.
1|P a g e
this case 57110. Usually a subscript is not necessary for a decimal number but subscripts are recommended when
numerical systems since digit might be repeated in different number of system, and a way to identify the different
system is by subscript of their respective system base.
Increasing power of 10
5 7 1. Decimal Point
1 100 = 1
7 101 = 70
5 102 = 500
For the given decimal numbers, identify the LSD, MSD, and each digit weight position factor:
a. 3,708
b. 10,526
c. 490
Digital devices use a different method called binary system to identify and represent digits. Binary system uses two
digits, which is 0 and 1, to represent two distinct voltage level. The digit “0” is used to represent a voltage of or
approximately 0 V, and the digit “1” is used to represent a voltage of or approximately 5 V.
Also, each binary digit is called a “bit”, the most-right bit is known as the least significant bit, and the most-left bit
is known as the most significant bit. Also, a subscript of 2 is added to the LSB to identify the number as a binary
number or string.
Hence, the digits for the binary system is 0 and 1, and it is a base of 2 system.
2|P a g e
Example 2.2. – Binary number
For a 4-bit binary number 11002, the MSB, LSB, and the weight position factor is identified as:
0 20 (LSB)
0 21
1 22
1 23 (MSB)
For the given binary numbers, identify the LSB, MSB, and each digit weight position factor:
a. 1011002
b. 111012
c. 1010102
In digital, the term code refers to the sequence of symbols or characters, and a binary code is no more than
a sequence of 1s and 0s. Since binary code are extremely long, one way to simplify a binary code is by
grouping into a group of 4-bit or 3-bit. One group of 4-bit is called a nibbles and one group of 8-bit (2
nibbles) is called bytes. A system to group a binary code into a group of 4-bit is called the hexadecimal
number of system. It is a base 16 system because it has 16 digits, 24 = 16. One group of 4-bit represents
a single hexadecimal digit. The representation of each hexadecimal digit is by numbers from 0 to 9 and
by letter in the alphabetic order from A to F to represent the values of 10, 11, 12, 13, 14, and 15,
respectively.
Since hexadecimal uses 4-bit grouping, then instructions or data used in the computer systems is in two
(1 byte), four (2-byte), or eight (3-byte) hexadecimal code, which is must easier and faster to read than a
long string of binary digits.
3|P a g e
Example 2.3. – Hexadecimal number
MSB LSB
1000 1110 11002 Grouping of 4-bit stars from the LSB to the MSB
direction. One group of 4-bit is equivalent to one
Group-3 Group-2 Group-1
hexadecimal digit
One example of hexadecimal application is the hexadecimal color palette (a hex triplet) of a graphic design
application, where it uses two hexadecimal digit to represent one level of color variation among the color
of Red, Green, and Blue (RGB).
Like the hexadecimal number system, the octal number system provides a convenient way to express
binary number and codes. One octal digit is a decimal representation of a group of 3-bit. Therefore, the
octal number system is a base of 8 (23 = 8) system composed of eight digits: 0,1,2,3,4,5,6,7.
4|P a g e
MSB LSB Grouping of 3-bit stars from the LSB
to the MSB direction. One group of 3-
100 011 101 1002 bit is equivalent to one octal digit
History has showed that some ancient culture such as the Native American Yuki and the Mexican Pamean
cultures used octal system because the count using the spaces between their fingers instead of the fingers
themselves.
Octal or base eight system is used in older computer as
their base system especially in system that employed 12-
bit, 24-bit, or 36-bit words. Since each octal digit
represents three binary digit, computer with octal base
system has their word size divisible by three-bit.
However, most modern computing platforms use 16-bit,
32-bit, or 64-bit words, which the word size is divisible
by eight-bit, a byte.
The original computers were used primarily as calculators, but later they were used to manipulate other
forms of information, such as words, symbols, and pictures. In each case, engineers and programmers sat
down and decided how they were going to represent a new type of information in binary form. Although
it is pretty complicated to do so, sounds and pictures can also be converted into binary numbers, too. They
have to be divided up into small elements (“samples” in audio or “pixels” for pictures), and then every
element has to be assigned a number. The result is a huge array of binary numbers, and the volume of all
this data is one reason why image files on a computer are so large, and why it is relatively slow to view
video or download audio over an internet connection.
One of the practices by which it is important to understand the conversion between numerical systems is
the representation of a binary code in words. For example, with 8 bit binary, 0101 11002, many logic and
protocol analyzers and Binary Editors will show these sequences with a hex value as 5CHex. A familiar
binary code sequence 010 00112, represents as 23Hex also having the ASCII representation the symbol
hash #
5|P a g e
2.5.1. Conversion from binary, hexadecimal, or octal system to decimal system
The conversion from binary, hexadecimal, or octal system to decimal number is done by using the
weight position values and the base of the given number. The basic steps for the conversion is:
1. Identify and label the LSD and the MSD of the given number
2. Identity the appropriate base weigh position factor for each given digit
from the LSD to the MSD
5. Label the result in step 4 with subscript 10 to identify that the number
is the converted decimal number.
1 0 0 1 0 12
(LSB)
(MSB)
Step 2: Identity the appropriate base weigh position factor for each given digit from the LSD to the MSD
1 0 0 1 0 12
20 (LSB)
21
22
23
24
25 (MSB)
6|P a g e
Step 3: Multiply each given digit with their respective base from step 2.
1 0 0 1 0 12
120 = 1(LSB)
021 = 0
122 = 4
023 = 0
024 = 0
125 = 32(MSB)
32+0+0+4+0+1 = 37
Step 5. Label the result in step 4 with subscript 10 to identify that the number is the converted decimal
number.
Answer = 3710
C 2 7 F16
(LSB)
(MSB)
Step 2: Identity the appropriate base weigh position factor for each given digit from the LSD to the MSD
C 2 7 F16
160 (LSB)
161
162
163 (MSB)
7|P a g e
Step 3: Multiply each given digit with their respective base from step 2.
C 2 7 F16
F = 15160 = 15 (LSB)
7161 = 112
2162 = 512
C = 12163 = 49152 (MSB)
Step 5. Label the result in step 4 with subscript 10 to identify that the number is the converted decimal
number.
4979110
Step 2: Identity the appropriate base weigh position factor for each given digit from the LSD to the MSD
3 58
80 (LSB)
81 (MSB)
Step 3: Multiply each given digit with their respective base from step 2.
3 58
580 = 5(LSB)
381 = 24(MSB)
8|P a g e
Step 5. Label the result in step 4 with subscript 10 to identify that the number is the converted decimal
number.
2910
The conversion decimal system to binary, hexadecimal, or octal system is done by using repeating
division with the base value of the given number, and the remainder of each division is the converted
number. The basic steps for the conversion is:
1. Divide the given decimal number (divident) with the base value of the system (divisor)
that we are converting to.
2. The remainder of step 1 is the converted digit. The first remainder digit is the LSD
3. Take the quotient from the previous division and divide it again with the base value of
the system (divisor) that we are converting to. The remainder is the next converted digit.
4. Repeat step 3 until the quotient of the division becomes zero "0". The last remainder
digit is the MSD
5. Write all the converted digit, which are all the remainders digit, from the LSD to the
MSD (from rightmost digit to the leftmost digit). Do not forget to include the base
subscript
9|P a g e
Example 2.8. – Conversion from decimal system to binary system
What is the binary code of 3710?
Step 1: Divide the given decimal number (dividend) with the base value of the system (divisor) that we
are converting to.
37 is the dividend, and 2 is the divisor since the conversion is to binary code, which is base of 2
37
2
Step 2: The remainder of step 1 is the converted digit. The first remainder digit is the LSB
37 1
= 18 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 1 (𝐿𝑆𝐵)
2 2
Step 3. Take the quotient from the previous division and divide it again with the base value of the
system (divisor) that we are converting to. The remainder is the next converted digit.
18
= 9.0 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 0
2
Step 4. Repeat Step 3 until the quotient of the division becomes zero "0". The last remainder is the MSB
9 1
= 4 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 1
2 2
4
= 2.0 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 0
2
2
= 1.0 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 0
2
1 1
= 0 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 1 … . 𝑄𝑢𝑜𝑡𝑖𝑒𝑛𝑡 = 0 → 𝑆𝑇𝑂𝑃 𝑑𝑖𝑣𝑖𝑠𝑖𝑜𝑛 (𝑀𝑆𝐵)
2 2
Step 5. Write all the converted digit, which are all the remainders digit, from the LSB to the MSB (from
rightmost digit to the leftmost digit). Do not forget to include the base subscript
1 0 0 1 0 12
(LSB)
(MSB)
10 | P a g e
Example 2.9. – Conversion from decimal system to hexadecimal system
What is the hexadecimal code of 21510?
Step 1: Divide the given decimal number (dividend) with the base value of the system (divisor) that we
are converting to.
215 is the dividend, and 16 is the divisor since the conversion is to hexadecimal code, which is base of
16
215
16
Step 2: The remainder of step 1 is the converted digit. The first remainder digit is the LSD
215 7
= 13 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 7 (𝐿𝑆𝐷)
16 16
Step 3. Take the quotient from the previous division and divide it again with the base value of the
system (divisor) that we are converting to. The remainder is the next converted digit.
Step 4. Repeat step 3 until the quotient of the division becomes zero "0". The last remainder is the MSD
13 13
=0 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 13 … 𝑄𝑢𝑜𝑡𝑖𝑒𝑛𝑡 = 0 → 𝑆𝑇𝑂𝑃 𝑑𝑖𝑣𝑖𝑠𝑖𝑜𝑛 (𝑀𝑆𝐷)
16 16
13 is equivalent to D in hexadecimal
Step 5. Write all the converted digit, which are all the remainders digit, from the LSD to the MSD (from
rightmost digit to the leftmost digit). Do not forget to include the base subscript
D 716
(LSD)
(MSD)
11 | P a g e
Example 2.10. – Conversion from decimal system to octal system
What is the octal code of 968?
Step 1: Divide the given decimal number (dividend) with the base value of the system (divisor) that we
are converting to.
96 is the dividend, and 8 is the divisor since the conversion is to octal code, which is base of 8
96
8
Step 2: The remainder of step 1 is the converted digit. The first remainder digit is the LSD
96
= 12.0 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 0 (𝐿𝑆𝐷)
8
Step 3. Take the quotient from the previous division and divide it again with the base value of the
system (divisor) that we are converting to. The remainder is the next converted digit.
12 4
= 1 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 4
8 8
Step 4. Repeat step 3 until the quotient of the division becomes zero "0". The last remainder is the MSD
1 1
= 0 → 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 1 … . 𝑄𝑢𝑜𝑡𝑖𝑒𝑛𝑡 = 0 → 𝑆𝑇𝑂𝑃 𝑑𝑖𝑣𝑖𝑠𝑖𝑜𝑛 (𝑀𝑆𝐷)
8 8
Step 5. Write all the converted digit, which are all the remainders digit, from the LSD to the MSD (from
rightmost digit to the leftmost digit). Do not forget to include the base subscript
1 4 08
(LSD)
(MSD)
Exercise 2.4 – conversion from decimal to binary, hexadecimal, and octal system
a. What is the binary code of 7010? 1000110
b. What is the hexadecimal code of 52610? 20E
c. What is the octal code of 2788? 426
12 | P a g e
2.5.3. Conversion from binary to hexadecimal system
Converting a binary number to hexadecimal is a straightforward procedure. Simply break the binary code
into 4-bit groups from the LSB to the MSB order, and replaces each 4-bit group with the equivalent
hexadecimal symbol. One way to do the replacement is to convert the 4-bit group into its equivalent
decimal value and convert the decimal value into a hexadecimal digit.
1. Break the binary code into 4-bit groups from the LSB to the
MSB
2. If the last group does not have 4 bit in the group, fill the bit
place with “0” up to 4-bit
13 | P a g e
Example 2.11. – Conversion from binary to hexadecimal system
Convert the following binary code into a hexadecimal code 101110101001002
Step 1: Break the binary code into 4-bit groups from the LSB to the MSB
Answer: 2EA316
14 | P a g e
2.5.4. Conversion from hexadecimal system to binary system
Conversion from hexadecimal number to binary number is a straightforward method. It replaces each
hexadecimal value with its respective 4-bit equivalent.
3 B16
3 11
Step 2: convert each decimal digit into a set of 4-bit code
3 B16
3 11
0011 1011
15 | P a g e
2.5.5. Conversion from binary to octal system
Since each digit of the octal system present a 3-bit group, then the conversion from binary to octal
system is done by replacing each octal digit with its respective 3-bit equivalent.
1. Identify the LSB and MSB, and break the binary code into 3-
bit groups from the LSB to the MSB
2. If the last group does not have 3 bit in the group, fill the bit
place with “0” up to 3-bit
11 010 1012
(LSB)
(MSB)
Step 2: If the last group does not have 3 bit in the group, fill the bit place with “0” up to 3-bit
Answer: 3258
16 | P a g e
Exercise 2.7 – conversion from binary system to octal system
Convert the following binary code into octal code
a. 10001112
b. 10110001012
c. 111101002
2 58
2 5
010 101
Answer: 0101012 or 101012
17 | P a g e
Alphanumeric Coding
When numbers, letters, or words are represented by a special group of symbols, we say that they are being
encode, and the group of symbols is called a code. Basically, encoder is an electronic device used to
convert an analogue signal to a digital signal such as Binary-Coded-Decimal, BCD, code. On the other
hand, the process of converting a digital signal such as binary code into words or symbols is called
decoder.
Most microcomputers handle and store binary data and information in groups of eight bits, so a special
name is given to a string of eight bits as byte. Also, binary numbers are often broken down into groups of
4-bits such as in BCD and hexadecimal. In the early days of digital systems, a term caught on to describe
a group of four bits is nibble. A word is a group of bits that represents a certain unit of information. The
word size can be defined as the number of bits in the binary word that a digital system operates on.
Binary coded decimal (BCD) is a way to express each of the decimal digits with a binary code. Since a
decimal digit can be as large as 9, four bits are required to code each digit (the binary code for 9 is 1001).
There are only ten code groups in the BCD system, so it is very easy to convert between decimal and
BCD. Since we like to read and write in decimal, the BCD code provides an excellent interface to binary
systems. Examples of such interfaces are keypad inputs and digital readouts.
To illustrate the BCD code, take a decimal number such as 87410. Each digit is changed to its binary
equivalent as follows:
8 7 4
1000 0111 0100 (BCD)
The BCD system offers relative ease of conversion between machine-readable and human-readable
numerals. As compared to the simple binary system, however, BCD increases the circuit complexity. The
18 | P a g e
BCD system is not as widely used today as it was a few decades ago, although some systems still employ
BCD in financial applications.
To get information into and out of a computer, we need more than just numeric representations; we also
have to take care of all the letters and symbols used in day-to-day processing. Information such as names,
addresses, and item descriptions must be input and output in a readable format. But remember that a digital
system can deal only with 1s and 0s. Therefore, we need a special code to represent all alphanumeric data
(letters, symbols, and numbers).
Most industry has settled on an input/output (I/O) code called the American Standard Code for Information
Interchange (ASCII). The ASCII code uses 7 bits to represent all the alphanumeric data used in computer
I/O. Seven bits will yield 128 different code combinations, as listed in Table 2.1.
Each time a key is depressed on an ASCII keyboard, that key is converted into its ASCII code and
processed by the computer. Then, before outputting the computer contents to a display terminal or printer,
all information is converted from ASCII into Standard English.
19 | P a g e
For example, if we type the word “May” from the computer keyboard, the computer processor will read
the following 7-bit character ASCII code in hexadecimal:
4D 61 79ASCII
References
ASCII Code. (n.d.). Retrieved from ASCII Code - The extended ASCI table: https://www.ascii-code.com
Engineering and Technology History Wiki. (n.d.). Engineering and Technology History Wiki. Retrieved from
Binary Numbers and Binary Math: ethw.org/Binary_Numbers_and_Binary_Math
The ASCII Code. (2012). In W. Kleitz, Digital Electronics a Practical Approach with VHDL (pp. 18-19). Pearson.
20 | P a g e