BCD碼與10進制的關係
BCD碼是由4bit的二進位組成的,其全名是:二進位碼十進制。
BCD碼的有效數字是:0000 ~ 1001 相對於10進制的 0 ~ 9
Ex: 5D = 0101(BCD)
37D = 0011 0111(BCD)
Ex: 以BCD碼計算 5D + 37D =________(BCD)
| | | 5 | D | = | | | | | | | 0 | 1 | 0 | 1 | (BCD) | | | | | | | | |
| + | 3 | 7 | D | = | | 0 | 0 | 1 | 1 | | 0 | 1 | 1 | 1 | (BCD) | | | | | | | | |
| | 4 | 2 | D | | | 0 | 0 | 1 | 1 | | 1 | 1 | 0 | 0 | ß | BCD碼超過9 | |||||||
| | | | | | + | | | | 1 | + | 0 | 1 | 1 | 0 | | 須加6做修正 | |||||||
| | | | | | | 0 | 1 | 0 | 0 | | 0 | 0 | 1 | 0 | (BCD) | | | | | | | |