Sei sulla pagina 1di 5

BINARY ADDITION:

The rules of binary addition are as follows:


0+0=0
0+1=1
1+0=1
1+1=0 with a Carry = 1

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₂

Q : (10000001) ₂ – (111111) ₂ = (?)₂

Sol: (01000010) ₂

Additive Method of Subtraction :


When subtraction is implemented by means of digital components this method is found to
be more efficient. This is called Complementary Subtraction.

Q : Find the complement of 37₁₀.


Value of base = 10
No: of digits = 2
So (Base)ⁿ - 1 = 10 ² - 1
Now 99 – 37 = 62
So 37₁₀ = 62 ₁₀

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₂

Subtraction by complementary method involves:


Step 1 : Find the complement of the number you are subtracting.
Step 2 : Add this to the minuend (the value from which subtraction has to be done).
Step 3 : If there is a CARRY of 1, add it to obtain the result, if there is no CARRY
recomplement the SUM & attach a negative sign to obtain result.

Q: 56₁₀ from 92₁₀


Step 1 : 10² - 1 = 99₁₀
99 – 56 = 43₁₀
Step 2: 92
+43
-----------
C 135
1
------------
36
------------

Q : 35₁₀ from 18₁₀ using complementary method.


Complement of 35₁₀
10² - 1 = 99₁₀
99 – 35 = 64₁₀

64
18
--------
82
--------
Step 3 : Since no CARRY, so recomplement.
Result= (99-82) = -17₁₀

Q : Subtract 0111000₂ from 1011100₂ using complementary method.


Complement of 0111000₂ = 1000111₂
Add this to the minuend:

1011100
1000111
---------------
Carry 1 0100011
1
---------------
0100100
----------------

Q: Subtract 100011₂ from 010010₂


Step 1 : 011100₂
Step 2 : 010010
011100
--------------
101110
---------------
Step 3 : No CARRY.So recomplement.
i.e; 010001₂

Q : 01110₂ from 10101₂.


Ans : 00111₂

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.

Decimal Digit Binary Equivalent


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

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.

When a numeric value is represented in EBCDIC, to represent whether number is


positive, negative or unsigned sign indicator is used in the zone position of the rightmost
digit.
Printers print only those numeric charaters that are in a Zoned Decimal
Format so this format is useful while printing the Data.
Most computers cannot perform arithmetic operations on Zoned Decimal
Data. To perform arithmetic calculation it had to be converted to 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.

Potrebbero piacerti anche