Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - BCD code is converted to decimal first, and then to hexadecimal. Why?
BCD code is converted to decimal first, and then to hexadecimal. Why?
Bcd code, also called 842 1 code, expands decimal number into binary in the form of 842 1. As we all know, decimal numbers are composed of ten numbers from 0 to 9, and each of these ten numbers has its own 842 1 code:

0=0000

1=000 1

2=00 10

3=00 1 1

4=0 100

5=0 10 1

6=0 1 10

7=0 1 1 1

8= 1000

9= 100 1

For example:

The code of 842 1 of 32 1 is

three

2

1

00 1 1

00 10

000 1

Reason:

1

1

= 8x 0+4x 0+ 1x 2+ 1x 1

=3

1

0 = 8x 0+4x 0+2x 1+ 1x 0 = 2。

1

=8x0+4x0+2x0+ 1x 1

= 1

Bcd code is a four-bit binary code,

That is, converting decimal numbers into binary numbers,

But it's a little different from ordinary transformation.

Each decimal number 0-9 corresponds to a four-digit binary code, and the corresponding relationship is as follows:

Decimal 0

consistent

Binary 0000

; Decimal 1

Corresponding to binary 000 1

.......

nine

100 1

The next 10 is represented by the above two codes.

10

Expressed as 000 10000.

That is, BCD code generates carry when it meets 100 1, unlike ordinary binary codes, it does not generate carry until11.