Concept 2 - Binary Numbers
Steve > Projects > Computer > Binary Numbers
Computers work with numbers. Whether counting internet packets on the network, or balancing your checkbook, a computer needs to use numbers. The problem: computer's only know 1's and 0's. The solution: binary numbers.
Say we have three wires, it's easy to decide how to represent zero.
Then for number one we could use 001, but what about two? 011 could work, and then 111 for three. With this scheme, to count above 3 we'd need more wires. But there are a few combinations that we haven't used yet, like 101 or 010.
How do we count in decimal? After we hit 9 (or 009) we start over with 010 then up to 019. So every time we get to the bigest digit, we just increase the digit to the left and start over. So with just three spaces we can count all the way to 999.
A wire holds only 1 (on) and 0 (off), so it can't count up to nine, but we'll use the same idea. When we get to the highest digit (1) we'll just increase the next wire to the left, and start over.
Now we've counted to three, but still haven't even used third wire. As we can see in the following table with three wires we can count from zero to seven.
| decimal | binary |
| 0 | 000 |
| 1 | 001 |
| 2 | 010 |
| 3 | 011 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
And so we have a system to count using only ones and zeros. The following table gives a reference on some more numbers.
| decimal | binary |
| 0 | 0000 0000 |
| 1 | 0000 0001 |
| 2 | 0000 0010 |
| 3 | 0000 0011 |
| 4 | 0000 0100 |
| 5 | 0000 0101 |
| 6 | 0000 0110 |
| 7 | 0000 0111 |
| 8 | 0000 1000 |
| 9 | 0000 1001 |
| 10 | 0000 1010 |
| 11 | 0000 1011 |
| 12 | 0000 1100 |
| 13 | 0000 1101 |
| 14 | 0000 1110 |
| 15 | 0000 1111 |
| 16 | 0001 0000 |
| 17 | 0001 0001 |
| 18 | 0001 0010 |
| 19 | 0001 0011 |
| 20 | 0001 0100 |
| 21 | 0001 0101 |
| 22 | 0001 0110 |
| 23 | 0001 0111 |
| 24 | 0001 1000 |
| 25 | 0001 1001 |
| 26 | 0001 1010 |
| 27 | 0001 1011 |
| 28 | 0001 1100 |
| 29 | 0001 1101 |
| 30 | 0001 1110 |
| 31 | 0001 1111 |
| 32 | 0010 0000 |
| . . . | . . . |
| 254 | 1111 1110 |
| 255 | 1111 1111 |
|