0% found this document useful (0 votes)
29 views

Chapter 1 Number Systems and Code Systems

Uploaded by

sarmillanrao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Chapter 1 Number Systems and Code Systems

Uploaded by

sarmillanrao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 51

NUMBER SYSTEMS AND CHAPTER

CODE SYSTEMS 1
OBJECTIVES

Know the following number systems: decimal,


binary, octal and hexadecimal and convert
the numbers from one system to another
Understand octal number system
Understand hexadecimal number system
Understand how binary codes are used in
computers representing decimal digits,
alphanumeric characters and symbols
NUMBER SYSTEMS
DECIMAL NUMBER SYSTEMS

• number system that is widely used in our daily


lives
• 0, 1, 2, 3, 1.5, …….
• Example : 12610
BINARY NUMBER SYSTEMS

Vital for a digital computer.


Two basic digits = 0 and 1
Is marked with 2 as a denominator
at the end of the LSB of the
number.
Example : 1010110012
BINARY NUMBER SYSTEMS

The right-most is the Least Significant Bit (LSB)

10011

The left-most is the Most Significant Bit (MSB)


ADDITON AND SUBTRACTION OF
BINARY NUMBER

ADDITION SUBTRACTION
0+0 0 0-0 0
1-0 1
0+1 1
0-1 1 (borrow 1
1+0 1 to be 10)
1+1 0 carry 1 1-1 0
ADDITION
• Adding two binary numbers together is like adding decimal
numbers, except 1 + 1 = 10 (in binary, that is), so you have to
carry the one to the next column:

Ex 2
ex 1
0001
0001
+ 0001
+ 0100
----
----
0010 (1 plus 1 is 10, carry the 1
0101 (no carries to get this)
to the next column)

Ex 3 Ex 4
0011 0011
+ 0011 + 0101
---- ----
0110 1000 (carry in every column here)
(1 + 1 = 10, so carry; then 1 + 1
+ 1 = 11, so carry again)
SUBTRACTION 9
• any subtracting number that less than the
subtracted number must be lend from a digit,
which at a larger sequence.

example 1
1010
- 0111
----
0011 (0-1, borrow 1 )
ADDITON AND SUBTRACTION OF
BINARY NUMBER
EXAMPLE 1: 110002 + 111002
ADDITON AND SUBTRACTION OF
BINARY NUMBER
EXAMPLE 2: 1110002 - 0111112
EXCHANGING BINARY TO
DECIMAL

101101012 = 1X27 + 1X25 + 1X24 +


1X22+ 1X20
=18110

101.12 = 1X22 + 1x20 + 1X2 -1

= 5.510
EXCHANGING BINARY TO
DECIMAL

101.0112 = (1x22)+(1x20)+(1x2-2)+(1x2-3)
= 4 + 1 + 0.25 + 0.125
= 5.37510
EXCHANGING DECIMAL TO
BINARY
Exchange 7510 to binary
2 75 Remainder
2 37 1
2 18 1
2 9 0
2 4 1
2 2 0
2 1 0
0 1

10010112
EXCHANGING DECIMAL TO
BINARY
Exchange 21.8410 to binary
2 21 Remainder 0.84 x 2 = 1.68
2 10 1
2 5 0 0.68 x 2 = 1.36
2 2 1
0.36 x 2 = 0.72
2 1 0
0 1

10101.1102
OCTAL NUMBER SYSTEMS

Vital for a digital computer.


Eight basic digits = 0,1,2,3,4,5,6,7
Is marked with 8 as a denominator
at the end of the LSB of the
number.
Example : 1268, 3158
ADDITION

6 + 7 + 1 = 14 – 8 =
6 carry 1
1 1
5 + 7 + 1 = 13 – 8 = 4 + 7 = 11 – 8 =
5 6 48
5 carry 1 3 carry 1
+ 7 7 78
--------------
1 5 6 38
ADDITION

45678 12348
+ 65378 + 56738
133268 71278
SUBTRACTION

1+8-6=3
borrow 1

5 1
5-2=3 1+8-7=2
6 2 18 borrow 1
- 2 6 78
--------------
3 3 28
SUBTRACTION

45578 35678
- 26648 - 26548
16738 07138
EXCHANGING OCTAL TO DECIMAL

1238 = (1 x 82) + (2 x 81) + (3 x 80)


= 64 + 16 + 3
= 8310
416.238 = (4 x 82) + (1 x 81) + (6 x 80) +
(2x8-1) + (3x8-2)
= 256 + 8 + 6 + 0.25 + 0.047
= 270.29710
EXCHANGING DECIMAL TO OCTAL
Exchange 48010 to octal
8 480 Remainder

8 60 0
8 7 4
0 7

7408
EXCHANGING DECIMAL TO OCTAL
Exchange 953.4510 to octal
8 953 Remainder
0.45 x 8 = 3.60
8 119 1
8 14 7 0.60 x 8 = 4.80

8 1 6 0.80 x 8 = 6.40
0 1

1671.3468
EXCHANGING OCTAL TO BINARY

5748 5 7 4 3 bit each

101 111 100

5748 = 1011111002
EXCHANGING BINARY TO OCTAL
Divide 3 bit each
starting from LSB

111110011112 011 111 001 111


3 7 1 7

111110011112 = 37178
HEXADECIMAL NUMBER SYSTEMS

Vital for a digital computer.


16 basic digits which are
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Is marked with 16 as a
denominator at the end of the LSB
of the number.
Example : 5ABC16, AB85216
ADDITION

B = 11, 11 + 7 + 1 =
19 – 16 = 3 carry 1

C = 12, 12 + 7 + 1 = 1 1
20 – 16 = 4 carry 1
C B A 16 A = 10, 10 + 7 = 17
+ 7 7 7 16 – 16 = 1 carry 1

--------------
1 4 3 1 16
ADDITION

4EA716 ABCD16
+ AF5916 + 567316
FE0016 1024016
SUBTRACTION

1 + 16 - 6 = 11 = B
borrow 1
5 1
5-2=3 6 2 1 16 1 + 16 - 7 = 10 = A
borrow 1
- 2 6 7 16
--------------
3 B A 16
SUBTRACTION

4EA716 ABCD16
- 2F5916 - 567316
1F4E16 555A16
EXCHANGING HEXADECIMAL TO
DECIMAL

ABC16 = (10 x 162) + (11 x 161) + (12 x 160)


= 2560 + 176 +12
= 274810
2BC.1516 = (2 x 162) + (11 x 161) + (12 x 160)
+ (1 x 16-1) + (5 x 16-2)
= 512 + 176 +12 + 0.0625 + 0.01953

= 700.082
EXCHANGING DECIMAL TO
HEXADECIMAL
Exchange 74510to Hexadecimal

16 745 Remainder
16 46 9
16 2 E
0 2

2E916
EXCHANGING DECIMAL TO
HEXADECIMAL
Exchange 953.4510 to Hexadecimal

16 953 Remainder 0.45 x 16 = 7.20

16 59 9 0.20 x 16 = 3.20
16 3 B
0.20 x 16 = 3.20
0 3

3B9.73316
EXCHANGING HEXADECIMAL TO
BINARY

4 bit each
9EF16 9 E F
1001 1110 1111

9EF16 = 1001111011112
EXCHANGING BINARY TO
HEXADECIMAL
Divide 4 bit each
starting from LSB

111110011112 = 0111 1100 1111


7 C F

111110011112 = 7CF16
EXERCISE
(OBE : DISCUSSION)
1. Convert into decimal
a. 1100102
b. 3258
c. BC6916
2. Arithmetic operations
a. 110012 + 10102
b. 2658 + 3128
c. 124B16 + 235D16
d. 101102 – 11002
e. 5678 – 2368
f. DB316 – A2316
ANSWER

1. Convert into decimal


a. 5010
b. 21310
c. 4823310

2. Arithmetic operations
a. 1000112
b. 5778
c. 35A816
d. 10102
e. 3318
f. 39016
SIGNED NUMBER

Consists of 1’s complement and 2’s


complement.

For positive binary number, 1’s


complement and 2’s complement is same.

For negative number, 1’s complement is


the reversal of binary number and 2’s
complement is 1’s complement added up
with 1.
1’S COMPLIMENT

1001 1010

Convert
0110 0101 0 to 1
1 to 0
2’S COMPLIMENT
1st step

1001 1010 Change to 1’s


compliment

2nd step

0110 0101 Add 1

+ 1
--------------
0110 0110 Answer
ARITHMETIC (ADDITION)
IMPORTANT NOTES!!!
1. Positive number :
Change to 8 bit binary number
20 + (-10)
2. Negative number :
a. Change to 8 bit binary number
a) 20 = 0 0001 0100 b. Change to 1’s compliment
c. Change to 2’s compliment

b) -10 = 1 0000 1010 1 1111 0101 (1’s) 1 1111 0110 (2’s)


Decimal number
c) 20
0 0001 0100 - 10
bit to be + 1 1111 0110 -------
ignore -------------- 10
1 0 0000 1010
ARITHMETIC (ADDITION)
Both numbers
are negative
- 13 + (-11)

a) -13 = 1 0000 1101 1 1111 0010 (1’s) 1 1111 0011 (2’s)

b) -11 = 1 0000 1011 1 1111 0100 (1’s) 1 1111 0101 (2’s)

c)
1 1111 0011
+ 1 1111 0101
bit to be --------------
ignore 1 1 1110 1000
ARITHMETIC (SUBTRACTION)

(+13) - (+11)

a) 13 = 0 0000 1101 0 0000 1101 (1’s) 0 0000 1101 (2’s)

b) 11 = 0 0000 1011 0 0000 1011 (1’s) 0 0000 1011 (2’s)

c)
0 0000 1101
- 0 0000 1011
--------------
0 0000 0010
ARITHMETIC (SUBTRACTION)

(-15) - (-20)

a) -15 = 1 0000 1111 1 1111 0000 (1’s) 1 1111 0001 (2’s)

b) -20 = 1 0001 0100 1 1110 1011 (1’s) 1 1110 1100 (2’s)

c)
1 1111 0001
- 1 1111 1100
--------------
0 0000 0101
B. BINARY CODED DECIMAL (BCD)

DECIMAL BCD 8421


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
EXCHANGING DECIMAL TO BCD

4 bit each

42310 4 2 3
0100 0010 0011

42310 = 0100 0010 0011BCD


EXCHANGING BCD TO DECIMAL

Divide 4 bit each


starting from LSB

111 1000 1001BCD 0111 1000 1001


7 8 9

111 1000 1001BCD = 78910


EXAMPLE

90510 BCD

9 0 5
1001 0000 0101

90510 = 1001 0000 0101BCD


C. ALPHANUMERIC NUMBER
(ASCII CODE)
MSB
LSB Binary 000 001 010 011 100 101 110 111

Binary Hex 0 1 2 3 4 5 6 7

0000 0 Nul Del sp 0 @ P ` p


0001 1 Soh Dc1 ! 1 A Q a q
0010 2 Stx Dc2 “ 2 B R b r
0011 3 Etx Dc3 # 3 C S c s
0100 4 Eot Dc4 $ 4 D T d t
0101 5 End Nak % 5 E U e u
0110 6 Ack Syn & 6 F V f v
0111 7 Bel Etb ‘ 7 G W g w
1000 8 Bs Can ( 8 H X h x
1001 9 HT Em ) 9 I Y i y
1010 A LT Sub * : J Z j z
1011 B VT Esc + ; K [ k {
1100 C FF FS , < L \ l |
1101 D CR GS - = M ] m }
1110 E SO RS . > N ^ n ~
1111 F SI US / ? O _ o del
EXAMPLE

2 o’clock

2 sp o ’ c l o c k

Bin 011 010 110 010 110 110 110 110 110
0010 0000 1111 0111 0011 1100 1111 0011 1011

Hex 32 20 6F 27 63 6C 6F 63 6B
GRAY CODE

Decimal Binary Gray Code


0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111

You might also like