Here, for a second time, I present a glimpse into one of the facets of my academic life. As an Embedded Systems major, I am taking three decently hard but fun classes this semester: Digital Logic, Digital Signal Processing, and Operating Systems. Since Digital logic is currently my favorite of the three, I am going to show you what one of my recent labs was.
The assignment was to build a circuit that would display the digits of my phone number - simple, right? Not so much. The way it would display them would be by taking as input the numerical position of the digit, in binary, and using a simple seven-segment display (like one digit of your digital watch) to show the number. This is how the input works:
Input Output
0000 => 2
0001 => 0
0010 => 7
0011 => -
0100 => 7
0101 => 5
0110 => 1
0111 => -
1000 => 1
1001 => 0
1010 => 7
1011 => 4
1100 => X
1101 => X
1110 => X
1111 => X
The last four places didn't need to be anything in specific, which made the logic easier to design than otherwise. I won't go into boolean algebra or Karnaugh maps, but suffice it to say, it takes a bit of manipulating to get those numbers to come out.
A little about gates:
Gates are the basic unit of any circuit. They are like dendrites in your brain (i think) - they actually manipulate the ones and zeros running around inside the computer. There are 6 different types of gates: NOT, AND, OR, NAND, NOR, and XOR. I was able to simplify my circuit down to using only two types of gates: NANDs and NOTs.
A NOT gate is the most simple of the gates. it takes a bit (a one or a zero) and "flips" it. If it was a one, it makes it a zero, and vice versa.
The truth table for a NOT gate looks like this:
Input
|
Output
|
0
|
1
|
1
|
0
|
A NAND gate is slightly more complicated. It takes two or more inputs, and if they all are '1' then it returns a '0', otherwise, it returns a '1'.
The truth table for a two-input NAND gate looks like this:
Input 1
|
Input 2
|
Output
|
0
|
0
|
1
|
0
|
1
|
1
|
1
|
0
|
1
|
1
|
1
|
0
|
Now, before I actually physically built the circuit, I first simulated it in a program that allows you to test your design for errors. This is what the circuit looks like in symbolic representation:
The five dots on the left are the inputs (four binary digits and one that is always '1', for certain reasons). The green symbols are the gates. The triangle with the little circle in front of it is a NOT gate, and the one that looks like a D with a circle in front of it is a NAND gate. You can see the 7-segment display on the right. All the lines are wires that I have to connect.
Now, here are some pictures of the finished circuit. Ivan and I worked on putting this together for about 2 hours or so.
The input switches - we used the first four.
When the switch is down, it inputs a zero,
and when it is up, it inputs a one.
The black things you see in the above picture are chips, each of which contain anywhere from 2 to 6 gates, depending on what type of gate is on the chip. We used NOTs (6 per chip), 2-input NANDs ( 4 per chip) and 4-input NANDs (2 per chip).
Here is a video of me switching through the numbers:
Well, hopefully this didn't bore you too much, I know at least Ivan and probably Joel would like it, maybe more. I had a lot of fun doing this project, and just wanted to share it with you! :)
Have a happy Sabbath, everyone!