For BCD numbers that add up to an invalid BCD number or generate a carry the number 6 (0110) is added to the invalid number, why ?
These binary numbers are not allowed in the BCD code: 1010, 1011, 1100, 1101, 1110, 1111
These binary numbers are not allowed in the BCD code: 1010, 1011, 1100, 1101, 1110, 1111
Then, if the addition produces a carry and/or creates an invalid BCD number, an adjustment is required to correct the sum. The correction method is to add 6 to the sum in any digit position that has caused an error.The correction method is to add 6 to the sum in any digit position that has caused an error.
For example,
15 + 9 = 24
0001 0101 = 15
+ 0000 1001 = 9
____________________
0001 1110 = 1? (invalid 1110)
0001 1110 = 1? (invalid)
+ 0000 0110 = 6 (adjustment)
___________________
0010 0100 = 24
0 comments
Post a Comment