Binary Addition
Binary Addition
Binary Addition
Example:
(1100110011) ₂ +(110011111) ₂ =
1100110011
110011111
--------------------
C=1 0011010010
Sol: (10011010010) ₂
(1111111)₂ +(111111)₂ =
1111111
111111
-------------------
C=1 0111110
----------------------
Sol: (10111110) ₂
BINARY SUBTRACTION:
The rules for binary subtraction are:
0–0=0
1–0=1
1 –1 = 0
10 – 1 = 1
For example:
1001
-111
-------------
0010
Step 1: The Least Significant Bits in the first column are 1 & 1, so, 1-1 = 0
Step 2: In the second column, it is not possible to subtract 1 from 0. So a 1 has to be
borrowed from from the next Most Significant bit (MSB). But since the 3rd bit is also 0,
borrowing has to be done from the MSB (4th bit). The borrowing of 1 from the 4th bit
(with weight 8) results in a 1 & 10 with weight 4 each.Now the subtraction is performed
as 10-1 = 1
Step 3 : In the 3rd column, the difference is given by 1-1 =0
Step 4 : In the 4th column, the difference is given by 0.
Example:
Q : (10001001)₂ – (1111111)₂ = (?)₂
Sol: 00001010₂
Sol: (01000010) ₂
Complement of 6₈
(8)¹ - 1 = 7₁₀
Also, 6₈ = 6₁₀
Therefore, 7₁₀ - 6₁₀=1₁₀
Q : Complement of 10101₂ = 01010₂
(Or)
2⁵ - 1 = 31₁₀
10101₂ = 21₁₀ = 10₁₀ = 01010₂
64
18
--------
82
--------
Step 3 : Since no CARRY, so recomplement.
Result= (99-82) = -17₁₀
1011100
1000111
---------------
Carry 1 0100011
1
---------------
0100100
----------------
ASSIGNMENT:
1. 101001₂ - 010111₂
2. 110111₂ + AF₁₆
3. 101101101₂ + 01111101₂
4. 73A₁₆+ 259₁₆
5. 273₈ + 111000111₂
BCD CODE:
Binary Coded Decimal – In this code each digit of a decimal number system is
converted into its Binary equivalent rather than converting the entire decimal value
into a pure Binary form.
We use group of 4 bits to represent a digit in BCD. 4 bits can represent only digits
because 4 bits are insufficient to represent various characters used by the computer. In 6
bit BCD code 2 additional zone bits are added & we can represent 64 (2⁶) different
characters. This is sufficient number to code the decimal digits (10), alphabetic
characters (26) & other special symbols (28).
EBCDIC CODE:
Extended Binary Coded Decimal Interchange Code- In this code it is possible to
represent 256 (2⁸). It also allows a large variety of printable characters & non printable
control characters.
EBCDIC can be easily divided into 2 4 bit groups. Each of these 4 bit groups
can be represented by 1 hexa digit. Thus Hexadecimal Number system is used as a
shortcut notation for memory dump by computers that use EBCDIC for internal
representation of characters.
Two types of formats :
1. Zoned Decimal Format
2. Packed Decimal Format.
ASCII:
American Standard Code for Information Interchange - It is accepted by several computer
manufacturers as their computer’s internal code. This code is popular in data
communications, is used almost exclusively to represent data internally in micro
computers.
ASCII is of two types:-
ASCII – 7 7 bit code 2⁷ = 128
ASCII – 8 8 bit code 2⁸ = 256
Additional bit is added to the Zone bit.