D IGITAL
ELEC TRO N IC S
PA RT 1
NUM BERING SYSTEM S
“Make it easy, don’t take it easy”
Samsawi Bujang
C O N T E N T S | i
Contents
PAGE
PART 1 NUMBER SYSTEMS v
GENERAL OUTCOMES 1
1.0 NUMBERING SYSTEMS 2
1.1 Problem Solving 1 3
1.2 Problem Solving 2 4
1.3 Problem Solving 3 5
1.4 Problem Solving 4 6
1.5 Problem Solving 5 7
1.6 Problem Solving 6 8
1.7 Problem Solving 7 9
1.8 Problem Solving 8 10
1.9 Problem Solving 9 11
1.10 Problem Solving 10 12
1.11 Problem Solving 11 13
1.13 Problem Solving 12 14
1.14 Problem Solving 13 15
1.15 Problem Solving 14 16
1.16 Problem Solving 15 17
1.17 Problem Solving 16 18
1.18 Problem Solving 17 19
1.19 Problem Solving 18 20
1.20 Problem Solving 19 21
C O N T E N T S | ii
PAGE
1.21 Problem Solving 20 22
1.22 Problem Solving 21 23
1.23 Problem Solving 22 24
1.24 Problem Solving 23 25
1.25 Problem Solving 24 26
2.0 2 COMPLIMENT 27
nd
2.1 Problem Solving 1 28
2.2 Problem Solving 2 29
2.3 Problem Solving 3 30
2.4 Problem Solving 4 31
2.5 Problem Solving 5 32
2.0 BINARY CODES 33
2.1 Problem Solving 1 34
2.2 Problem Solving 2 35
2.3 Problem Solving 3 36
2.4 Problem Solving 4 37
2.4 Problem Solving 5 38
SELF-ASSESMENT 39
REFERENCES
N U M B E R S Y S T E M | 1
NUMBER SYSTEMS
GENERAL outcomes
PART 1) Understand decimal number system, binary
1
number system, octal number system and
hexadecimal number system
2) Know to convert the number from one system
to another
3) Solve problems in addition and subtraction
operations using 2’s complement
4) Apply binary codes used in computers
representing decimal digits, alphanumeric
characters and symbols
N U M B E R S Y S T E M | 2
NUMBERING SYSTEMS
01 Decimal → Base 10 (N 10)
Binary → Base 2 (N 2)
02
03 Octal → Base 8 (N 8)
Hexadecimal → Base 16 (N 16)
04
N U M B E R S Y S T E M | 3
SOLVE ME….
“Improve yourself”
Convert the following decimal numbers
1
to binary:
40 10 ( N → N )
10
2
Solution:
quotient remainder
40
= 20 − − − − − 0
2
20
= 10 − − − − − 0
2
10 = 5 − − − − −0
2
5
2 = 2.5 − − − − 1
2
= 1 − − − − − 0
2
1
= 0.5 − − − − − 1 1 0 1 0 0 0 2
2
MSB LSB
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 4
SOLVE ME….
“Improve yourself”
Convert the following decimal numbers
2
to binary:
61 10 ( N → N )
2
10
Solution:
quotient remainder
61
= 30.5 − − − − − 1
2
30
= 15 − − − − − 0
2
15 = 7.5 − − − − 1
2
7
= 3.5 − − − − 1
2
3
= 1.5 − − − − − 1
2
1
= 0.5 − − − − − 1 1 1 1 1 0 1
2 2
MSB LSB
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 5
SOLVE ME….
“Improve yourself”
Convert the following decimal numbers
3
to binary:
98 10 ( N → N )
2
10
Solution:
quotient remainder
98
= 49 − − − − − 0
2
49
= 24.5 − − − − − 1
2
24
= 12 − − − − 0
2
12
= 6 − − − − 0
2
6
2 = 3 − − − − − 0
3
= 1.5 − − − − − 1
2
1
= 0.5 − − − − − 1 1 1 0 0 0 1 0
2 2
MSB LSB
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 6
SOLVE ME….
“Improve yourself”
Convert the following decimal numbers
4
to binary:
0.3125 10 ( N → N )
2
10
Solution:
quotient remainder
0.3125 2 = 0.625 − − − 0
0.625 2 = 1.25 − − − 0
0.25 2 = 0.5 − − − 0
0.5 2 = 1 − − − 0
Stop when whole number
quotient is one.
0 . 0 1 0 1
2
MSB LSB
N U M B E R S Y S T E M | 7
SOLVE ME….
“Improve yourself”
Convert 359 10 the decimal numbers to
5
octal:
359 10 ( N → N )
10
8
Solution:
quotient remainder
359 = 44.875 → 0.875x8 → 7
8
44
= 5.5 → 0.5x8 → 4
8
5
= 0.625 → 0.625x8 → 5 5 4 7 8
8 MSD LSD
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 8
SOLVE ME….
“Improve yourself”
Convert 4712 10 the decimal numbers to
6
octal:
4712 10 ( N 10 → N )
8
Solution:
quotient remainder
589
8 = 73.625 → 0.625 x 8 → 0
589
= 73.625 → 0.625 x 8 → 5
8
73
= 9.125 → 0.125 x 8 → 1
8
9
= 1.125 → 0.125 x 8 → 1
8
1
= 0.125 → 0.125 x 8 → 1 1 1 1 5 0
8 8
MSD LSD
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 9
SOLVE ME….
“Improve yourself”
Convert 650 10 the decimal numbers to
7
Hexadecimal:
650 10 ( N → N )
10
16
Solution:
quotient remainder
650
= 40.625 → 0.635 x 16 → 10 (A)
16
40
= 2.5 → 0.5 x 16 → 8
16
2
= 0.125 → 0.125 x 16 → 2 2 8
16 16
MSD LSD
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 10
SOLVE ME….
“Improve yourself”
Convert 5659 10 the decimal numbers to
8
Hexadecimal:
5659 10 ( N 10 → N )
16
Solution:
quotient remainder
5659
16 = 353.6875 → 0.6875 x 16 → 11 (B)
353
= 22.0625 → 0.0625 x 16 → 1
16
22
= 1.375 → 0.375 x 16 → 6
16
1
= 0.125 → 0.125 x 16 → 2 2 6 1
16 16
MSD LSD
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 11
SOLVE ME….
“Improve yourself”
Convert 51023 10 the decimal numbers to
9
Hexadecimal:
510234 10 ( N 10 → N )
16
Solution:
quotient remainder
510234
16 = 31889.625 → 0.625 x 16 → 10 (A)
3188
= 1993.0625 → 0.0625 x 16 → 1
16
1993
= 124.5625 → 0.5625 x 16 → 9
16
124
= 7.75 → 0.75 x 16 → 12 (C)
16
7
= 0.4375 → 0.4375 x 16 → 7 7 9 1
16 16
MSD LSD
Stop when whole number
quotient is zero.
N U M B E R S Y S T E M | 12
SOLVE ME….
“Improve yourself”
Determine the decimal value of the binary
10 number 1101101 2.
1101101 2 ( N → N
10
2
)
Solution:
0
5
Weight: 2 2 2 2 2 2 2
6
1
2
3
4
Binary number : 1 1 0 1 1 0 1
11011012 = 1 x 2 + 1 x 2 + 1x 2 + 1 x 2 + 1 x 2
5
6
0
3
2
= 64 + 32 + 8 + 4 + 1
= 10910
N U M B E R S Y S T E M | 13
SOLVE ME….
“Improve yourself”
Determine the decimal value of the binary
11 number 0.1011 2.
0.1011 2 ( N → N )
2
10
Solution:
Weight: 2 2 2 2
-4
-3
-2
-1
Binary number : . 1 0 1 1
11011012 = 1 x 2 + 1 x 2 + 1x 2
-1
-3
-4
= 0.5 + 0.125 + 0.0625
= 0.687510
N U M B E R S Y S T E M | 14
SOLVE ME….
“Improve yourself”
Determine the decimal value of the binary
12 number 1101101 2.
101.101 2 ( N → N )
2
10
Solution:
-3
-2
Weight: 2 2 2 2 2 2
2
-1
1
0
Binary number : 1 0 1 . 1 0 1
101.1012 = 1 x 2 + 1 x 2 + 1x 2 + 1 x 2
0
2
-3
-1
= 4 + 1 + 0.5 + 0.125
= 5.62510
N U M B E R S Y S T E M | 15
SOLVE ME….
“Improve yourself”
Determine the decimal value of the octal
13 number 2374 8.
2374 ( N → N )
8 8 10
Solution:
1
0
Weight: 8 8 8 8
3
2
Binary number : 2 3 7 4
23748 = 2 x 8 + 3 x 8 + 7 x 8 + 4 x 8
0
1
2
3
= 1024 + 192 + 56 + 4
= 127610
N U M B E R S Y S T E M | 16
SOLVE ME….
“Improve yourself”
Determine the decimal value of the octal
14 number 14.35 8.
14.35 ( N → N )
8 8 10
Solution:
-1
0
-2
1
Weight: 8 8 8 8
Binary number : 1 4 . 3 5
14.358 = 1 x 8 + 4 x 8 + 3 x 8 + 5 x 8
1
0
-2
-1
= 8 + 4 + 0.375 + 0.078125
= 12.45312510
N U M B E R S Y S T E M | 17
SOLVE ME….
“Improve yourself”
Determine the decimal value of the
15 hexadecimal whole number E5 16.
E5 16 ( N → N )
16
10
Solution:
0
1
Weight: 16 16
Binary number : E 5
0
1
E516 = ( E x 16 ) + ( 5 x 16 )
= ( 14 x 16 ) + ( 5 x 1 )
= 224 + 5
= 22910
N U M B E R S Y S T E M | 18
SOLVE ME….
“Improve yourself”
Determine the decimal value of the
16 hexadecimal whole number 821A 16.
821A 16 ( N 16 → N )
10
Solution:
0
2
3
1
Weight: 16 16 16 16
Binary number : 8 2 1 A
3
2
0
1
821A16 = ( 8 x 16 ) + ( 2 x 16 ) + ( 1 x 16 ) + ( 10 x 16 )
= ( 8 x 4096 ) + ( 2 x 256 ) + ( 1 x 16 ) + ( 10 x 1 )
= 32768 + 512 + 16 + 10
= 3330610
N U M B E R S Y S T E M | 19
SOLVE ME….
“Improve yourself”
Determine the binary value of the octal
17 number 653 8.
653 8 ( N → N )
2
8
Solution:
Each octal number converts to 3 binary digits
T o convert 653 to binary, just
8
substitute code:
6 5 3
110 101 011
6538 = 1101010112
N U M B E R S Y S T E M | 20
SOLVE ME….
“Improve yourself”
Determine the binary value of the octal
18 number 42517 8.
42517 8 ( N 8 → N )
2
Solution:
Each octal number converts to 3 binary digits
To convert 42517 to binary, just
8
substitute code:
4 2 5 1 7
100 010 101 001 111
425178 = 1000101010011112
N U M B E R S Y S T E M | 21
SOLVE ME….
“Improve yourself”
Determine the binary value of the
19 Hexadecimal number 1E7 16.
1E7 16 ( N 16 → N )
2
Solution:
Each hexadecimal number converts to 4 binary digits
To convert 1E7 to binary, just
16
substitute code:
1 E 7
0001 1110 0111
1E716= 11111001112
N U M B E R S Y S T E M | 22
SOLVE ME….
“Improve yourself”
Determine the binary value of the
20 Hexadecimal number 2A3B9 16.
2A3B9 16 ( N → N )
2
16
Solution:
Each hexadecimal number converts to 4 binary digits
To convert 2A3B9 to binary, just
16
substitute code:
2 A 3 B 9
0010 1010 0011 1011 1001
2A3B916= 1010100011101110012
N U M B E R S Y S T E M | 23
SOLVE ME….
“Improve yourself”
Convert 10011011000001 2 to octal number.
21
8
10011011000001 ( N → N )
2 2
Solution:
Each octal number converts to 3 binary digits
To convert 10011011000001 to
2
binary, just substitute code:
010 011 011 000 001
2 3 3 0 1
100110110000012= 233018
N U M B E R S Y S T E M | 24
SOLVE ME….
“Improve yourself”
Convert 100111010110111 2 to octal number.
22 100111010110111 ( N
8
2 2 → N )
Solution:
Each octal number converts to 3 binary digits
To convert 100111010110111 to
2
binary, just substitute code:
100 111 010 110 111
4 7 2 6 7
1001110101101112= 472678
N U M B E R S Y S T E M | 25
SOLVE ME….
“Improve yourself”
Convert 10011011011000001 2 to Hexadecimal
23 number.
10011011011000001 ( N → N )
2 2 16
Solution:
Each hexadecimal number converts to 4 binary digits
To convert 10011011011000001 to
2
binary, just substitute code:
0001 0011 0110 1100 0001
1 3 6 C 1
100110110110000012= 136C116
N U M B E R S Y S T E M | 26
SOLVE ME….
“Improve yourself”
Convert 111010101111 2 to Hexadecimal
24 number.
111010101111 ( N → N )
2 2 16
Solution:
Each hexadecimal number converts to 4 binary digits
To convert 111010101111 to binary,
2
just substitute code:
1110 1010 1111
E A F
1110101011112= EAF16
N U M B E R S Y S T E M | 27
2 nd COMPLIMENTS
Basic rules in Basic rules
binary for binary
addition subtraction
01 0 + 0 = 0 01 0 - 0 = 0
0 + 1 = 1 1 - 0 = 1
02 02
03 1 + 0 = 1 03 1 - 1 = 0
1 + 1 = 1 0 1 0 - 1 = 1
04 04
1 + 1 + 1 = 1 1
05 -
nd
1 Compliment 2 Compliment
st
N U M B E R S Y S T E M | 28
SOLVE ME….
“Improve yourself”
Solve the arithmetic equation below by
1
using 8 bit two’s compliment method
10
10
(-7 ) + (-19 )
Solution:
+7 = 00000111
1 Compliment 11111000
st
+ 1
nd
2 Compliment 11111001
-7 = 11111001
+19 = 00010011
st
1 Compliment
11101100
+ 1
2 Compliment 11101101
nd
-19 = 11101101
11111001
+ 11101101
111100 110
Answer: 11100 1102
discard
N U M B E R S Y S T E M | 29
SOLVE ME….
“Improve yourself”
Solve the arithmetic equation below by
2
using 8 bit two’s compliment method
10
10
(-21 ) + (18 )
Solution:
+21 = 00010101
1 Compliment 11101010
st
+ 1
nd
2 Compliment 11101011
-21 = 11101011
+18 = 00010010
nd
No need convert to 2 Compliment
because the question just need in
positive number
11101011
+ 00010010
11111 101
Answer: 11111 1012
N U M B E R S Y S T E M | 30
SOLVE ME….
“Improve yourself”
Solve the arithmetic equation below by
3
using 8 bit two’s compliment method
10
10
(42 ) + (-32 )
Solution:
+42 = 00101010
nd
No need convert to 2 Compliment
because the question just need in
positive number
+32 = 00100000
st
1 Compliment 11011111
+ 1
2 Compliment 11100000
nd
-32 = 11100000
00101010
+ 11100000
100001 010
Answer: 0000 10102
discard
N U M B E R S Y S T E M | 31
SOLVE ME….
“Improve yourself”
Solve the arithmetic equation below by
4
using 8 bit two’s compliment method
10
10
(-10 ) - (9 )
Solution:
+10 = 00001010
1 Compliment 11110101
st
+ 1
nd
2 Compliment 11110110
-10 = 11110110
+9 = 00001001
nd
No need convert to 2 Compliment
because the question just need in
positive number
11110110
- 00001001
11101 101
Answer: 11101 1012
N U M B E R S Y S T E M | 32
SOLVE ME….
“Improve yourself”
Change following numbers 2120C 16 to
5
BCD code by applying correct method
10
10
(-8 ) + (-19 )
Solution:
+8 = 00001000
1 Compliment 11110111
st
+ 1
2 Compliment
nd
11111000
-8 = 11111000
+19 = 00010011
st
1 Compliment
11101100
+ 1
2 Compliment 11101101
nd
-19 = 11101101
11111000
- 11101101
00001011
Answer: 000010112
N U M B E R S Y S T E M | 33
Binary codes
BINARY
01 CODED 02 ASCII CODES
DECIMAL
(BCD)
3 2 1 0
2 2 2 2 ASCII TABLE
3
2
8 4 2 1
N U M B E R S Y S T E M | 34
SOLVE ME….
“Improve yourself”
Change decimal number 2130 10 to BCD code
1 by applying correct method.
2130 2 ( N 10 → BCD )
Solution:
Decimal
2 1 3 0 10
Number :
0010
BCD Code : 0001 0011 0000 BCD
213010 = 0010 0001 0011 0000 BCD
N U M B E R S Y S T E M | 35
SOLVE ME….
“Improve yourself”
Change decimal number 2130 10 to BCD code
2 by applying correct method.
1980 2 ( N 10 → BCD )
Solution:
Decimal
1 9 8 0 10
Number :
BCD Code : 1001 1000 0000 BCD
01
00
198010 = 0001 1001 1000 0000 BCD
N U M B E R S Y S T E M | 36
SOLVE ME….
“Improve yourself”
Change following number 32B 16 to BCD code
3 by applying correct method.
821A 16 ( N 16 → BCD )
Solution:
3 2 1 0
Weight: 16 16 16 16
Binary number : 8 2 1 A
821A16 = ( 8 x 16 ) + ( 2 x 16 ) + ( 1 x 16 ) + ( 10 x 16 )
2
1
3
0
= ( 8 x 4096 ) + ( 2 x 256 ) + ( 1 x 16 ) + ( 10 x 1 )
= 32768 + 512 + 16 + 10
= 3330610
Decimal 3 3 3 0 6 10
Number :
BCD Code : 0011 0011 0000 0110 BCD
0011
3330610 = 0011 0011 0011 0000 0110 BCD
N U M B E R S Y S T E M | 37
SOLVE ME….
“Improve yourself”
Change data information below to ASCII
code using code table.
4
44 45 45 32 30 30 33 33
20 45 61 73 79 3E
Solution:
44 45 45 32 30 30 33 33 20 45 61 73 79 3E
Data:
D E E 2 0 0 3 3
ASCII: E a s y >
DEE20033 Easy>
N U M B E R S Y S T E M | 38
SOLVE ME….
“Improve yourself”
Change data information below to ASCII
code using code table.
5
4E 65 76 65 72 20 47 69
76 65 4E
Solution:
Data: 4E 65 76 65 72 20 47 69 76 65 4E
N e v
ASCII: e r G i v e N
Never GiveN
N U M B E R S Y S T E M | 39
SELF-ASSESMENT
1. Convert the following number by completing the Table 1.
Table 1
Decimal Octal Hex Binary BCD
18
252
167
1000011
0001 0100
0101 0100
Answ Row 1: 18, 22, 12, 10010, 0001 1000
Answ Row 2: 170, 252, AA, 10101010, 0001 0111 0000
Answ Row 3: 359, 547, 167, 101100111, 0011 0101 1001
Answ Row 4: 67, 103, 43, 1000011, 0110 0111
Answ Row 5: 1454, 2656, 5AE, 10110101110, 0001 0100 0101 0100
N U M B E R S Y S T E M | 40
2. Convert 138.C16 in decimal equivalent
Answ: 312.7510
3. Determine 53108 in binary equivalent.
Answ: 1100110010002
4. Compute the following operations in the 2’s complement system. Use 8
bits (including the sign bit) for each number.
-3010 + (-1110)
Answ: 110101112
5. Solve the arithmetic equation below by using 8 bit two’s compliment
method.
-1310 + (-2110)
Answ: 111111102
6. Solve the arithmetic equation below by using 8 bit two’s compliment
method.
(-810) + (-5710)
Answ: 101111112
7. Convert the BCD code 1001 0011 0110 BCD to its equivalent binary
number.
Answ: 11101010002
8. Convert the BCD code 0101 1001 0100 BCD to its equivalent binary
number.
Answ: 11011010002
N U M B E R S Y S T E M | 41
9. Change data information below to ASCII code using ASCII code table.
4E 65 76 65 72 20 47 69 76 65 20 55 70 2E
Answ: Never Give Up.
10. Change data information below to ASCII code using ASCII code table.
3C 44 45 45 32 30 30 33 33 20 69 72 20 45
Answ: <DEE20033 is Easy>
R e f e r e n c e s |
R e f e r e n c e s
Ronald J.Tocci and Neal S.Widmer (1998). Digital systems-Principles and
Applications (7th Ed.). Prentice Hall, Inc. (ISBN: 0-13-649492-7).
Thomas L. Floyd (1997), Digital Fundamentals (6th Ed.). Prentice Hall, Inc.
(ISBN: 0-13-573478-9)
Salina Muhamad and Muhammad Nazir Mohammad Khalid (2017).
Fundamental of Digital Electronics. Oxford Fajar Sdd. Bhd. (ISBN: 978 983
47 2139 8)