8-4-2-1BCD code converted to decimal
| ||
result: | |
BCD code uses 4 binary digits to represent a decimal number. The 8421 code is usually used (there are others such as 2421 code and remainder 3 code).
Let's use the 8421 code to explain it here.
Four-digit binary system. Corresponding to the numbers 8, 4, 2, and 1.
For example: 1010, then the corresponding number is 8 0 2 1, which together equals 11.
For example: 0101, then the corresponding number is 0 4 0 1, which adds up to 5.
Same reason
The code 2421 corresponds to the four numbers 2, 4, 2, and 1.
The remainder 3 digits are 8421, but after using them, you need to subtract 3.