Select Page

You’ve probably heard that computers only understand zeros and ones. So how does a computer go from zeros and ones to colorful graphical interfaces with buttons and web browsers?

This is part one of two episodes that explain this. This episode is focused on a computer’s memory and how that is composed of bits and bytes. It also covers the binary number system by comparing binary with our normal decimal number system. Some of the number system topics are a bit tedious to explain in just words so here are several place values written for you.

In the tables below, the column headings show how the place value for each column is calculated. You’re probably very familiar with the place value system that you learned in grade school but you might not have realized that there is a pattern. This is not just some set of values that you had to memorize.

Each column header shows the base raised to a power. That’s what the superscript shows – raising a number to a power. All this really means is that a number (the base) is multiplied by itself a certain number of times (the power). So for example, 103 means 10 times 10 times 10.

The column that needs the most explanation¬†is the one on the right. This is the ones. And this column will always be the ones in any number system. That’s because any number raised to the power of zero is always one.

Base 10 place values (Decimal)

107 106 105 104 103 102 101 100
10,000,000 1,000,000 100,000 10,000 1,000 100 10 1

Base 2 place values (Binary)

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1

Counting in Base 10 and Base 2

Decimal Binary
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111

Listen to the full episode or read the full transcript below.

Transcript

Computers have many components and we’re going to focus on just two of those, the memory and the microprocessor. We’re also going to simplify things quite a bit. There’s a lot to cover so this topic will be split between 2 podcasts. This podcast will explain the memory.

Let’s start with the memory and give our computer 1000 bytes of RAM and 1000 bytes of ROM. I’m going to warn you that we’ll need cover just a little math here but not too much. You need to understand the concept of a byte in order to understand the range of values that a byte can hold. I’ll explain what a byte is in just a moment. The math is nothing complicated and is really just a different way of counting.

RAM stands for random access memory and that means that we can go directly to any specific byte in memory and either read its current value or write a new value. Each byte of memory will have a unique address sort of like a house that has a mailing address that is different from the other houses. The only difference is that you never have to worry about a mail carrier mixing up the addresses. Each address is sequential. One right after the other and the starting address is determined by how the computer is built. The memory will remember whatever value was last written to it until the computer loses power. But what if we haven’t written anything to a particular address? In that case, it will contain a random value.

ROM stands for read only memory and while we can also go directly to any specific address and read its value, we cannot normally change the value. But ROM has one very important difference because it will remember its values even when there is no power. And I mean no power at all, not even a battery. It’s possible to write values to ROM memory but that’s a special process and not something that our computer will be able to do. This means that the values in ROM will need to be written once when the computer is built and will not need to be changed after that.

So we have 1000 bytes of memory that we can read and write and another 1000 bytes that can we can only read. But what’s a byte?

Here’s where we get into the math.

At the most fundamental level, computers only understand zeros and ones. A bit is a value that can either be 0 or 1. Because there are only two possible values, the computer number system is called binary. Think of a bit like a single digit in our normal number system. Because our number system has ten possible values for each digit from 0 through 9, it’s called decimal.

How does binary compare with decimal? Both binary digits and decimal digits start at 0 and the only difference between them is that a binary digit has a maximum value of 1 while a decimal digit has a maximum value of 9. We can count higher than just 9 in decimal by adding extra digits and the same thing works with binary. Just add more bits. When you put 8 bits together, you get a byte.

The decimal system doesn’t have names for specific numbers of digits like binary. You know now that a single digit in binary is called a bit. And 8 digits is called a byte. By the way, byte is spelled b y t e. not b i t e. Binary also has a name for 16 digits. That’s a word. And for 32 digits. That’s a double word. There’s one more that I always found funny but it’s rarely used anymore and that is for 4 digits. It’s sort of a play on words. What’s halfway between a bit and a byte? It’s called a nibble.

So back to decimal for a moment. It has a place value system where you have your ones, tens, hundreds, and so on. Have you ever wondered why the second place in decimal is the tens? Why not the twelves? That’s because each place value is 10 times the previous value.

It turns out that binary also has a place value system only the places have different values. In binary, you have your ones, twos, fours, eights, and so on. Each of these place values is 2 times the previous value.

Okay that’s fine. But why? Why do we multiply by 10 in decimal? And why do we multiply by 2 in binary? The reason we multiply by 10 in decimal is because 10 is the very next number after the first digit has reached its maximum of 9. And the reason the third place is the hundreds is because 100 is the very next number after both the first and second places have reached their maximum values. In binary, the second place is the twos because 2 is the very next number after the first bit reaches its maximum value of 1. And the third place is the fours because 4 is the very next number after both the first and second bits have each reached their maximum.

We learned about the decimal number system in grade school. And were just taught to memorize that there were place values but nothing really beyond that. At least that’s how it was for me. There’s a pattern here that applies to any number system. And later you’ll learn about another common system that uses 16 values for each digit. We actually start using the alphabet letters a through f because our number system runs out of values at 9.

Okay so let’s get back to the reason for all this and that is so you’ll understand the range of values that can be stored in a byte.

Given a fixed number of decimal digits, let’s say 2, what’s the highest number you can count? 99. Because if we try to count higher, then we need another digit. Remember that adding one more would require the use of the next place value. So if you want to calculate the maximum amount you can count with a given number of digits, then just look at the value of the next place and subtract 1. In this case, how high we can count with 2 digits? We start with the ones and multiply by 10 for each place. That gives us 1 times 10 times 10 which is 100. Now you already know that from grade school. But now you know the pattern. Once you know the third place is 100, subtract 1 to get 99 and that’s how high you can count with 2 digits.

The reason this is important is because computers run into this problem all the time. When we’re counting, we can always add another digit assuming our paper has room. Think of computers as having a small piece of paper that can only hold a small number of bits. A byte is defined as only consisting of 8 bits and for our computer, that will be the most we can work with at any time.

With 8 bits, you can count in binary to a maximum number of 255. That would be all 8 ones. This is where knowing the pattern is important and why I went through all that trouble explaining something that you were probably rolling your eyes or glazing over a bit. That’s another pun by the way. How did we get to a maximum value of 255 for 8 bits. Remember the pattern. Figure out what the value for what the ninth place would be and subtract 1. Again, we always start with the ones. So we have 1 times 2 times 2 times 2 times 2 times 2 times 2 times 2 times 2. That’s 256. And subtracting 1 is how I calculated 255 for the maximum value for 8 bits.

When you buy a modern computer and it says the microprocessor is 32 bits or 64 bits, you know what this means now. These processors are not limited to working with just 8 bits at a time.

Part 2 of Going From Binary To GUIs will talk about the microprocessor and how it will interact with our memory.