![]() 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. ![]() ![]() ![]() BCD code (Binary-Coded Decimal), uses four binary digits to store a decimal number, as shown in the table below. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |