This is the first article of a series where I go over my process of designing a digital clock. This article will be specifically for going over some basics of binary, as a basic understanding of it will be needed later on. I don’t plan on going too in-depth. I just want to do enough for readers to follow along when I start throwing 1’s and 0’s around later down the line.
What is Binary?
Outside of it just being a bunch of 1’s and 0’s, what the heck is binary? First, ask yourself how the decimal system works. In the decimal system that we are all familiar with, you have ten symbols to work with: 0 1 2 3 4 5 6 7 8 9 . What happens when we want to count to a number that goes beyond 9 if we only have those symbols? We move one position to the left, increment the number in that position, and start over (From 09 to 10).
Binary works the exact same way! The only difference is you only have two symbols instead of ten. (Fun Fact: “Bi-” is a prefix that means “2” and dec- is a prefix that means ten!)
How do you count in binary?
It’s super easy once you get the hang of it. Like I mentioned before, it works a lot like the decimal system. We start with “0”, then “1”. After “1”, we run out of symbols, so we move to the left one position, increment, and start over. So following that gives us “10”, which translates to 3 in the decimal system. I’ll provide a chart below showing how to count to 16 in decimal and binary.
How to Convert Binary Numbers to Decimal
What if someone gives you a big long binary number like 1001110010 and asks you to translate it to decimal? How would you go about that? Well, there’s a neat trick we can use using the power of mathematics.
The equation is d = 2^x where x is the position of the bit in the binary number starting from 0 on the far right, and d is that number converted to decimal. This equation converts one bit of a binary number into decimal!
So for a binary number like 1000, we can easily plug this into our equation: d=2^3 which simplifies to 2*2*2 = 8
For a number like 1101, we’ll need to use the equation for each “1” bit in the number and add our answers together:
d = (2^3) + (2^2) + (2^0) = 13
Why Is Binary So Useful with Computer Systems?
Binary has two symbols. “0” represents the “off” state, while “1” represents an “on” state. So you can easily simulate this using power. Either there is electricity going into a node or there is not. (Fun Fact: You can do a lot of really fun binary projects in the video game Minecraft using Redstone.) A computer can’t use the decimal system without converting it into binary because there aren’t ten different electrical signals a node can receive. Again, it either gets power or does not get power.
You’ll often hear the terms 64-bit, 32-bit, 16 bit, and 8 bit when discussing computer systems. This just refers to how many digits a binary number has to work with. For reference, we can convert our 64 bit to decimal by doing d=2^64. This number equals 18,446,744,073,709,551,616. So yeah, our computers can count pretty dang high! What a computer does with these numbers is up to the processor, which may be a topic for another day.
What Am I Skipping in this Article?
Again, I’m only going over some basics that we’ll need later on in my design. ANYTHING you can do in the decimal system, you can also do using the binary system. Multiplication, division, addition, subtraction, etc. These are more complex and technical topics that I don’t need in my design, so I’ll be skipping how to do that. I’m also skipping how ASCII works since it won’t be relevant to my project.
Next Time: Truth TablesLike (1)