Go Down

Topic: can you read or write 8 bits at once? (Read 2071 times) previous topic - next topic

Tom Carpenter

#15
Jan 01, 2013, 09:41 pm Last Edit: Jan 01, 2013, 09:43 pm by Tom Carpenter Reason: 1
I agree, once you get used to hex there is little need for binary.

For those that don't know, here is a little tip for Binary to hex conversion:

Take a binary number (works for any number of bits, but lets choose 13 to demonstrate):
Code: [Select]
0b1101101101010

Split it into groups of four bits starting from right to left
Code: [Select]
   1   1011   0110   1010

If there arent a multiple of four bits, then pad with zeros until there are (now you see why I chose 13)
Code: [Select]
0001   1011   0110   1010

Now convert each group into decimal [base 10] (you can skip this step when you get used to it)
Code: [Select]
 1      11      6     10

Now convert each group into hex [base 16]
Code: [Select]
 1       B      6     A

Finally, stick it back together, and you have your hexadecimal number:
Code: [Select]
0x1B6A
~Tom~

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy