Chapter one: NUMBER SYSTEM and operations.PDF

getnetzegeye 0 views 31 slides Oct 09, 2025
Slide 1
Slide 1 of 31
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31

About This Presentation

Detail number system understanding, operations on the number system and coding shows here in this topic


Slide Content

EKT 121/4 EKT 121/4
ELEKTRONIK DIGIT 1 ELEKTRONIK DIGIT 1
Kolej Kolej
Universiti Universiti
Kejuruteraan Kejuruteraan
Utara Utara
Malaysia Malaysia
Chapter 2 : Chapter 2 :
Number Systems, Operations Number Systems, Operations
and Codes and Codes

Number Systems & Codes Number Systems & Codes
„„
Introduction to number systems Introduction to number systems
„„
Decimal Decimal
„„
Binary Binary
„„
Octal Octal
„„
Hexadecimal Hexadecimal
„„
Number Conversion Number Conversion
„„
Simple Arithmetic Simple Arithmetic
„„
Binary Codes Binary Codes

Number Systems Number Systems
„„
Decimal Decimal
„„
Binary Binary
„„
Octal Octal
„„
Hexadecimal
¾¾
0 ~ 9 0 ~ 9
¾¾
0 ~ 1 0 ~ 1
¾¾
0 ~ 7 0 ~ 7
¾¾
0 ~ F
Hexadecimal
0 ~ F

00000000 00000001 00000010 00000011 00000100 00000101 00000110 00000111 00001000 00001001 00001010 00001011 00001100 00001101 00001110 00001111
000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017
0123456789ABCDEF
0123456789
10 11 12 13 14 15
Binary
Octal
Hex
Dec
NUMBER SYSTEMS

Number Conversion Number Conversion
„„
Introduction to bit and byte Introduction to bit and byte
„„
Introduction to LSB (Least Significant Bit) Introduction to LSB (Least Significant Bit) & MSB (Most Significant Bit) & MSB (Most Significant Bit)
„„
Any Radix (base) to Decimal Conversion Any Radix (base) to Decimal Conversion

Number Conversion Number Conversion
„„
Binary to Decimal Conversion Binary to Decimal Conversion

Number Conversion Number Conversion
„„
Binary to Decimal Conversion Binary to Decimal Conversion

Example:
Convert binary 1011.1010
2
to decimal.
1011.1010
2
=
(1) 2
3
+ (1) 2
1
+ (1) 2
0
+ (1) 2
-1
+(1)2
-3
= 11.625
10

Number Conversion Number Conversion
„„
Decimal to Any Radix (Base) Conversion Decimal to Any Radix (Base) Conversion
1.1.
INTEGER DIGIT: INTEGER DIGIT: Repeated division by the radix & Repeated division by the radix & record the remainder record the remainder
2.2.
FRACTIONAL DECIMAL: FRACTIONAL DECIMAL: Multiply the number by the radix Multiply the number by the radix until the answer is in integer until the answer is in integer
Example: Example: 25.3125 to Binary 25.3125 to Binary

Integer Digit Integer Digit
2 5
= 12 + 1
2
1 2
= 6 + 0
2
6
= 3 + 0
2 3
= 1 + 1
2 1
= 0 + 1
2
M
SB
LSB
25
10
= 1 1 0 0 1
2
Remainder

Integer Digit Integer Digit
Carry
. 0 1 0 1
0.3125 x 2 = 0.625 0
0.625 x 2 = 1.25 1 0.25 x 2 = 0.50 0
0.5 x 2 = 1.00 1
The Answer : 1 1 0 0 1.0 1 0 1
MSB
L
SB

Number Conversion Number Conversion
„„
Binary to Octal Conversion (vice versa) Binary to Octal Conversion (vice versa)
1.1.
Grouping the binary position in groups Grouping the binary position in groups of of
three three
starting at the least significant starting at the least significant
position. position.
™™
Example: Example:
„„
Convert the following binary numbers to their Convert the following binary numbers to their octal equivalent (vice versa). octal equivalent (vice versa). a)a)
1001.1111 1001.1111
22
b) 47.3 b) 47.3
88
c)c)
1010011.11011 1010011.11011
22
„„
Answer: Answer: a)a)
11.74 11.74
88
b) 100111.011 b) 100111.011
22
c)c)
123.66 123.66
88

Number Conversion Number Conversion
„„
Binary to Hexadecimal Conversion (vice Binary to Hexadecimal Conversion (vice versa) versa)
1.1.
Grouping the binary position in 4 Grouping the binary position in 4
--
bit bit
groups, starting from the least groups, starting from the least significant position. significant position.
™™
Example: Example: „„
Convert the following binary numbers to Convert the following binary numbers to their hexadecimal equivalent (vice versa). their hexadecimal equivalent (vice versa). a)a)
10000.1 10000.1
22
b)b)
1F.C1F.C
1616
„„
Answer: Answer: a)a)
10.810.8
1616
b)b)
00011111.1100 00011111.1100
22

Simple Arithmetic Simple Arithmetic
„„
Addition Addition
™™
Example: Example:
10001100 10001100
22
+ 101110 + 101110
22
10111010 10111010
22
„„
Substraction Substraction
™™
Example: Example:
1000100 1000100
22
--
101110 101110
22
10110 10110
2
™™
Example: Example:
5858
1616
+ 24 + 24
1616
7C7C
16
2
16

Binary Addition Binary Addition
0 + 0 = 0
S
um of 0 with a carry of 0
0 + 1 = 1
S
um of 1 with a carry of 0
1 + 0 = 1
Sum of 1 with a carry of 0
1 + 1 = 10
Sum of 1 with a carry of 1
Example:
11001
111
+ 1101
+ 11
100110
???

Binary Subtraction Binary Subtraction
0 -
0
= 0
1 -
1
= 0
1 -
0
= 1
10 -1 = 1
0
-1 with a borrow of 1
Example:
1011
101
-
111
-
1
1
100
???

Binary Multiplication Binary Multiplication
0 X 0 = 0 0 X 1 = 0
E
xample:
1 X 0 = 0
100110
1 X 1 = 1
X
101 100110
000000
+ 100110
10111110

Binary Division Binary Division
Use the same procedure as decimal division

Binary Multiplication Binary Multiplication
Example1
:
1111
2
1111
2
1111
1111
1111
1111
11100001
2
1
10
11
11
10
128+64+32+1 = 225
Verify !!!
15
10
15
10
225
10

Binary Multiplication Binary Multiplication
Example2
:
1111
2
1101
2
1111
0000
1111
1111
11000011
2
1
10
10
10
128+64+2+1 = 195
10
Verify !!!
15
10
13
10
195
10

1’s complements of binary numbers 1’s complements of binary numbers
„„
Changing all the 1s to 0s and all the 0s to Changing all the 1s to 0s and all the 0s to 1s1s Example Example
: :
1 1 0 1 0 0 1 0 1 1 1 0 1 0 0 1 0 1
Binary number Binary number
0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0
1’s complement 1’s complement

2’s complements of binary numbers 2’s complements of binary numbers
„„
By adding 1 to the LSB of the 1’s complement By adding 1 to the LSB of the 1’s complement
„„
2’s complement = (1’s complement) + 1 2’s complement = (1’s complement) + 1
Example Example
: :
1 1 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0
Binary number Binary number
0 0 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 1
1’s complement 1’s complement
+ 1 + 1
Add 1 Add 1
0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0
2’s complement 2’s complement

Alternative method: Alternative method:
„„
Start from right (LSB), write all bits until Start from right (LSB), write all bits until you find the first bit 1 and then continue you find the first bit 1 and then continue the remaining bits with 1’s complement. the remaining bits with 1’s complement. Example: Example:
1 1 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0
1
st
bit 1
You write the 1
ST
2
bits from LSB
1
st
complement for
the remaining bits
Binary number 2’s c
o
mplement

Signed numbers Signed numbers
„„
Left most is the sign bit Left most is the sign bit
„„
0 is for positive, and 1 is for negative 0 is for positive, and 1 is for negative
„„
SignSign
--
magnitude magnitude
„„
0 0 0 1 1 0 0 1 = +25 0 0 0 1 1 0 0 1 = +25
sign bit magnitude bits sign bit magnitude bits
„„
1’s complement 1’s complement
„„
The negative number is the 1’s complement The negative number is the 1’s complement of the corresponding positive number of the corresponding positive number
„„
Example: Example:
+25 is 00011001 +25 is 00011001
--
25 is 11100110 25 is 11100110

Signed numbers Signed numbers
„„
2’s complement 2’s complement
„„
The positive number The positive number
––
same as sign same as sign
magnitude and 1’s complement magnitude and 1’s complement
„„
The negative number is the 2’s complement The negative number is the 2’s complement of the corresponding positive number. of the corresponding positive number.
Example: Example:
Express +19 and Express +19 and
--
19 in 19 in
i. sign magnitude i. sign magnitude ii. 1’s complement ii. 1’s complement iii. 2’s complement iii. 2’s complement

Arithmetic Operation With Arithmetic Operation With
Signed numbers Signed numbers
„„
Addition Addition
„„
Subtraction Subtraction
„„
Multiplication Multiplication
„„
Division
Find out !!!!
Division

Digital Codes Digital Codes
„„
BCD (Binary Coded Decimal) Code BCD (Binary Coded Decimal) Code
1.1.
Represent each of the 10 decimal Represent each of the 10 decimal digits (0~9) as a 4 digits (0~9) as a 4
--
bit binary code. bit binary code.
™™
Example: Example: „„
Convert 15 to BCD. Convert 15 to BCD.
1 5 1 5
0001 0101 0001 0101
BCDBCD
„„
Convert 10 to binary and BCD. Convert 10 to binary and BCD.

Digital Codes Digital Codes
„„
ASCII (American Standard Code for ASCII (American Standard Code for Information Interchange) Code Information Interchange) Code
1.1.
Used to translate from the keyboard Used to translate from the keyboard characters to computer language characters to computer language

Digital Codes Digital Codes
„„
The Gray Code The Gray Code
„„
Only 1 bit changes Only 1 bit changes
„„
Can’t be used in Can’t be used in arithmetic circuits arithmetic circuits
„„
Binary to Gray Code Binary to Gray Code and vice versa.
01010101
01100110
66
01110111
01010101
55
01100110
01000100
44
00100010
00110011
33
00110011
00100010
22
00010001
00010001
11
00000000
00000000
00
Gray Gray CodeCode
Binary Binary
Decimal Decimal
and vice versa.

Digital Codes Digital Codes
„„
Seven Segment Code Seven Segment Code
Arrangements of 7 segment LED display

Binary Codes Binary Codes
––
Assignment 1 Assignment 1
„„
Assignment Assignment
„„
Excess Excess
––
3 (XS 3 (XS
--
3)3)
„„
Parity in Codes Parity in Codes
„„
Gray Code Gray Code
„„
Due: 25 November 2003 Due: 25 November 2003

Next Week Next Week
Logic Gates Logic Gates
& &
Algebra Boolean Algebra Boolean
--
Thank you Thank you
--