How to convert 542 1BCD code and decimal code to each other?

How to convert 542 1BCD code and decimal code to each other? 542 1BCD is also a decimal code, which is very convenient to convert if the decimal numbers are the same. Take every nibble of 542 1BCD as a judgment, so does 0-4, and 5-9 is exactly 00 1 1 minus. One byte of 542 1BCD code is set to 94 [66]. If the upper 4 bytes are greater than 4, subtract 00 1 1 to get101; If the lower 4 bytes are less than or equal to 4, the decimal code of 842 1 is [100 100]. Attachment > Calculator > View > Science Type to open the Science Calculator.

Example 1: binary 10 10 10 to decimal.

Methods: Click binary, enter 10 10 10, and click decimal to get the result of 42.

Two: written calculation, all kinds of decimals are converted into decimals first and then into other decimals. This method can complete the conversion of any system.

★ First of all, how to convert binary into decimal?

A binary number, counting from the last bit, is listed as 0, 1, 2 ... followed by n bits.

Such as 1 10 10, and the numbers from the right are 0101respectively.

0 bit 0

1 bit 1

0 second place

1 third place

1 fourth place

0 in the binary system is not counted, just look at where 1 appears, calculate the n power of 2, and then add it all up, where 1 appears in the third and fourth place of 1.

The final answer is: 1 times 2 1 power+1 times 2 3+1 times 2 4 =26.

Converting octal to decimal is the same principle, except that the n power of 2 is replaced by the n power of 8.

Such as octal 1234 to decimal.

40th place

3 digits 1

Rank second

1 third place

0+65438 of 4* 8+0+2 * 8+1* 8 of 3 * 8 = 2257.

The conversion from hexadecimal to decimal is the same, except that the n power of 8 is replaced by the n power of 16.

Especially the hexadecimal 0 to 16 is marked as 0 123456789ABCDEF, where A= 10 F= 15, and so on.

Such as hexadecimal A5B6 to decimal.

No.6 0

B bit 1

5 second place

fourth

Calculation: the result can be obtained by converting letters into corresponding numbers.

The zeroth power of 6* 16 +65438+B * 16 +5 * 16 +A * 16+4.

The 0th power of 6* 16+1*16 6th power +0+5* 16 2nd power+/kloc-0 *16 4th power =

Let's study how to convert decimal into various decimals.

☆ 12345 binary is 12345 divided by 2.

☆ 12345 is converted into octal 12345 divided by 8.

☆ 12345 is converted into hexadecimal 123456 divided by 16.

When 123 is converted into binary, it is 123 divided by 2 and the remainder is calculated every time.

123/2=6 1 Yu 1

6 1/2=30+0

30/2= 15+0

15/2=7 remainder 1

7/2=3 remainder 1

3/2= 1 remainder 1

The binary sequence of the remainder is 111from bottom to top, and then1in the last step 3/2= 1 is1/kloc-.

When 123 is converted to octal, it means that 123 is divided by 8 and the remainder is calculated every time.

123/8= 15 Yu 3

15/8= 1 Yu 7

Finally, 15/8 means 1 = 1, and the remainder is 173 from bottom to top.

123 is converted into 16, which is 123 divided by 16.

123/ 16=7 remainder 1 1 6 in the basic system,11is represented by B.

Finally, 123/ 16= 1 middle count 1, and the remainder is recorded from bottom to top, which is 7B.

To better illustrate the problem, please change the number to a larger number.

Decimal 12345 is converted to decimal 16.

12345/16 = 771Yu 9

77 1/ 16 =48+3

48/ 16 =3+0

Calculate 3 in the last 48/ 16=3, and the remainder is arranged from bottom to top, and recorded as 3039.

After you understand it from beginning to end, you can complete the transformation of any system.

Decimals are transit stations: all decimals to all decimals! !