How to manage Digital values

Conversion

From decimal to binary

In a binary word, every bit represents a power of two. From the right to the left, each value is multiplied by two as we can see in this table :

To convert a decimal value to a binary word, we need to decompose the value in an sum of power of two.

For example :

180 = 128+32+16+4

The binary word will be : 1 0 1 1 0 1 0 0


From binary to decimal

We have to use the same table with the reverse operation

Sum

In binary counting, the only possible values are 0 and 1.

And so 1 + 1 = 10

When we add 1101 with 0101 the result will be 10010

Serious game

Play with binary thanks CISCO

Click here

Another base : hex

It could be difficult to write or read binary words because many letters are needed for large values.

For this reason, most of the time, another counting base is used : The hex base or hexadecimal.


In Hex code the letters A to F represent the values 10 to 15 as we can see in this table :

Conversion from binary to hex

To convert a binary word to an hexadecimal value, we need to make 4 bit groups from the right to the left.

After this, convert each group in hex value.

Example : (1100)2=8+4=1210=C16

(1101010001111100)2 = (D47C)16

Conversion from Hex to binary

It's quite the same operation. Convert the hex letters in 4bit binary words