Small Streams


Two Bit Counting
September 4, 2011, 9:16 am
Filed under: education, math, research | Tags:

A site called play hookey has some basics on digital adding.

Let’s say you have two binary numbers you want to add together. That’s two inputs. With two binary numbers, zero and one, you get two different sums: 0+0=0; 1+0=1; 0+1=1; and 1+1=0.

1+1=0?

0 is the sum, but you have to create another output, carry. And you have to carry it somewhere. So now you have two more inputs, carry in and carry out.

Check this out:

Let’s start by adding two binary bits. Since each bit has only two possible values, 0 or 1, there are only four possible combinations of inputs. These four possibilities, and the resulting sums, are:

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10

Whoops! That fourth line indicates that we have to account for two output bits when we add two input bits: the sum and a possible carry. Let’s set this up as a truth table with two inputs and two outputs, and see where we can go from there. . .

The Carry output is a simple AND function, and the Sum is an Exclusive-OR. Thus, we can use two gates to add these two bits together. The resulting circuit is shown below.

A B CARRY SUM
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0

I like demonstrating this with pennies. Penny down=0; penny up=1. When carrying, the movements are complex, but not impossible for a hobby level robotic, perhaps not even for a vending machine. Ooh, how about a vending machine that registers your number!

Put two pennies in a slot–11–that’s three in binary. The pennies create a circuit and the sum is written on the screen. A lever pushes the pennies down and the operation is performed.

You then get a fortune cookie printout of the sum.

If anything, it might be a good way of getting rid of those extra pennies.

Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: