You are on page 1of 14

• 1’s complement: 1’s complement of a binary number is the number that results when

we change each 0 to a 1 and each 1 to a 0.

• 1’s complement subtraction:


• 2’s Complement: 2’s complement results when we add ‘1’ to 1’s complement of
the given number i.e., 2’s complement =1’s complement + 1

• 2’s Complement Subtraction:


• 9'S COMPLEMENT AND 10’S COMPLEMENT:
1. find the 9’s & 10’s complement of 456. 2. find the 9’s & 10’s complement of 686.
1. Find 215-155 using 9’s complement subtraction.

2. Find 4567-1234 using 9’s complement subtraction.


First calculate 9’s complement of 1234.
Add the 9’s complement value with 4567.
If carry is generated add to the result.

3. Find 428-389 using 9’s complement subtraction.


• 10’s complement Subtraction:

1. A = 215
B = 155
10’s complement of B = 845
Adding 10’s complement of B to A

2. A = 4567
B = 1234
10’s complement of B = 8766
Adding 10’s complement of B with A
• BCD addition:
Eg:
• BCD subtraction:
Hamming code:
• Hamming code is invented by R.W. Hamming.
• Hamming code detect the error in binary information (1 bit at a time).
• Hamming code as follows.
1. Generate hamming code
2. Parity generator.
3. Error correcting.
❖ Formulae for parity bits n+k < (𝟐𝒌 − 𝟏)
1. N= 010101101. Find the Hamming code?
Parity bits = n+k < (2𝑘 − 1) k=1,2,3,4,5

9+1 < (2 – 1) F
9+2 < (4 – 1) F
9+3 < (8 – 1) F
9+4 < (16 – 1) T

P1 P2 0 P4 1 0 1 P8 0 1 1 0 1

P1 = 0 XOR 1 XOR 1 XOR 0 XOR 1 XOR 1 =0


C1 = 0
P2 = 0 XOR 0 XOR 1 XOR 1 XOR 1 =1 C2 = 0
P4 = 1 XOR 0 XOR 1 XOR 0 XOR 1 =1 C4 = 0
C8 = 0
P8 = 0 XOR 1 XOR 1 XOR 0 XOR 1 =1
2. N= 0011001100110110011. Find the Hamming code?
Parity bits = n+k < (2𝑘 − 1) k=1,2,3,4,5
19+1 < (2 – 1) F
19+2 < (4 – 1) F
19+3 < (8 – 1) F
19+4 < (16 – 1) F
19+5 < (32 – 1) T

P1 P2 0 P4 0 1 1 P8 0 0 1 1 0 0 1 P16 1 0 1 1 0 0 1 1

P1 = 0 XOR 0 XOR 1 XOR 0 XOR 1 XOR 0 XOR 1 XOR 1 XOR 1 XOR 0 XOR 1 =0
P2 = 0 XOR 1 XOR 1 XOR 0 XOR 1 XOR 0 XOR 1 XOR 0 XOR 1 XOR 0 XOR 1 =0
C1 = 0
P4 = 0 XOR 1 XOR 1 XOR 1 XOR 0 XOR 0 XOR 1 XOR 1 XOR 0 XOR 0 XOR 1 =0 C2 = 0
P8 = 0 XOR 0 XOR 1 XOR 1 XOR 0 XOR 0 XOR 1 XOR 1 =0 C4 = 0
P16 = 1 XOR 0 XOR 1 XOR 1 XOR 0 XOR 0 XOR 1 XOR 1 =1 C8 = 0
C16 = 0
1. Hamming Code = 10111001100111 . Separate n and k values?

1 0 1 1 1 0 0 1 1 0 0 1 1 1

P1 = 1 P2 = 0 P4 = 1 P8 = 1
n=1100100111

2. Hamming Code = 10110111100100 . Separate n and k values?

3. Hamming Code = 10001001100101 . Separate n and k values?

4. n = 10011101101011. Find the Hamming code?

You might also like