0% found this document useful (0 votes)
3 views58 pages

Hexadecimal of Binary 10011101

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

Hexadecimal of Binary 10011101

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

Decimal Numbers

Eg.
1439 = 1 x 103 + 4 x 102 + 3 x 101 + 9 x 100

Thousands Hundreds Tens Ones

• Base / Radix = 10
• Base is the number of symbols in the number system.
Introduction to Number Systems

• We are all familiar with the decimal number system.


Some other number systems that we will work with
are:

• Binary → Base 2
• Octal → Base 8
• Hexadecimal → Base 16
Common Number Systems
Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F
Binary numbers?
• Computers work only on two states
✓ On
✓ Off

• Basic memory elements hold only two states


Zero / One

• Thus a number system with two elements {0,1}

• A binary digit – bit !


1

Form the binary numbers 0


0
0
1

2 1 POSITION 0 0 2
0 3
0 0 0
0 4
0 0 1
0 5
0 1 0
0 6
0 1 1 0 7
1 0 0 1 0
1 0 1 1 1
1 1 0 1 2
1 1 1 1 3
1 4
1 5
Form the Octal numbers 1 6
1 7
2 0
2 1
2 2
Assign weight in Decimal Number System
• Consider an Integer Decimal Number (1426)

1 4 2 6
103 102 101 100
=(1x103 )+(4X102 )+ (2x101 )+ (6X100 )

• Consider a fractional Decimal Number (1426.213)

1 4 2 6 . 2 1 3
103 102 101 100 . 10-1 10-2 10-3
= (1x103 )+(4X102 )+ (2x101 )+ (6X100 )+(2X) 10-1+( 1x 10-2 )+(3X10-3 )
Binary Decimal
➢ Integer Number
➢ 1101 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
=1x8+1x4+0x2+1x1
=8+4+0+1
Therefore (1101)2 = (13)10

➢ Fractional No.
➢ 1101.11 = (1 x 23 )+ (1 x 22) + (0 x 21 )+( 1 x 20 ) + (1X2-1)+ (1X 2-2)
= (1 x 8)+ (1 x 4) +( 0 x 2 ) + (1 x 1) + (1x 0.5) + (1X.25)
= 8 + 4 + 0 + 1+ 0.5+0.25
(1101.11)2 = (13.75 )10
Integer Decimal Binary
Double Dabble Method
Quotient Remainder
2 13 1 LSB
2 6 0
2 3 1
2 1 1 MSB
0

(13)10 = (1101)2
Fractional Decimal Binary
Decimal Number Binary
.294 X 2 = 0.588 0
.588 X 2 = 1.176 1 Result
.176 X 2 = 0.352 0 Fractional Decimal to Binary
.352 X 2 = 0.704 0
(0.294)10= (0.01001011)2
.704 X 2 = 1.408 1
.408 x 2 = 0.816 0
.816 X 2 = 1.632 1
.632 X 2 = 1.264 1
(1101)2
Bit 3 Bit 2 Bit 1 Bit 0
1 1 0 1
➢ = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20

➢ H.W. Convert given binary Examples to decimal 111, 10011, 10.10 10011.101,
101010

Bit 2 Bit 1 Bit 0


1 1 1
➢ = 1x2 +1x2 +1x2
2 1 0

=1X4 + 1X2 + 1X1


=4+2+1= 7
Q. Convert given Decimal to Binary
• (59.42)10 = (X)2

• 255.25

• 127

• 2176

• 13.24
Hexadecimal Decimal
• Consider an Integer Hexa Decimal Number (1B49)

1 B 4 9
163 162 161 160
= (1x163 ) + (11X162 ) + (4x161 )+ (9X160 )
= 4096 + 2816 + 64 + 9 = 6985

• Consider a fractional Hexa Decimal Number (6.2A3)

6 . 2 A(10) 3
160 . 16-1 16-2 16-3
= (6X160 ) + (2X) 16-1 ) + (10x 16-2 ) + (3X16-3 )
=6+ 0.125 + 0.039 + 000732 = 6.1647
Decimal Hexadecimal
Double Dabble Method Remainder

16 140 12=C LSB


8 8 MSB

(140)10 = (8C)16 = 8C H
Fractional Decimal Hexadecimal

Decimal HEX
3
0.243X16=3.888
0.888X16=14.208 14=E
Result

Fractional Decimal TO Hexadecimal


3
0.208x16=3.328
(0.243)10=(0.3E353)16
5
0.328x16=5.248
3
0.248x16=3.968
Octal Decimal
• Consider an Integer Octal Number (1426)8

1 4 2 6
83 82 81 80
= (1x83 ) + (4X82 ) + (2x81 )+ (6X80 )
= 512 + 256 + 16 + 6
= (790)10

• Consider a fractional Octal Number (6.273)


6 . 2 7 3
80 . 8-1 8-2 8-3
= (6X80 ) + (2X8-1 ) + (7x 8-2 ) + (3X8-3 )
= 6 + 0.25 + 0.1093 + .00585
= (6.365)10
Decimal Octal
Double Dabble Method
Quotient Remainder
8 13 5 LSB
8 1 1

MSB

(13)10 = (15)8
1. (58)10 = (X)8 2. (629) = (X)
10 8
Binary Hexadecimal
Binary Hexadecimal 0000 0
0001 1
0010 2
Method: Divide the string of binary bits into group s of
00114-bits from
3
L.S.B. to M.S.B. 0100 4
0101 5
For example: 0110 6
Consider the Binary number (1001 1101)2 = (?)16 0111 7

1001 1101 1000 8


1001 9
1010 A
= 9 (13)D 1011 B
1100 C
Therefore (10011101)2 = (9D)16 1101 D
1110 E
1111 F
Binary Hexadecimal
Example 2 :
Consider the Binary number (10 1001 1101)2 = (?)16
0010 1001 1101

= 2 9 (13)D

Therefore (10011101)2 = (29D)16


Binary Octal
Method: Divide the string of binary bits into groups of 3-bits from
L.S.B. to M.S.B. Binary Octal
000 0
For example: 001 1
Consider the Binary number (10 011 101)2 = (?)8 010 2
010 011 101 011 3
100 4
101 5
= 2 3 5
110 6
111 7
Therefore (10011101)2 = (235)8
Binary Hexadecimal
Hexadecimal Binary 0000 0
0001 1
0010 2
Method: Replace each HEX DIGIT with it’s 4-bit bi nary equivalent
0011 3
For example: 0100 4
Consider the Hex number ( 2C )16 = (?)2 0101 5
0110 6
= 2 C 0111 7
0010 1100 1000 8
1001 9
Therefore (2C)16 = (0010 1100)2 1010 A
1011 B
1100 C
1101 D
1110 E
1111 F
Binary Coded Decimal (BCD)
Method:
1. Each decimal digit is replaced with 4-bit. Binary equivalent
Decimal Binary
For example: 0 0000
1 0001
Consider the Decimal number (256)10 = (?)BCD
2 0010
3 0011
2 5 6 4 0100
0010 0101 0110 5 0101
6 0110
Therefore (256)10 = (0010 0101 0110)BCD
7 0111
8 1000
9 1001
Binary Coded Decimal (BCD) to Decimal
Method: Replace each group of 4 bit binary with equivalent
decimal no. Decimal Binary
For example: 0 0000

Consider the BCD CODE ( 10010101 )BCD = (?)10 1 0001


2 0010
1001 0101
3 0011
4 0100
= 9 5 5 0101
Therefore (1001 0101)BCD = (95)10 6 0110
7 0111
8 1000
9 1001
Binary Coded Decimal (BCD) to Decimal

Decimal Binary
1. (1001 1010)BCD 0 0000
1 0001
2. ( 01 1001 1101)BCD 2 0010
3 0011
are invalid BCD codes 4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Binary Coded Decimal (BCD)
Advantage
1. It is very popular code due to simplicity of conversion
2. To implement Hardware algorithm in BCD CONVERTER is
simple.

3. Easy to (convert) encode and decode decimals from BCD and


Vice versa.

4. Many digital systems work with BCD codes.


Binary Coded Decimal (BCD)
Disadvantages
1. Not efficient way of conversion
2. BCD codes for given decimal number requires more bits
compared to direct binary value.

3. The speed of arithmetic operations using BCD Codes is very


slow

4. Hardware designed is bulky.


Binary to BCD Conversion
Steps:-
Step 1 -- Convert the binary number to decimal.
Step 2 -- Convert decimal number to BCD.

➢ Example − convert (11101)2 to BCD.


• Step 1 − Convert to Decimal
Binary Number 1 1 1 0 1
Step 1 = ((1 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20))10
Step 2 = (16 + 8 + 4 + 0 + 1)10
Step 3 = 2910
Binary Number − 111012 = Decimal Number − 2910
Binary to BCD Conversion
• Step 2 − Convert to BCD
Decimal Number − 2910
Calculating BCD Equivalent.
Convert each digit into groups of four binary digits equivalent.

Decimal Number − 2 910


0010 1001BCD
Result:-

(11101)2 = (0010 1001)BCD


Binary to BCD Conversion
BCD to Binary Conversion
Steps
Step 1 -- Convert the BCD number to decimal.
Step 2 -- Convert decimal to binary.
Example − convert (00101001)BCD to Binary.
Binary to Grey
Method
Consider 4-bit binary number B3B2B1B0 . INPUT OUTP
UT
Say converted Grey code is G3G2G1G0
I2 I1 XOR

Given Binary B3 x+-or B2 + B1 + B0 0 0 O

0 1 1

Grey Code G3 G2 G1 G0 1 0 1

1 1 0
Binary to Grey
Method
INPUT OUTP
Consider 4-bit binary number B3B2B1B0 (1011) UT
. Let us find Grey code is G3G2G1G0 value . I2 I1 XOR

Given Binary 1 x
+ 0 + 1 + 1 0 0 O
-or
0 1 1

1 0 1
Grey Code G3 G2 G1 G0
1 1 1 0 1 1 0

Therefore B3B2B1B0 (1011)= (1110)Grey .


Binary to Grey
General Method
1. Given n-bit binary number Bn-1 …. B2B1B0 is converted into
n-BIT GREY CODE. Gn-1…..G2G1G0
2. M.S.B bit Gn-1 of Grey code is equal to M.S.B. bit of given
binary no.
3. Remaining grey bits are x-or Condition of same position
and previous higher position bit of given binary.

Given Binary B3 +
x-or B2 + B1 + B0

Grey Code G3 G2 G1 G0
Grey to Binary
Method
Consider 4-bit Grey code is G3G2G1G0 INPUT OUTP
UT
. I2 I1 XOR
Say converted binary number B3B2B1B0 0 0 O

Given GREY G3 G2 G1 G0 0 1 1

1 0 1

1 1 0
Binary number B3 B2 B1 B0
Grey to Binary
For Example
Consider 4-bit Grey code is G3G2G1G0 = 1101 INPUT OUTP
UT
. I2 I1 XOR
Say converted binary number B3B2B1B0
0 0 O

Given GREY 1 1 0 1 0 1 1

1 0 1

1 1 0
Binary number B3 B2 B1 B0
1 0 0 1
Grey to Binary
General Method
1. Given n-bit GREY CODE. Gn-1…..G2G1G0 is converted into n-
BIT binary number Bn-1 …. B2B1B0
2. M.S.B bit Bn-1 of Binary number is equal to M.S.B. bit of
given Grey code.
3. Remaining binary bits are x-or Condition of same position
Grey bit and previous higher position binary bit.

Given GREY G3 G2 G1 G0

Binary number B3 B2 B1 B0
Alphanumeric Representation
• Computers do not understand the English alphabet, numbers except 0 and 1,
or text symbols.
• We use encoding to convert these.
•Alphanumeric Representation are also called as character codes.
•These are standard data-encoding format for electronic
communication between computers.
• The Two Popular character codes are:-
i) ASCII ( American Standard Code for Information Interchange)
ii) EBCDIC (Extended Binary Coded Decimal Interchange Code )
Features Features of ASCII code
1. Represent all type of data composed of alphabets, symbols and
numbers instead of only numerical data.
2. Called as character code
3. Each alphabet, symbol and number is represented as 7 bit
Binary code . Therefore they are easily used and processed by
computers and other digital devices.
4. 7-bits allow representation of 27 means 128 number of
different codes.
5. Also used by various common input /output devices
(peripherals) in the system like Keyboard, Monitor, Mouse
Printer etc.
➢ASCII (American Standard Code for Information Interchange)

• This is a 7- bit code.

• ASCII assigns standard numeric values to letters, numerals, punctuation marks,


and other characters used in computers.

• Each character has been assigned a unique binary string.

•Eg:- the letter A is represented by 1000001(4116), the comma(,) by


0101100(2C16) and the backspace(BS) by 0001000(0816) etc.
LSBs MSBs
Binary Addition (1 of 2)

A B A+B
0 0 0
0 1 1
1 0 1
1 1 10
“two”
Binary Addition (2 of 2)

Two n-bit values


Add individual bits
Propagate carries
Carry
E.g.,
1 1
10101 21
+ 11001 + 25
101110 46
Inputs Output
A B Difference Borrow
[A-B]
0 0 0 0

0 1 1 1

1 0 1 0

1 1 0 0
Inputs Output
A B Sum Carry
[A+B]
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
CARRY
Inputs Output
A B Difference Borrow
[A-B]
0 0 0 0

0 1 1 1

1 0 1 0

1 1 0 0
1’s complement of [1101 1010] InputsInputsOutput
Output
= [0010 0101] A BA B Difference
Sum Carry
Borrow
[A+B]
[A-B]
& 0 00 00 0 0 0

0 10 11 1 0 1

1 01 01 1 0 0

1 11 10 0 1 0
’s complement of B [1101 1010]
= 1’S complement 0f B [0010 0101]
+ 1
Inputs Output
0010 0110 A B Sum Carry
[A+B]
0 0 0 0
0 1 1 0
1 0 1 0
0 1 1 0 1
carry
’s complement of B [1101 1010]
= 1’S complement 0f B [0010 0101]
+ 1
0010 0110

Note: If carry is 1 , then the subtraction result is the result of addition without carry
Assignment : Subtract the following numbers using all (direct , 1’S and 2’s complement )
method of subtraction
1. [A= 1101] - [B=1101]

2. [A= 1011 0111] - [B=1001 1100]

3. [A= 1001 1101] - [B= 100 1101 ]


Thank you

[Link]'s,Modern College of Arts ,Science and


57
Commerece,Ganeshkhind,Pune-16

You might also like