×
When you want to succeed as bad as you want to breathe, then you’ll be successful.

# Note for Digital Electronics Circuit - DEC by Suman Kumar Acharya

• Digital Electronics Circuit - DEC
• Note
• Biju Patnaik University of Technology Rourkela Odisha - BPUT
• Electrical and Electronics Engineering
• B.Tech
• 8 Topics
• 1697 Views
Page-1

#### Note for Digital Electronics Circuit - DEC by Suman Kumar Acharya

Topic: / 193

0 User(s)

#### Text from page-1

Mitu Baral Coding Lecture Lecture NO.: Two Binary Coded Decimal The binary coded decimal (BCD) is a type of binary code used to represent a given decimal number in an equivalent binary form. BCD-to-decimal and decimal-to-BCD conversions are very easy and straightforward. It is also far less cumbersome an exercise to represent a given decimal number in an equivalent BCD code than to represent it in the equivalent straight binary form discussed in the previous chapter. The BCD equivalent of a decimal number is written by replacing each decimal digit in the integer and fractional parts with its four-bit binary equivalent. As an example, the BCD equivalent of (23.15)10 is written as (0010 0011.0001 0101)BCD. The BCD code described above is more precisely known as the 8421 BCD code, with 8, 4, 2 and 1 representing the weights of different bits in the four-bit groups, starting from MSB and proceeding towards LSB. This feature makes it a weighted code, which means that each bit in the four-bit group representing a given decimal digit has an assigned Decimal 8421 BCD code 4221 BCD code 5421 BCD code 0 0000 0000 0000 1 0001 0001 0001 2 0010 0010 0010 3 0011 0011 0011 4 0100 1000 0100 5 0101 0111 1000 6 0110 1100 1001 7 0111 1101 1010 8 1000 1110 1011 9 1001 1111 1100 weight. Other weighted BCD codes include the 4221 BCD and 5421 BCD codes. Again, 4, 2, 2 and 1 in the 4221 BCD code and 5, 4, 2 and 1 in the 5421 BCD code 1

#### Text from page-2

Mitu Baral Coding Lecture Lecture NO.: Two represent weights of the relevant bits. Table 2.1 shows a comparison of 8421, 4221 and 5421 BCD codes. As an example, (98.16)10 will be written as 1111 1110.0001 1100 in 4221 BCD code and 1100 1011.0001 1001 in 5421 BCD code. Since the 8421 code is the most popular of all the BCD codes, it is simply referred to as the BCD code. BCD-to-Binary Conversion A given BCD number can be converted into an equivalent binary number by first writing its decimal equivalent and then converting it into its binary equivalent. we will find the binary equivalent of the BCD number 0010 1001.0111 0101: • BCD number: 0010 1001.0111 0101. • Corresponding decimal number: 29.75. • The binary equivalent of 29.75 can be determined to be 11101 for the integer part and .11 for the fractional part. • Therefore, (0010 1001.0111 0101)BCD =(11101.11)2. Binary-to-BCD Conversion The process of binary-to-BCD conversion is the same as the process of BCD-tobinary conversion executed in reverse order. A given binary number can be converted into an equivalent BCD number by first determining its decimal equivalent and then writing the corresponding BCD equivalent Excess-3 Code The excess-3 code is another important BCD code. It is particularly significant for arithmetic operations as it overcomes the shortcomings encountered while using the 8421 BCD code to add two decimal digits whose sum exceeds 9. The excess-3 code has no such limitation, and it considerably simplifies arithmetic operations. Table (1) lists the excess-3 code for the decimal numbers 0–9. The excess-3 code for a given decimal number is determined by adding ‘3’ to each decimal digit in the given 2

#### Text from page-3

Mitu Baral Coding Lecture Lecture NO.: Two number and then replacing each digit of the newly found decimal number by its fourbit binary equivalent. It may be mentioned here that, if the addition of ‘3’ to a digit produces a carry, as is the case with the digits 7, 8 and 9, that carry should not be taken forward. The result of addition should be taken as a single entity and subsequently replaced with its excess-3 code equivalent. As an example, let us find the excess-3 code for the decimal number 597: • The addition of ‘3’ to each digit yields the three new digits/numbers ‘8’, ‘12’ and ‘10’. • The corresponding four-bit binary equivalents are 1000, 1100 and 1010 respectively. • The excess-3 code for 597 is therefore given by: 1000 1100 1010=100011001010. Also, it is normal practice to represent a given decimal digit or number using the maximum number of digits that the digital system is capable of handling. For example, in four-digit decimal arithmetic, 5 and 37 would be written as 0005 and 0037 respectively. The corresponding 8421 BCD equivalents would be 0000000000000101 and 0000000000110111 and the excess-3 code equivalents would be 0011001100111000 and 0011001101101010. Corresponding to a given excess-3 code, the equivalent decimal number can be determined by first splitting the number into four-bit groups, starting from the radix point, and then subtracting 0011 from each four-bit group. The new number is the 8421 BCD equivalent of the given excess-3 code, which can subsequently be converted into the equivalent decimal number. As an example, following these steps, the decimal equivalent of excess-3 number 01010110.10001010 would be 23.57. Another significant feature that makes this code attractive for performing arithmetic operations is that the complement of the excess-3 code of a given decimal number yields the excess-3 code for 9’s complement of the decimal number. As adding 9’s complement of a decimal number 3

#### Text from page-4

Mitu Baral Coding Lecture Lecture NO.: Two B to a decimal number A achieves A – B, the excess-3 code can be used effectively for both addition and subtraction of decimal numbers. Table (1) lists the excess-3 code for the decimal numbers 0–9. Decimal number Excess-3 code Decimal number Excess-3 code 0 0011 5 1000 1 0100 6 1001 2 0101 7 1010 3 0110 8 1011 4 0111 9 1100 Example Find (a) the excess-3 equivalent of (237.75)10 and (b) the decimal equivalent of the excess-3 number 110010100011.01110101. Solution (a) Integer part=237. The excess-3 code for (237)10 is obtained by replacing 2, 3 and 7 with the four-bit binary equivalents of 5, 6 and 10 respectively. This gives the excess-3 code for (237)10 as: 0101 0110 1010=010101101010. Binary Codes 23 Fractional part=.75. The excess-3 code for (.75)10 is obtained by replacing 7 and 5 with the four-bit binary equivalents of 10 and 8 respectively. That is, the excess-3 code for (.75)10 =.10101000. Combining the results of the integral and fractional parts, the excess-3 code for (237.75)10 =010101101010.10101000. (b) The excess-3 code=110010100011.01110101=1100 1010 0011.0111 0101. Subtracting 0011 from each four-bit group, we obtain the new number as: 1001 0111 0000.0100 0010. Therefore, the decimal equivalent=(970.42)10. 4