In this section, we will examine some methods of using combinational logic circuits to convert from one code to another.
After completing this section, you should be able to u Explain the process for converting BCD to binary u Use exclusive-OR gates for conversions between binary and Gray codes
在这一节中,我们将研究使用组合逻辑电路将一个编码转换为另一个编码的一些方法。
完成本节后,您应该能够:
- 解释将BCD转换为二进制的过程
- 使用异或门在二进制和格雷码之间进行转换
BCD-to-Binary Conversion
One method of BCD-to-binary code conversion uses adder circuits. The basic conversion process is as follows:
1. The value, or weight, of each bit in the BCD number is represented by a binary number.
2. All of the binary representations of the weights of bits that are 1s in the BCD number are added.
3. The result of this addition is the binary equivalent of the BCD number.
A more concise statement of this operation is
The binary numbers representing the weights of the BCD bits are summed to produce the total binary number. Let’s examine an 8-bit BCD code (one that represents a 2-digit decimal number) to understand the relationship between BCD and binary. For instance, you already know that the decimal number 87 can be expressed in BCD as
Binary-to-Gray and Gray-to-Binary Conversion
The basic process for Gray-binary conversions was covered in Chapter 2. Exclusive-OR gates can be used for these conversions. Programmable logic devices (PLDs) can also be programmed for these code conversions. Figure 6–40 shows a 4-bit binary-to-Gray code converter, and Figure 6–41 illustrates a 4-bit Gray-to-binary converter