lecture 9

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 24

Number system

Ahmed Bilal
Number system
• Binary numbers = 0,1
• Octal number 1 to 7 ( what about 8,9 similar 80 to 90 )
• Hex 1 to 9 and A to 10
Adding, subtraction, division of
number
• Adding subtraction
• 111 111
• +1 -1
• ------ -----
• 1000 110
Conversions
Let start form binary Let start form binary
Decimal to binary: (65)10 Binary to octal: (1000001)2
2|65 Strep 1: Binary to decimal
2|32-1 6 5 4 3 2 1 0 Octal
2|16-0 1x2+0x2+0x2+0x2+0x2+0x2+1x2 D/8 (…)8
2|8-0 64+1=65
2|4-0 Strep 2: O*8
2|2-0 8|65
8|8-1
|1-0
1-0
D/2 D/16
(1000001)2 (101)8 Decimal
Binary to decimal (…)10
6 5 4 3 2 1 0 Binary Hex
1x2+0x2+0x2+0x2+0x2+0x2+1x2
64+1=65 (…)2 (…)16
B*2 H*16
hexadecimal to binary number
Question 1: Convert A2B16 to an equivalent binary
number.
Solution: Given hexadecimal number = A2B 16
3016 = (3 × 161) + (0 × 160) First, convert the given hexadecimal to the equivalent
decimal number.
= 48 + 0
A2B16 = (A × 162) + (2 × 161) + (B × 160)
= 48(Decimal number)
Now we have to convert 4810 to = (A × 256) + (2 × 16) + (B × 1)
= (10 ×256) + 32 + 11
binary.
= 2560 + 43
Therefore,
= 2603(Decimal number)
Now we have to convert 2603 10 to binary
The binary number is 1100002
Hence, 3016 = 1100002
The binary number obtained is 101000101011 2
Hence, A2B16 = 1010001010112
Q.2: Convert 108 to a binary number.
Solution: Given number is 108
108 = (1 * 81) + (0 * 80)
=1*8+0*1
=8+0
= 8 (Decimal number)
Now convert this decimal number into its equivalent binary
number. Let us draw a table to show the conversion of decimal
to binary as given below.
Therefore, the equivalent binary number is 1000 2.
Decimal Number Quotient Remainder
divided by 2

8 divided by 2 4 0

4 divided by 2 2 0

2 divided by 2 1 0

1 divided by 2 0 1
1st and 2nd complement
• 1st complement of “0111” is “1000” inverse of first (invers)
• In 2nd after 1st complement add the 1 in MSB
• Example of 2nd complement
• 2nd complement of “0111” is “1001
• 2nd complement of “1100” is “0100”
BCD code
BCD
Decimal
digit 8 4 2 1
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
Excess-3 Code
Decimal Excess-3
0 0011
1 0100 Add 3 or subtract 3
2 0101
3 0110
4 0111 1001 (9) decimal value of
5 1000 9
6 1001
7 1010
+0011 (3) decimal value of
8 1011 3
9 1100 ----------
10 1101
11 1110 1100
12 1111 As the name shows that excess-3 is the addition of
BCD.
Excess-3 codes are unweighted and can be obtained by
adding 3 to each decimal digit then it can be
represented by using 4 bit binary number for each
digit.
2421 Code (Weight base)
Decimal Decimal
2 4 2 1 2 4 2 1
digit digit
0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 1 0 0 0 1
2 0 0 1 0 2 0 0 1 0
3 0 0 1 1 3 0 0 1 1
4 0 1 0 0 4 1 0 1 0
5 1 0 1 1 5 0 1 0 1
6 1 1 0 0 6 0 1 1 0
7 1 1 0 1 7 0 1 1 1
8 1 1 1 0 8 1 1 1 0
9 1 1 1 1 9 1 1 1 1
GRAY Code
Decimal No. BCD (8421) Excess-3 Code 2421 Code Gray Code
0 0000 0011 0000 0000
1 0001 0100 0001 0001
2 0010 0101 0010 0011
3 0011 0110 0011 0010
4 0100 0111 0100 0110
5 0101 1000 0101 0111
6 0110 1001 1100 0101
7 0111 1010 1101 0100
8 1000 1011 1110 1100
9 1001 1100 1111 1101
10 0001 0000 1101 1111
11 0001 0001 1110 1110
12 0001 0010 1111 1010
13 0001 0011 1011
14 0001 0100 1001
15 0001 0101 1000
Binary to gray conversion
Same =0
Different =1
Decimal 011 to gray
0 1 0
MSB

Decimal 7 binary value is 011 and gray code is 010


Boolean algebra
Two level implementation
Canonical Forms
Boolean logic
Boolean logic
K map

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy