Among these logic gates, we can name the AND, OR, XOR, NOT gates, multiplexers, or demultiplexers. I was looking for an idea rather simple to set up, but calling upon a lot of logic gates. So I thought of creating a binary to digit converter. The purpose is to enter a binary number and get its decimal equivalent.
For those who have trouble with these stories of binary and decimal : we count by using a decimal numeral system, i.e with the power of ten.

For example, in base-10 :
157 = 1*10^2 + 5*10^1 + 7*10^0

In the binary numeral system a base-2 is used,i.e we count with the power of two.
I pick the previous example up again but this time in base-2 :
157 = 1*2^7 + 0*2^6 + 0*2^5 + 1*2^4 + 1*2^3 + 1*2^2 + 0*2^1 + 1*2^0
So in base-2 number system, 157 = 10011101

Here, the idea is to move from a binary code to its equivalent in the decimal numeral system. To simplify the problem, I decided to use only 4 bits. Thus, the values go from 0 to 15. To enter a bit, I use a two-position switch : the first one for 0 and the second one for 1. As a result, I'm gonna use 4 two-position switches : one for every bit. It's easy isn't it ? These bits are named Ai with i from 0 to 3.

Once the binary value has been entered, we need to get its value in decimal, and then to display it. To do it, a seven-segment display will be used. But what's that ?
It's the simplest type of display which may be seen on a clock radio for example. Figures look like this :

liste.PNG

As shown below, the display of a decimal figure results in the simultaneous display of several segments spotted letters from a to g.

abcdefg.PNG

So I just have to write the equations for each segment, i.e I have to indicate all cases where a segment is lit. Here are used the logic functions and gates. Little reminder about them : a NOT gate inverts its input, i.e if the input is 0, the output will be 1, and vice versa. The output of a OR gate will be 1 if at least one of the inputs is 1. And for the AND gate, its output will be equal to 1 in only one case : if all of the inputs are 1. To fix the ideas, we can write the following truth tables :

Logic_Gate.bmp

In what follows, v matches to OR and . to AND. For example, the a segment will be lit for 2, 3, 4, 5, 6, 8 or 9.
Thus, the equation of a will be :
a = 2 v 3 v 4 v 5 v 6 v 8 v 9
In binary :
a = 0010 v 0011 v 0100 v 0101 v 0110 v 1000 v 1001
By using the logic functions :
a = [not(A3).not(A2).A1.not(A0)] v [not(A3).not(A2).A1.A0] v [not(A3).A2.not(A1).not(A0)] v [not(A3).A2.not(A1).A0] v [not(A3).A2.A1.not(A1)] v [A3.not(A2).not(A1).not(A0)] v [A3.not(A2).not(A1).A0]

Similarly for the other segments (subject to errors)::
b =[not(A3).not(A2).not(A1).not(A0)] v [not(A3).not(A2).not(A1).A0] v [not(A3).not(A2).A1.A0] v [not(A3).A2.not(A1).not(A0)] v [not(A3).A2.not(A1).A0] v [not(A3).A2.A1.not(A0)] v [not(A3).(A2).(A1).(A0)] v [A3.not(A2).not(A1).not(A0)] v [A3.not(A2).not(A1).A0]

c = [not(A3).not(A2).not(A1).not(A0)] v [not(A3).not(A2).A1.not(A0)] v [not(A3).not(A2).A1.A0] v [not(A3).A2.not(A1).A0] v [not(A3).A2.A1.not(A0)] v [A3.not(A2).not(A1).not(A0)] v [A3.not(A2).not(A1).A0]

d = [not(A3).not(A2).not(A1).not(A0)] v [not(A3).not(A2).A1.not(A0)] v [not(A3).A2.A1.not(A0)] v [A3.not(A2).not(A1).not(A0)]

e = [not(A3).not(A2).not(A1).not(A0)] v [not(A3).A2.not(A1).not(A0)] v [not(A3).A2.not(A1).A0] v [not(A3).A2.A1.not(A0)] v [A3.not(A2).not(A1).not(A0)] v [A3.not(A2).not(A1).A0]

f = [not(A3).not(A2).not(A1).not(A0)] v [not(A3).not(A2).A1.not(A0)] v [not(A3).not(A2).A1.A0] v [not(A3).A2.not(A1).A0] v [not(A3).A2.A1.not(A0)] v [not(A3).A2.A1.A0] v [A3.not(A2).not(A1).not(A0)] v [A3.not(A2).not(A1).A0]

g = [not(A3).not(A2).not(A1).not(A0)] v [not(A3).not(A2).not(A1).A0] v [not(A3).not(A2).A1.not(A0)] v [not(A3).not(A2).A1.A0] v [not(A3).A2.not(A1).not(A0)] v [not(A3).A2.A1.A0] v [A3.not(A2).not(A1).not(A0)] v [A3.not(A2).not(A1).A0]

Il suffit donc de relier tout ceci aux interrupteurs en utilisant des inverseurs NOT pour créer les 0, puis une porte AND pour chaque combinaison binaire. Ces dernières sont ensuite reliées par une porte OR.
Pour donner une petite idée, ci-dessous est présenté le schéma logique pour un segment. So I just have to connect all to the switches by using the NOT gates to get a logic 0, then I use a AND gate for each binary combination. Then they are connected with a OR gate.
To give a small idea, below is shown a logic diagram for a segment

06102011094.jpg

To create my seven-segment display I simply used "Straight Neon" correctly arranged. However there was a problem : all bits couldn't be changed simultaneously for a new binary value. That's why I added a AND gate connected to a pressure switch. Therefore, only a pressure provoked by a Sackboy on the switch will light the seven-segment display. The system is actually pretty massive and a little messy. You really have to organize to get it right in the cables. Overall, it looks like this:

06102011093.jpg

Of course, it may be improve. First of all, when the binary input exceed 9, the sevan-segment display is blank. Six logic gates should be added to transcribe and display in hexadecimal the values : A, B, C, D, E and F would respectively match to 10, 11, 12, 13, 14 and 15. I should also create a second seven-segment display for the 1 of the number from 10 to 15. Maybe I will change these details.
I also think to create an adder using these logic gates, but it takes time !
Any proposal or comment are welcome!
If you want to try this level, just look for my PSN ID, Eldrox, or the name of my level: Digits To Binary Converter.

But without delaying more, here's a video :

On Youtube :

On Dailymotion :


Binary to Digits Converter - Little Big Planet 2 par Eldroth