ITT270
CHAPTER 2
NUMBER SYSTEMS & CODES
©FMH/UiTM 1
LESSON OUTCOMES
◦ At the end of this lesson, the students should be able to:
◦ Understand the Concept of Number Systems
◦ Recognize the Importance of Number Systems in Digital Electronics
◦ Convert Between Different Number Systems
◦ Explain the Role of Binary Numbers in Digital Circuit
ITT270 ©FMH/UiTM 2
INTRODUCTION
(Number System)
◦ A number system is a way to represent numbers using a specific
set of symbols (digits). Each number system has a base or radix,
which tells how many unique digits it uses. Common number
systems include:
◦ Decimal (Base 10): Uses digits 0 to 9.
◦ Binary (Base 2): Uses digits 0 and 1.
◦ Octal (Base 8): Uses digits 0 to 7.
◦ Hexadecimal (Base 16): Uses digits 0 to 9 and A to F.
ITT270 ©FMH/UiTM 3
Number Systems in Digital
Electronics
◦ Foundation of Digital Systems:
◦ Binary number system is the core of all digital electronics, as computers, digital circuits,
and processors operate using binary (0s and 1s). Each bit in a binary system represents
either an off (0) or on (1) state, which corresponds to electrical signals in a circuit.
◦ Efficient Data Representation:
◦ Different number systems allow for easier representation and processing of data. For
example, octal and hexadecimal number systems are used to simplify long binary
numbers, making them easier to read and understand.
◦ Facilitates Communication with Hardware:
◦ In digital circuits, communication between hardware components (e.g., memory,
processors) relies on binary codes. Number systems provide a way to structure these
codes in meaningful ways for computation.
ITT270 ©FMH/UiTM 4
Number Systems in Digital
Electronics (Cont.)
◦ Simplifies Arithmetic and Logic Operations:
◦ Arithmetic circuits (like adders) and logic circuits (like AND, OR gates) perform their
operations based on number systems. Boolean algebra, which is essential for logic design,
relies heavily on binary numbers.
◦ Conversion Between Number Systems:
◦ Conversions between decimal, binary, octal, and hexadecimal systems are crucial in
digital electronics for programming, debugging, and addressing in memory systems.
◦ Storage and Memory Management:
◦ Computers use number systems to manage data storage. Binary Coded Decimal
(BCD), ASCII, and other formats are used to encode characters, instructions, and
numbers in a way that the hardware can process and retrieve them efficiently.
ITT270 ©FMH/UiTM 5
Number Systems in Digital
Electronics (Cont.)
◦ In conclusion, understanding number systems is fundamental to the design,
development, and operation of digital systems, ensuring data is represented,
processed, and communicated efficiently in digital electronics.
ITT270 ©FMH/UiTM 6
BINARY NUMBERS
◦ Used to represent the voltage level of a digital circuit.
◦ Only 2 voltage levels present in a digital circuit – logic High (1) and logic Low (0).
◦ High voltage is +5V & low voltage is +0V.
ITT270 ©FMH/UiTM 7
BINARY NUMBERS
◦ A decimal number 8710 can be converted to a binary number by dividing
the number by 2:
2 87
2 43 remainder 1
2 21 remainder 1
2 10 remainder 1
2 5 remainder 0
2 2 remainder 1
2 1 remainder 0
0 remainder 1 8710 = 10101112
ITT270 ©FMH/UiTM 8
BINARY NUMBERS
◦ A binary number 11001112 is converted to a decimal numbers by summing the
weights of various positions in the binary number which contains a 1.
26 25 24 23 22 21 20 Bit Weights
1 1 0 0 1 1 1 Binary number
= (1x26)+(1x25)+(1x22) +(1x21)+(1x20)
= 64 + 32 + 4 + 2 + 1
= 10310
ITT270 ©FMH/UiTM 9
OCTAL NUMBER
◦ A decimal number 26610 can be converted to an octal number by dividing the
number by 8:
8 266
8 33 remainder 2
8 4 remainder 1
26610 = 4128
0 remainder 4
ITT270 ©FMH/UiTM 10
OCTAL NUMBER
◦ To convert an octal number 3248 to a decimal number, multiply each octal value
by the weight of the digit and sum the results.
82 81 80 Octal Digit Weights
3 2 4 Octal Number
= (3x82)+(2x81)+(4x80)
= 192 + 16 + 4
= 21210
ITT270 ©FMH/UiTM 11
OCTAL NUMBER
◦ Each octal digit can be represented by a 3-bit binary number as shown below:
Octal Digits 3-bit Binary number
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
ITT270 ©FMH/UiTM 12
OCTAL NUMBER
◦ For example, 4728 = 100 111 0102.
4 7 2 Octal number
↓ ↓ ↓
100 111 010 Binary number
ITT270 ©FMH/UiTM 13
OCTAL NUMBER
◦ A binary number is converted into an octal number by taking groups of 3 bits,
starting from LSB, and replacing them with an octal digit.
◦ For example, 110101102 = 3268.
11 010 110 Binary number
↓ ↓ ↓
3 2 6 Octal number
ITT270 ©FMH/UiTM 14
HEXADECIMAL NUMBER
◦ The hexadecimal number uses base 16. It uses the digits 0 through 9 plus the
letters A, B, C, D, E and F.
◦ The letter A stands for decimal 10, B for 11, C for 12, D for 13, E for 14 and F
for 15.
ITT270 ©FMH/UiTM 15
HEXADECIMAL NUMBER
Hexadecimal Decimal Binary
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
ITT270 ©FMH/UiTM 16
HEXADECIMAL NUMBER
◦ A decimal number can be converted to hex number by successively dividing
the number by 16 as follows:
16 423
16 26 remainder 7 LSB
16 1 remainder 10 A
0 remainder 1 MSB 1A716
ITT270 ©FMH/UiTM 17
HEXADECIMAL NUMBER
◦ To convert a hex number to a decimal number, multiply each hex value by the
weight of the digit and sum the results.
◦ For example, 2B516 = 69310.
162 161 160 Hex Digit Weights
2 B 5 Hex Number
= (2 x 162 ) + (11 x 161) + (5 x 160)
= 512 + 176 + 5
= 69310
ITT270 ©FMH/UiTM 18
HEXADECIMAL NUMBER
◦ Conversion from hex to binary is very straightforward. Each hex digit is replaced
by 4-bit binary number.
◦ For example, A2616 = 1010001001102.
A 2 6 Hex number
↓ ↓ ↓
1010 0010 0110 Binary number
ITT270 ©FMH/UiTM 19
HEXADECIMAL NUMBER
• A binary number is converted into a hex number by taking groups of 4 bits,
starting from LSB, and replacing them with a hex digit.
• For example, 101111110101102 = 2FD616.
10 1111 1101 0110
↓ ↓ ↓ ↓
2 F D 6
ITT270 ©FMH/UiTM 20
BCD CODE
◦ The Binary-Coded-Decimal (BCD) code makes conversion much easier.
◦ Each decimal digit, 0 through 9, is represented with a 4-Bit BCD code.
◦ The BCD code 1010, 1011, 1100, 1101, 1110 and 1111 are not used.
ITT270 ©FMH/UiTM 21
BCD CODE
Decimal Digit BCD Code
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
ITT270 ©FMH/UiTM 22
BCD CODE
◦ Conversion between BCD and decimal is accomplished by replacing a 4-bit BCD
for each decimal digit.
◦ For example, 87410 = 1000 0111 0100BCD
8 7 4 Decimal number
↓ ↓ ↓
1000 0111 0100 BCD code
ITT270 ©FMH/UiTM 23
BCD CODE
◦ A BCD code is converted into a decimal number by taking groups of 4 bits,
starting from LSB, and replacing them with a decimal number.
◦ For example, 1100101111000BCD = 197810
1 1001 0111 1000 BCD code
↓ ↓ ↓ ↓
1 9 7 8 decimal number
ITT270 ©FMH/UiTM 24
EXERCISE
1. Convert the following number:
a) Decimal 156210 to BCD
b) Binary 11101102 to decimal
c) Octal 3548 to hexadecimal
d) Hexadecimal 9D716 to binary
e) BCD 10100111001BCD to octal
ITT270 ©FMH/UiTM 25
ITT270
END OF CHAPTER 2
NUMBER SYSTEMS & CODES
©FMH/UiTM 29