8-4-2-1bcd code converted to decimal


result:

the bcd code uses 4 binary digits to represent a decimal number. usually 8421 codes are used (there are others such as 2421 codes and remainder 3 codes).

let’s use code 8421 to explain it here.

four binary digits. corresponding to the four numbers 8, 4, 2, and 1 respectively.

for example: 1010, then the corresponding number is 8 0 2 1, which together is eleven.

for example: 0101, then the corresponding number is 0 4 0 1, which together is five.

the same reason

the 2421 code corresponds to the four numbers 2, 4, 2, and 1

do you use 8421 for the remaining 3 codes, but you need to subtract 3 after using them up?