差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
binary_to_bcd [2021/01/28 16:40]
gongyusu
binary_to_bcd [2021/01/28 16:41] (当前版本)
gongyusu
行 5: 行 5:
  
 | BCD和十进制数值 | | BCD和十进制数值 |
-|BCD |十进制|+|BCD|十进制|
 |0000|0| |0000|0|
-| 0001 | 1 | +|0001|1| 
-| 0010 | 2 | +|0010| 2 | 
-| 0011 | 3 | +|0011| 3 | 
-| 0100 | 4 | +|0100| 4 | 
-| 0101 | 5 | +|0101| 5 | 
-| 0110 | 6 | +|0110| 6 | 
-| 0111 | 7 | +|0111| 7 | 
-| 1000 | 8 | +|1000| 8 | 
-| 1001 | 9 | +|1001| 9 | 
-| 其它 | 未定义 |+|其它|未定义|
  
 Let's look at 159. The hundreds digit 1 is represented in binary by 0001. The tens digit 5 is represented in binary by 0101. The ones digit 9 is represented in binary by 1001. The entire number 159 in BCD is therefore: 000101011001. However 159 in binary is represented by 10011111. Again we need a way to convert this binary number 10011111 to its BCD equivalent 000101011001. To do this, we will use the Double Dabble algorithm. Let's look at 159. The hundreds digit 1 is represented in binary by 0001. The tens digit 5 is represented in binary by 0101. The ones digit 9 is represented in binary by 1001. The entire number 159 in BCD is therefore: 000101011001. However 159 in binary is represented by 10011111. Again we need a way to convert this binary number 10011111 to its BCD equivalent 000101011001. To do this, we will use the Double Dabble algorithm.