home |
avr microcontroller & DIY electronics |
toolbox |
science club |
tuxtalk |
photos |
e-cards |
Online-Shop
no preservatives added blog |
computer and graphics corner |
herbal treasure chest |
splash into math |
stardust |
periodic table
binary numbers
28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
It's easy to convert from binary to decimal:
101 = 1*20+ 0*21+1*22= 1 +0+4=5
011 = 1*20+ 1*21+0*22= 1 + 2 =3
101010 = 0*20+ 1*21+0*22+1*23+ 0*24+1*25= 2+8+32=42
To convert decimal numbers into binaries is a bit more tricky:
Let's start with 12:
12 = 2 * 6 + 0
6 = 2 * 3 + 0
3 = 2 * 1 + 1
1 = 2 * 0 + 1
(to find the right numbers, divide 12 by 2, take the result, 6 in this case and again divide by 2 until you have reached 1)
Now you take the remainder starting at the bottom and you have the binary number.
12 = 1100.
Another example:
42 : 2 = 21 + 0
21 : 2 = 10 + 1
10 : 2 = 5 + 0
5 : 2 = 2 + 1
2 : 2 = 1 + 0
1 : 2 = 0 + 1
So as we have already seen above 42 = 101010.
And one more example:
123 : 2 = 61 + 1
61 : 2 = 30 + 1
30 : 2 = 15 + 0
15 : 2 = 7 + 1
7 : 2 = 3 + 1
3 : 2 = 1 + 1
1 : 2 = 0 + 1
That means 123 = 1111011.
references
https://www.rapidtables.com/convert/number/binary-to-decimal.html
Copyright © 2004-2024 Katja Socher, tuxgraphics.org