Converting Binary number to Hex

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Converting Binary number to Hex

Post by Benj »

to configure bits in registers it is fairly easy to convert between binary and hex.

eg Bx000100011

split the binary value into two sections of 4 bits

0001 and 0011

then imagine that starting from the right and working left for each block of 4 that the first bit is 1 the next bit is 2 then 4 then 8.

0001 and 0011
8421 and 8421

Addup the value of the ones.

If the value is over 9 then 10 is equal to A, 11 is equal to B ... 15 is equal to F

then you have the hex value. 0x 1 3 ... 0x13

A few other examples

Bx01010101
= 0101 0101
= 5 5
=0x55

Bx11101011
= 1110 1011
= 14 11
= E B
= 0xEB

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: Converting Binary number to Hex

Post by chevy6600 »

here is a internet site that does the conversion automaticly for you, you sellect what you want to convert to, then input your data, and it shows the result. I use it all the time....the site also converts all sorts of data that may be of interest in other things.
http://www.easycalculation.com/decimal-converter.php
hope it is of some use . :mrgreen:

Post Reply