13 Binary System
13 Binary System
13 Binary System
Hexadecimal Base 16 H
Significant Digits
Binary: 11101101
Hexadecimal: 1D63A7A
000 0
001 1
Binary 010 2
Numbering 011 3
Scale
100 4
101 5
110 6
111 7
Decimal to Binary Conversion
1 0 0 0 0 1 12
Binary to Decimal Conversion
Binary 1 0 1 0 1 1 0 1
x x x x x x x x
Positional Values 27 26 25 24 23 22 21 20
Products 128 + 32 + 8 + 4 + 1
17310
Octal Number System
• Base 16 system
• Uses digits 0-9 &
letters A,B,C,D,E,F
• Groups of four bits
represent each
base 16 digit
Decimal to Hexadecimal Conversion
Convert 83010 to its hexadecimal equivalent:
33E16
Hexadecimal to Decimal Conversion
Convert 3B4F16 to its decimal equivalent:
Hex Digits
3 B 4 F
x x x x
Positional Values
163 162 161 160
Products 12288 +2816 + 64 +15
15,18310
Binary to Hexadecimal Conversion
• The easiest method for converting binary to hexadecimal
is to use a substitution code
• Each hex number converts to 4 binary digits
binary Octal
By making pairs of 3 bits
binary Hexadecimal
By making pairs of 4 bits
Binary Addition
• Rule for binary addition is as follows:
0+0=0
0+1=1
1+0=1
1 + 1 = 0 plus a carry of 1 to next higher column
Binary Addition (Example 1)
Example
Add binary numbers 10011 and 1001 in both decimal and
binary form
Solution
Binary Decimal
carry 11 carry 1
10011 19
+1001 +9
11100 28
In this example, carry are generated for first and second columns
Binary Addition (Example 2)
Example
Solution
Binary Decimal
1000010 66
Binary Subtraction
• Rule for binary subtraction is as follows:
1–0=1
0-0=0
0 - 1 = 1 with a borrow from the next column 1 - 0 = 1
1-1=0
Binary Subtraction (Example)
Example
Solution
10101
-01110
00111
1’s complement
2’s complement
Subtraction using 1’s complement
DECIMAL BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
ASCII (American Standard Code for Information
Interchange)
• It is used in small computers and peripheral, instruments
and communication devices
• It is a 7 bit code
• Upto 128 characters can be coded.
• Letter, digits, lowercase, uppercase, special symbols
included.
ASCII -8
It is mainly used on IBM mainframe and IBM mid range computer operating
systems.
It is a coded binary representation of a decimal digit which has a change in 1-bit position for
consecutive digits.
If there is any error in code, we can at least be assured that there will be only one bit position
change.
Gray codes are used in the general sequence of hardware-generated binary numbers.
These numbers cause errors when the transition from one number to its successive is done.
This code simply solves this problem by changing only one bit when the transition is between
numbers is done.
Binary to Gray conversion
1. Record the MSB (most significant bit) as it is.
2. Add the MSB to the next bit, Record the sum, and neglect the carry.
3. Repeat this process.
1011
Gray Code
Table
Decimal Digit BCD Code Excess-3 Code
1 0001 0100
8 1000 1011
9 1001 1100
Fixed-Point Representation
• Signed No
• E.g. -9, +9
• Unsigned No.
• E.g. 9
Signed Number representation
• To represent a –ve no. a 1
1. Signed magnitude representation is placed before the no.
• 0→+
• 1→- • Ex.
2. Signed 1’s complement • -9 will be represented as
representation 1 1001
3. Signed 2’s complement
representation
Signed magnitude representation
• 0→+ve
• 1→-ve
• Most significant bit represent as a sign bit, of an integer & remaining
bits represent magnitude.
• Syntax: Sign bit Magnitude
(first bit) (binary bits)
-7➔1111 +7➔0111
Complement form
Sign bit 1’s complement of no.
-7➔1000 +7➔0000
-7➔1001 +7➔0001
Signed Number representation
• There are only one way to represent +ve no. but 3 ways to represent a –ve no.
1. Signed magnitude representation
11001
2. Signed 1’s complement representation
10110
3. Signed 2’s complement representation
10111