Decimal to Binary Conversion

Double Dabble (Repeated Division by 2)

1.  Divide the decimal value by 2 (the number base)

2.  If Remainder = 0

Then write a 0 as LSB (right most digit)

Else write 1 as LSB (right most digit)

3.  If Quotient = 0

Then Jump to Step 7

4.  Divide Quotient by 2

5.  If Remainder = 0

Then write a 0 as the next digit on the left

Else write 1 as the next digit on the left

6.  If Quotient ¹ 0

Then Jump to Step 4

7.  END (Last remainder is MSB)


Decimal to HEX Conversion

Hex Dabble (Repeated Division by 16)

1.  Divide the decimal value by 16 (the number base)

2.  If Remainder = 0

Then write a 0 as LSB (right most digit)

Else write the remainder in HEX as LSB (right most digit)

3.  If Quotient = 0

Then Jump to Step 7

4.  Divide Quotient by 16

5.  If Remainder = 0

Then write a 0 as the next digit on the left

Else write the remainder in HEX as the next digit on the left

6.  If Quotient ¹ 0

Then Jump to Step 4

7.  END (Last remainder is MSB)


BINARY TO DECIMAL CONVERSION

The weighted value for each position is determined as follows (2n):

27 / 26 / 25 / 24 / 23 / 22 / 21 / 20
128 / 64 / 32 / 16 / 8 / 4 / 2 / 1

1. Multiply the Binary value for each position and multiply by its weight

2. Add all values

EXAMPLE 0110 1011B ® Decimal

0 * 128 / 0
1 * 64 / 64
1 * 32 / 32
0 * 16 / 0
1 * 8 / 8
0 * 4 / 4
1 * 2 / 2
1 * 1 / 1
111


HEX TO DECIMAL CONVERSION

The weighted value for each position is determined as follows (16n):

164 / 163 / 162 / 161 / 160
65536 / 4096 / 256 / 16 / 1

1. Multiply the Hex value for each position and multiply by its weight

2. Add all values

EXAMPLE

39F1AH ® Decimal

3 * 65,536 / 196,608
9 * 4096 / 36,864
15 * 256 / 3,840
1 * 16 / 16
10 * 1 / 10
237,338


BINARY TO HEX CONVERSION

Hexadecimal representation of a Binary number is relatively simple. The largest decimal value that can be represented by a HEX value is 15. (0FH = 15) If we examine a binary number, we notice that the maximum value represented by a nibble (1/2 a byte or 4 bits) and this is also 15D.

23 / 22 / 21 / 20
8 / 4 / 2 / 1

To Convert a Binary number to HEX

1. Break the binary number into groups on a 4-bit boundary

2. Write the HEX value represented by the 4-bit sequence

Note The weighted positions are only on a nibble boundary or an 8 4 2 1 weight. We are not converting to decimal.

0101 1100 1010 1111B ® H

0101 / 1100 / 1010 / 1111
5 / C / A / F

Conversion H ® B is the reverse.