Module input and output function definition: The 10-digit BCD code is defined as follows: Requirements Binary to BCD code logicĭesign one 8-bit unsigned binary number(value range 0 ~ 255) to 10-digit BCD codeconversion combinational logic circuit. Taking the input as an 8-bit binary number 10100101 (decimal 165) as an example, the range of 8-bit binary number is 0~255, and the BCD code needs to represent hundreds, tens, and ones:Įnter the third digit 1 to get 101, because 101 > 100, correction: 101 + 011 = 1000 Įnter the seventh bit 0 to get 1000_0010, 1000 > 100, correction: 1000 + 011 = 1011 Įnter the eighth bit 1 to get 1_0110_0101, and the output result is 0001_0110_0101(decimal 165). Or take the input as 4-digit binary number 1110 as an example:Įnter the third digit to get 111 > 100, and make corrections on the basis of 111, that is, 111 + 011 = 1010,įeed the fourth digit on the corrected result to get 1 0100,Right now 0001_0100That is, the BCD code of 1110 (decimal 14). This is equivalent to (abc+011)*2+d, ie abc*2 + 6 + d, the part of the red letter is directly ≥ 16, enter one! At this time, the BCD code representing tens is 0001. After the lowest bit d is input, the upper 3 bits that have been added to 3 are shifted to the left bit. Still assume that the input binary number is 4 digits, expressed as abcd,īefore the lowest bit is input, if the abc of the upper 3 bits is ≥ 5 (or abc > 4), add 3 to it (that is, 011). It can be seen that when the binary number is ≥ 5 (or > 4), after the left shift, it will be ≥ 10, the corresponding BCD code needs to represent ones and tensWell, then for a four-digit binary number, when the upper 3 digits entered first are ≥ 5 (or > 4), they must be processed so that after the lowest digit is input, the BCD code representing the tens digit is 0001. If you enter a 4-digit binary number 1110, then the problem arises, The range of BCD code is between 0000~1001, can only represent the decimal number 0~9, and the decimal number corresponding to 1110 is 14! It should be converted to 0001_0100! How can it be converted to 0001_0100?ġ110(Decimal 14, BCD code needs to represent tens and ones) is the result of 111 (decimal 7) shifted to the left by one bit, and its size is equal to twice 111, similarly:ġ100(Decimal 12, BCD code needs to represent tens and ones) is the result of 110 (decimal 6) shifted left by one bit, and its size is equal to twice 110,ġ010(Decimal 10, BCD code needs to represent tens and ones) is the result of 101 (decimal 5) shifted left by one bit, and its size is equal to twice 101,ġ000 (decimal 8, BCD code only needs to represent units) is the result of 100 (decimal 4) shifted left by one bit, and its size is equal to twice 100, If a 3-digit binary number 111 is input, the BCD code is 0111, which corresponds to decimal 7 If a 2-digit binary number 11 is input, the BCD code is 0011, corresponding to decimal 3 Conversion of binary numbers to BCD codesįirst, according to the input of binary numbers with different digits, find the corresponding BCD codeĪssuming that a binary number 1 is input, the corresponding BCD code is 0001, which corresponds to decimal 1 That is, find the corresponding BCD codes for the ones, tens, and hundreds respectively.Ģ. The decimal number 23 can be expressed as 0010_0011, and the decimal number 129 can be expressed as 0001_0010_1001. The problems discussed in this article all take 8421BCD code as an example, and 0~9 in decimal system are represented by 0000~1001 respectively. jpg extension if you click on the "Download Solution" link at the bottom of the solution panel.BCD code (Binary-Coded Decimal), uses four binary digits to store a decimal number, as shown in the table below. You can copy the generated solution by clicking on the "Copy Text" link, appaers under the solution panel.Įven you can download the solution as an image file with. To check the decimal equivalents of other binary numbers you can clear the input box by clicking on the CLEAR button under the input box. You can create your own examples and practice using this property. You can see the result and explanations below the calculator. If you use this property, a random binary number is generated and entered to the calculator, automatically. You can click on the DIE ICON next to the input box. You can enter a binary number to the input box and click on the " CONVERT" button. You can use binary to decimal converter in two ways. Describes the solution step by step and.Computes the decimal equivalent of the entered number,.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |