• No se han encontrado resultados

Conclusiones y Recomendaciones

In document TECNOLÓGICO DE MONTERREY (página 62-70)

Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in (b) 96.42

BCD Equivalent =1001 0110 1000 0010.

Now, we will consider BCD to binary and binary to BCD conversion.

2.3.1 BCD-to-Binary Conversion

BCD to binary conversion is simple and can be performed in two steps only. First, write the decimal equivalent of given BCD number and then convert it into binary equivalent. Decimal to binary conversion have discussed earlier in chapter-1.

EXAMPLE 2.2

Convert the following BCD code into its equivalent binary.

.

00101001 01110101BCD

7 A

SOLUTION :

We convert decimal number _29 75. i10 into equivalent binary using the methodology discussed in previous chapter.

Conversion of integer part:

Conversion of fractional part:

Thus _29 75. i10 =_11101 11. i2

Therefore, BCD-to-binary conversion is

. 0010 1001 0111 0101BCD 7 A =_11101 11. i2 2910 _ i =_11101i2 . 0 75 10 _ i =_0 11. i2

Page 84 Binary Codes Chapter 2

Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in

EXAMPLE 2.4

Perform the following decimal addition in BCD code. (a) 147+380 (b) 385+118 (c) 191+171 (d) 917+215 SOLUTION : (a) (b) (c)

Since a carry is propagated from the second digit, the second digit is an invalid BCD. Add 6 to the second digit to get correct result.

Page 86 Binary Codes Chapter 2

Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in

BCD Subtraction using 9’s Complement

The steps for BCD subtraction using 9’s complement are given in following methodology.

M E T H O D O L O G Y

1. Find the 9’s complement of the second number(i.e., number to be subtracted).

2. Convert first number and 9’s complement of second number into their equivalent BCD codes.

3. Perform BCD addition of the first number with the 9’s complement of the second number.

4. If carry is generated, then the result is positive. Add the carry to the result to get the correct result. I

5. If carry is not generated, then the result is negative and it is in 9’s complement form. So, Take the 9’s complement of this result and place a negative sign in front to get the final answer.

DO REMEMBER

The 9’s complement of a decimal number is obtained by subtracting each digit of the decimal number from 9.

EXAMPLE 2.6

Perform the following decimal subtraction in BCD by the 9’s complement method. (a) 68-24 (b) 24-68 (c) 897-768 (d) 130-245 SOLUTION : (a) _68-24i =68+(9’s complement of 24) 68 75 = + (b) _24-68i =24+(9’s complement of 68) =24+31

Carry is not generated, the result is negative and in its 9’s complement form.

Page 88 Binary Codes Chapter 2

Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in In decimal the above subtraction can be performed using 9’s

complement as shown below.

(b) . . 679 6-885 9 =679 6. +9’s complement of 885.9 . . 679 6 114 0 = +

There is no carry, so answer is negative and in its 9’s complement form.

Result =-9’s complement of 793.6

. 206 3 =-

In decimal the above subtraction can be performed as shown below.

There is no carry, so answer in negative and in its 9’s complement form.

Result =-9’s complement of _793 6. i10 .

206 3 =-

BCD Subtraction using 10’s Complement

Similarly, subtraction of the second number from the first number is the addition of 10’s complement of the second number with the first number. The steps to perform BCD substraction using 10’s complements are given as below:

Page 90 Binary Codes Chapter 2

Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in Carry is not generated, the result is negative and in its 10’s complement

form. Result =-10’s complement of _ i5610 44 =- (c) 897-768 =897+10’s complement of 768 ( 897 9 = + ’s complement of 768+1) 897 231 1 = +_ + i 897 232 = +

There is carry, so answer is positive and in its true form. (d) 130-245 =130+10’s complement of 245 ( 130 9 = + ’s complement of 245+1) 130 754 1 = +_ + i 130 755 = +

There is no carry, so answer is negative and in its 10’s complement form.

Result =-10’s complement of 885

115 =-

EXAMPLE 2.9

Perform the following subtraction using BCD arithmetic. (a) 342 7. -108 9. (b) 206 4. -507 6.

Page 92 Binary Codes Chapter 2

Digital Electronics by Ashish Murolia and RK Kanodia For More Details visit www.nodia.co.in code. It is a modified form of BCD code.

The excess-3 code for a given decimal number is determined by adding ‘3’ to each decimal digit in the given number and then replacing each digit of the newly found decimal number by its four-bit binary equivalent.

The excess-3 codes of single decimal digits 0-9 are given in Table 2.5.1 below:

Table 2.5.1: Excess-3 code equivalent of decimal numbers

Decimal Digit 0 1 2 3 4 5 6 7 8 9

Excess-3 Code 0011 0100 0101 0110 0111 0100 1001 1010 1011 1100 The XS-3 code has six invalid states 0000, 0001, 0010, 1101,

1110 and 1111. For example let us find out the excess-3 code of 56

Self Complementary Feature of Excess-3 Code

As we have already discussed that excess-3 code is self complementing. This is a special feature of this code. It means that the excess-3 code for the 9’s complement of a decimal number can be obtained by taking 1’s complement of the excess-3 code of that decimal number. For example take decimal number 3. Its 9’s complement is 6 for which excess-3 code is 1001. Now, this code can be obtained directly by taking 1’s complement of excess-3 code of 3. The excess-3 code of 3 is 0110 and its 1’s compelment is 1001.

Remarks:

1. Similar to BCD code, in excess-3 code, the N digit decimal is represented by _4 #Ni bits. For example, excess-3 code of 12 is

01000101 and there are 8 bits. On the other hand, the binary code of 12 is 1100 and there are 4 bits. This shows that the excess-3 code is not efficient as compared to binary. It requires more space and time to transmit the information.

2. It is very useful for arithmetic operations as it overcomes the problem encountered in BCD addition of two numbers whose sum exceeds 9. The excess-3 code has no such limitation, and it simplifies arithmetic operations.

3. Another feature that makes this code useful for performing arithmetic operations is its self-complimenting nature. The addition and subtraction of excess-3 codes will be explained in appendix.

READER NOTE

Excess-3 code is non-weighted and sequential code.

FINDING DECIMAL EQUIVALENT OF A

In document TECNOLÓGICO DE MONTERREY (página 62-70)