Difference between revisions of "Digital Logic"

From EG1004 Lab Manual
Jump to: navigation, search
(46 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<h2>1 OBJECTIVES</h2>
= NI ELVIS Tutorial Video =
General Engineering has created a video that discusses breadboard wiring and digital logic circuits: [https://stream.nyu.edu/media/EG+1003+Lab+5A+NI+ELVIS+Tutorial/1_36717xpx NI ELVIS Tutorial Video]. This video provides information on the educational NI-ELVIS II + prototyping board that will aid in designing and wiring the physical circuit. <span style="color: red;"> '''Material covered in the video will be on the Lab 8 quiz. Viewing the video is a mandatory pre-lab assignment. ''' </span>


<p>The experimental objective of this lab is to design a
= Objectives =
combinational logic circuit that will
The experimental objective of this lab is to design a combinational logic circuit that will activate under specific conditions and test it using LabVIEW. After testing, it will be built on an NI-ELVIS II+ prototyping board.
activate under specific conditions and test it using LabVIEW. After testing, it
will be built on the digital trainer.</p>


<p>Your goal is to become familiar with the
= Overview =
principles of digital logic and digital logic circuits. Understanding how logic gates work is critical
The first step in understanding the digital circuits that control the function of electronic devices is the mastery of Boolean logic. George Boole, an English mathematician, established modern symbolic logic in 1854 with the publication of his paper, "Laws of Thought." Boolean logic is the foundation of digital circuitry. Boole's method of logical inference allows conclusions to be drawn from any proposition involving any number of terms. Boolean logic demonstrates that the conclusions found are logically contained in the original premises.<ref name="one">''Boole, George'', Encyclopedia Britannica, 2003. Encyclopedia Britannica Online. Retrieved July 29<sup>th</sup>, 2003 ''[http://www.britannica.com/eb/article?eu=82823 http://www.britannica.com/eb/article?eu=82823]''</ref>
to this process.</p>


<h2>2 OVERVIEW</h2>
In Boolean logic, there are only two values, true and false, represented by the numbers 1 and 0, respectively. These values are combined in equations to yield results that also have these two values. The equations are represented by truth tables that show the inputs to the equation and the outputs produced for those inputs. The rows of the table contain all the possible combinations of 1s and 0s for the inputs. The number of rows is determined by the number of possible combinations.


<p>The first step in understanding the digital circuits that
Boolean logic is applied to digital circuitry through the use of simple logic gates. There are symbols for each of these gates, and the connections between them are represented by lines running from the output of one gate to the input of the other. A line can connect only one output to each input. There are seven of these gates: the NOT, AND, OR, NAND, NOR, XOR, and XNOR gates. Only the first three will be used in this lab.
control the function of elec­tronic devices is the mastery of <b><i>Boolean </i></b>logic.
George Boole<b><i>, </i></b>an English mathemati­cian, established modern
symbolic logic in 1854 with the publication of his paper, <b><i>&quot;Laws of
Thought.&quot; </i></b>Now called <b><i>Boolean algebra, </i></b>it is the
foundation of digital circuitry. Boole's method of logical inference enables us
to draw conclusions from any proposition
involving any number of terms. Boolean logic demonstrates that our con­clusions
are logically contained in our original premises<sub>.</sub><sup>1</sup></p>


<p>In Boolean logic, there are only two values, <b><i>true</i></b>
The NOT gate is the simplest of these three. It is an inverter. It has one input and produces its opposite as output. The symbol for a NOT gate is shown in Figure 1.
and <b><i>false</i></b>, represented by the numbers 1 and 0, respectively.
These values are combined in equations to yield results that also have these
two values. The equations are represented by <b><i>truth tables</i></b> that
show the inputs to the equation and the outputs produced for those inputs. The
rows of the table con­tain all the possible combinations of 1s and 0s for the
inputs. The number of rows is determined by
the number of possible combinations.</p>


<p>Boolean logic is applied to digital circuitry through the use
[[Image:lab_logic_1.jpg|frame|center| Figure 1: NOT gate symbol.]]
of simple logic gates. There are symbols for each of these types of gates, and
the connections between them are represented by lines running from the output
of one gate to the input of the other. A line can connect only one output to
each input. There are seven of these gates: the <b><i>NOT, AND, OR, NAND,
NOR, XOR, </i></b>and <b><i>XNOR </i></b>gates. We will limit our discussion to
the first three.</p>


<p>The <b><i>NOT </i></b>gate is the simplest of these three. It
is an inverter. It takes one only input and produces its opposite as output. Its
symbol looks like this:</p>


<p>[[Image:lab_logic_1.jpg]]</p>
The truth table for a NOT gate has one input, or A in this example, and one output. The symbol for the operation is a horizontal bar over the variable. The truth table for a NOT gate is shown in Table 1.


<p>The truth table for a NOT gate has one input, which we'll call
{| class="truthtable"
A, and one output. The symbol for the operation is a horizontal bar over the
variable, so the truth table looks like this:</p>
 
{| style="text-align: center; border-collapse: collapse;"
|-
|-
!style="border-bottom: 1px solid black; vertical-align: bottom;"|<math>A\,</math>
!<math>A\,</math>!!<math>\overline{A}\,</math>
!style="border-bottom: 1px solid black; border-left: 3px double black;"|<math>\overline{A}\,</math>
|-
|-
|0
|0||1
|style="border-left: 3px double black;"|1
|-
|-
|1
|1||0
|style="border-left: 3px double black;"|0
|-
|-
|}
|}


<p>The <b><i>AND
The AND gate performs a multiplication operation on its inputs. If all the inputs are true, the output is also true. But if either of the inputs is false, the output is also false. An AND gate can have two or more inputs, but for this lab, it will have two inputs. The symbol for an AND gate is shown in Figure 2.
</i></b>gate performs an <b><i>and</i></b><b><i> </i></b>operation on its inputs.
Like English, if all the inputs are true, then the output is also true.
However, if either of the inputs is false, then the output is also false. An
AND gate can have two or more inputs, but for this lab, we'll only use two
inputs. The symbol for an AND gate looks like this:</p>


<p>[[Image:lab_logic_4.jpg]]</p>
[[Image:lab_logic_4.jpg|frame|center| Figure 2: AND gate symbol.]]


<p>This gate has two inputs, which we'll call A and B, and one
This gate has two inputs, or A and B in this example, and one output. The symbol for the AND operation is a dot (·) or the two inputs one after the other with nothing between them. The truth table for an AND gate is shown in Table 2.
output. The symbol for the AND operation is a dot(·) or just has the two inputs one after the other
with nothing between them. The truth table looks like this:</p>


{| style="text-align: center; border-collapse: collapse;"
{| class="truthtable"
|-
|-
!style="border-bottom: 1px solid black;"|<math>A\,</math>
!<math>A\,</math>!!<math>B\,</math>!!<math>AB\,</math>
!style="border-bottom: 1px solid black; border-left: 1px solid black;"|<math>B\,</math>
!style="border-bottom: 1px solid black; border-left: 3px double black;"|<math>AB\,</math>
|-
|-
|0
|0||0||0
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|0
|-
|-
|0
|0||1||0
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|0
|-
|-
|1
|1||0||0
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|0
|-
|-
|1
|1||1||1
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|1
|-
|-
|}
|}


An OR gate performs an addition operation on its inputs. If either of the inputs is true, the output is also true. But if all the inputs are false, the output is also false. An OR gate can have two or more inputs, but for this lab, it will have two inputs. The symbol for an OR gate is shown in Figure 3.


<p>Finally, the <b><i>OR </i></b>gate performs an <b><i>or</i></b> operation on its inputs.
[[Image:lab_logic_7.jpg|frame|center| Figure 3: OR gate symbol.]]
Like English, if either of the inputs is true, then the output is also true.
However, if ALL the inputs are false, the output is also false. An OR gate can
have two or more inputs, but for this lab, we'll only use two inputs. The
symbol for an OR gate looks like this:</p>
 
<p>[[Image:lab_logic_7.jpg]]</p>


<p>This gate has two inputs, which we'll call A and B, and one
An OR gate has two inputs, or A and B in this example, and one output. The symbol for the OR operation is a plus (+). The truth table for an OR gate is shown in Table 3.
output. The symbol for the OR operation is a plus(+).
The truth table looks like this:</p>


{| style="text-align: center; border-collapse: collapse;"
{| class="truthtable"
|-
|-
!style="border-bottom: 1px solid black;"|<math>A\,</math>
!<math>A\,</math>!!<math>B\,</math>!!<math>A+B\,</math>
!style="border-bottom: 1px solid black; border-left: 1px solid black;"|<math>B\,</math>
!style="border-bottom: 1px solid black; border-left: 3px double black;"|<math>A+B\,</math>
|-
|-
|0
|0||0||0
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|0
|-
|-
|0
|0||1||1
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|1
|-
|-
|1
|1||0||1
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|1
|-
|-
|1
|1||1||1
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|1
|-
|-
|}
|}


<p>The truth table attached to each of these gates indicates
The truth table attached to each of these gates indicates when the gate will return a value of true. These tables are used to write a Boolean equation for a problem. All the combinations that yield an output of 1 are kept, and the equation is written. This is called a Sum of Products solution.
the circumstances under which the gate will return a value of <b><i>true. </i></b>We'll
use these tables to write a <b><i>Boolean equation </i></b>for our problem. All
the combina­tions that yield an output of 1 are kept, and the equation is
written. This is called a <b><i>Sum of Products</i></b> solution.</p>
 
<p>Note: If we use zeroes instead of ones, we'll get a Product of Sums solution, which is
beyond the scope of this description.</p>


<p>We can make a Boolean equation that is a solution to a problem
A truth table showing every possible combination of inputs and their corresponding outputs yields a Boolean equation that is the solution to a problem in digital logic. This equation can be simplified using a Karnaugh map (K-map). A K-map identifies and eliminates all the conditions that do not contribute to the solution. This simplified equation is used to build the digital circuit and will be a combination of the gates described above.
in digital logic by forming a truth table of our own, where we show every
possible combination of inputs and what their corresponding outputs should be. Once
that is accomplished, we will simplify our equation using a Karnaugh
Map (K-Map). This tool is used to devise a simplified Boolean equation which
identi­fies and removes all the conditions
that do not contribute to the solution. This final equation is the one
used to build the digital circuit, and will be a combination of the gates
described above.</p>


<p>A K-Map is a two dimensional representation of the truth table that allows us
A K-map is a two-dimensional representation of the truth table that shows the common characteristics of the inputs. For an equation with three inputs, usually all the combinations of the first two inputs are shown as four columns and the values for the third input are shown as two rows. For four inputs, all the combinations of the third and fourth inputs are shown as four rows. Only one value can change at a time in adjacent rows or columns. For example, in the truth table in Table 4, A, B, and C are the inputs and D is the output.
to see common characteristics of the inputs, and allows us to simplify the digital
logic which would implement the truth table. For an equation with three inputs, we
usually show the all the combinations of first two inputs as four columns, and the third
input values as two rows. For four inputs, we would show all the combinations of the
third and fourth inputs as four rows. Only one value can change at a time in adjacent
rows or columns. For example, consider the following truth table, where A, B, and C
are the inputs and O is the output:</p>


{| style="text-align: center; border-collapse: collapse;"
{| class="truthtable"
|-
|-
!style="border-bottom: 1px solid black;"|<math>A\,</math>
!<math>A\,</math>!!<math>B\,</math>!!<math>C\,</math>!!<math>D\,</math>
!style="border-bottom: 1px solid black; border-left: 1px solid black;"|<math>B\,</math>
!style="border-bottom: 1px solid black; border-left: 1px solid black;"|<math>C\,</math>
!style="border-bottom: 1px solid black; border-left: 3px double black;"|<math>O\,</math>
|-
|-
|0
|0||0||0||0
|style="border-left: 1px solid black;"|0
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|0
|-
|-
|0
|0||0||1||1
|style="border-left: 1px solid black;"|0
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|1
|-
|-
|0
|0||1||0||0
|style="border-left: 1px solid black;"|1
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|0
|-
|-
|0
|0||1||1||1
|style="border-left: 1px solid black;"|1
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|1
|-
|-
|1
|1||0||0||0
|style="border-left: 1px solid black;"|0
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|0
|-
|-
|1
|1||0||1||1
|style="border-left: 1px solid black;"|0
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|1
|-
|-
|1
|1||1||0||1
|style="border-left: 1px solid black;"|1
|style="border-left: 1px solid black;"|0
|style="border-left: 3px double black;"|1
|-
|-
|1
|1||1||1||1
|style="border-left: 1px solid black;"|1
|style="border-left: 1px solid black;"|1
|style="border-left: 3px double black;"|1
|-
|-
|}
|}


<p>This table looks complex, but it can be simplified. We'll make the K-Map for this
This table looks complex, but it can be simplified with a K-map (Table 5).
truth table:</p>


{| style="text-align: center; border-collapse: collapse;"
{| class="kmap"
|-
!!!!!0 0!!0 1!!1 1!!1 0
|-
!!!!!<math>\overline{A} \, \overline{B}\,</math>!!<math>\overline{A} B</math>!!<math>A B\,</math>!!<math>A \overline{B}</math>
|-
!0!!<math>\overline{C}\,</math>
|0||0||1||0
|-
|-
!
!1!!<math>C\,</math>
!style="border-right: 1px solid black;"|
|1||1||1||1
!style="border-right: 1px solid black;"|0 0
!style="border-right: 1px solid black;"|0 1
!style="border-right: 1px solid black;"|1 1
!style="border-right: 1px solid black;"|1 0
|- style="border-bottom: 1px solid black;"
|
|style="border-right: 1px solid black;"|
|style="border-right: 1px solid black;"|<math>\overline{A} \overline{B}\,</math>
|style="border-right: 1px solid black;"|<math>\overline{A} B</math>
|style="border-right: 1px solid black; vertical-align: bottom;"|<math>AB\,</math>
|style="border-right: 1px solid black;"|<math>A \overline{B}</math>
|- style="border-bottom: 1px solid black;"
!0
|style="border-right: 1px solid black;"|<math>\overline{C}\,</math>
|style="border-right: 1px solid black;"|0
|style="border-right: 1px solid black;"|0
|style="border-right: 1px solid black;"|1
|style="border-right: 1px solid black;"|0
|- style="border-bottom: 1px solid black;"
!1
|style="border-right: 1px solid black;"|<math>C\,</math>
|style="border-right: 1px solid black;"|1
|style="border-right: 1px solid black;"|1
|style="border-right: 1px solid black;"|1
|style="border-right: 1px solid black;"|1
|-
|-
|}
|}


<p>Next, we'll look for cells that have things in common. For example, the entire bottom row has ones in all its cells.
Look for the cells that have values in common. For example, the entire bottom row has ones in all its cells. This means that any time C is true, the output is true. This can be done in a more organized manner. Look for cells that form rectangles, where the number of cells in the rectangle is a power of 2: 1, 2, 4, or 8 and so on. The bottom row is an example of this. There is another small rectangle of two cells in the column with 1 1 at the top. This means that the output is true whenever A and B are true. The rectangles are allowed to overlap so the same cells can be used more than once, which happened here. Look for the biggest rectangles first, and keep finding smaller rectangles until all the cells with a 1 in them are used. This means that sometimes just single cells will remain at the end. In this example, all the cells containing a 1 were covered with two rectangles. This means is that if the conditions for either rectangle are true, the output will be true. Looking at the row and column labels, the bottom row is C, and for the column, the header is AB. This yields the simplified Boolean equation shown in Figure 4.
This means that any time <b>C</b> is true, the output is true. We can do this in a more organized manner. Look for cells that
form rectangles, where the number of cells in the rectangle is a power of 2: 1, 2, 4, 8, etc. The bottom row is an example of
this. If you look further, you'll see another small rectangle of 2 cells in the column with <b>1 1</b> at the top. What this
means is that the ouput is true whenever <b>A</b> and <b>B</b> are true. The rectangles are allowed to overlap, so you might
use the same cells more than once, which happened here. You should look for the biggest rectangles first, and keep finding
smaller retangles until all the cells with a <b>1</b> in them are used. This means that sometimes just single cells will
remain at the end. In this case we were lucky because we could cover all the cells containing a a with just these two
rectangles.</p>


<p>What this means is that if the conditions for either rectangle are true, the output will be true. Looking at the row and
<math>D = AB + C\,</math>
column labels, the bottom row is <b>C</b>, and for the colum, the header is <b>AB</b>. This leads to the simplified Boolean
equation:</p>


<p>AB+C</p>
Figure 4: Simplified Boolean Equation


<p>This equation meets the conditions in the truth table, and achieves the desired result with the minimum number of logic
This equation meets the conditions in the truth table and achieves the desired result with the minimum number of logic elements.
elements.</p>


<h2>3 YOUR ASSIGNMENT</h2>
= Materials and Equipment =
* A 7432 IC (4 dual-input OR gates)
* A 7408 IC (4 dual-input AND gates)
* A 7404 IC (6 single-input NOT gates)
* A lab PC with LabVIEW software
* An NI-ELVIS II+ with prototyping board
* Wiring


<h3>Individual Lab Report</h3>
= Sample Problem =
An ATM has three options: print a statement, withdraw money, or deposit money. The ATM will charge a $1 fee to:
# Withdraw money
# Print a statement without depositing money


<p>Follow the lab report guidelines laid out in the page called
== Truth Table ==
[[Specifications for Writing Your Lab Reports]] in the <i>Technical Communication</i>
The inputs are the ATM's three functions. Let variable P stand for printing a statement, W for withdrawing money, and D for depositing money. There is one output, which is whether or not the ATM session has a cost. The output is C. The truth table in Table 6 shows the combinations of the inputs and their corresponding outputs.
section of this manual. As you write, the following discussion points should be
{| class="truthtable"
addressed in the appropriate section of your lab report:</p>
|+ style="caption-side: bottom;" | Table 6: Truth table.
|-
!colspan="3"|Inputs!!Output
|-
!P!!W!!D!!C
|-
|0||0||0||0
|-
|0||0||1||0
|-
|0||1||0||1
|-
|0||1||1||1
|-
|1||0||0||1
|-
|1||0||1||0
|-
|1||1||0||1
|-
|1||1||1||1
|-
|}


<ul>
In Table 6, a 1=true and 0=false.
<li>Describe the problem you are solving in your introduction.</li>


<li>Describe how <b><i>AND, OR, </i></b>and <b><i>NOT </i></b>gates work.</li>
The inputs are P=print, W=withdraw, D=deposit. The output is 0=false (do not charge) or 1=true (charge $1.00).


<li>What is a truth table? How does it contribute to obtaining a Boolean equation?</li>
== Boolean Equation ==
The combinations that yield an output of 1 are kept. For each of these combinations, determine the input values and multiply those variables together. If an input is true, it can be used as is; for an input that is false, invert it using the horizontal bar NOT operation. Since the output is true if any of the combinations are true, the equation is formed by using addition operations on all the terms formed by the product of each combination. The Boolean equation in Figure 5 is created.


<li>What is a K-map? How does it to contribute to obtaining a simplified Boolean equation?
<math>C = \overline{P} W \overline{D} + \overline{P} W D + P \overline{W}\,\overline{D} + P W \overline{D} + P W D\,</math>
To demonstrate the simplification, show what the equation would look like if you used wrote
terms for each of the true values, and the simplified equation by applying the K-Map. Discuss
how much simpler the circuitry would be by applying K-Maps.</li>


<li>Describe how a digital logic circuit is built using these tools.</li>
Figure 5: Boolean Equation


<li>Was the experiment a success? If failure, why?</li>
== Karnaugh Map ==
A table like the one in Table 7 that maps out all the possible combinations is drawn. Only one variable can change at a time between adjacent columns. For this example, the columns will change from 00 to 01 to 11 to 10, as shown in Table 7. A TA will explain this further. The cells that are true are grouped in rectangles of two, four, or eight cells. This shows the values that these cells have in common. These common values yield the simplified Boolean equation. The K-map in Table 7 corresponds to the Boolean equation created.


<li>Compare the problem before and after it was simplified</li>
Compare this K-map in Table 7 with the equation to see why some cells are ''1'' and the others are ''0''.


<li>Why is there a need for the minimization of a logic design and what are the advantages?</li>
{| class="kmap"
 
|+ style="caption-side: bottom;" | Table 7: K-map.
<li>How does the use of a combinational logic circuit contribute to advances in technology?</li>
|-
 
!!!!!0 0!!0 1!!1 1!!1 0
<li>Describe the design changes that would be necessary if one of the barns used a bell as
|-
an alarm and the other used a horn.</li>
!!!!!<math>\overline{P} \, \overline{W}\,</math>!!<math>\overline{P} W</math>!!<math>P W\,</math>!!<math>P \overline{W}</math>
</ul>
|-
 
!0!!<math>\overline{D}\,</math>
<h3>Team PowerPoint Presentation</h3>
|0||1||1||1
 
|-
<p>Follow the presentation guidelines laid out in the page called
!1!!<math>D\,</math>
[[EG1003 Lab Presentation Format]] in the <i>Introduction to Technical Presentations</i>
|0||1||1||0
section of this manual. When you are preparing your presentation, consider the following
|-
points:</p>
|}
 
<ul>
<li>How does digital logic impact the world today?</li>
<li>If you can look into the future, how will digital logic change the world?</li>
</ul>
 
<h2>4 MATERIALS AND EQUIPMENT</h2>
<ul>
<li>7432 IC (4 dual-input OR gates)</li>
 
<li>7408 IC (4 dual-input AND gates)</li>
 
<li>7404 IC (6 single input NOT gates)</li>
 
<li>Lab PC with LabVIEW Software</li>
 
<li>Digital Logic Trainer</li>
 
<li>Appropriate Wiring</li>
</ul>
 
<p><i><b>Remember:</b> You are required to take notes. Experimental details are
easily forgotten unless written down. EG Standard Note Paper can be downloaded
and printed from the [https://eg.poly.edu/downloads/Note_Paper.zip the EG Web site].
Use your lab notes to write the Procedure section of your lab report. At the end of
each lab your TA will scan your lab notes and upload them to the [https://eg.poly.edu/documents.php Lab Documents] section of the EG Website. You must attach your lab notes at the end of your lab report (use the
"Insert Object" command in MS Word after your Conclusion). Keeping careful notes
is an essential component of all scientific practice.</i></p>
 
<h2>5 SAMPLE PROBLEM</h2>
 
<h3>Problem Statement</h3>
 
<p>An ATM has three options: to print a statement, withdraw money,
or deposit money. The ATM will charge you $1 if you:</p>
 
<ol type="a">
<li>Want to withdraw money,</li>
<li>Want to print a statement without withdrawing money</li>
</ol>
 
<ol>
<li><b>Truth Table: </b>The inputs
here are what you can do with the ATM. Let a variable P stand for printing a
statement, W for withdrawing money, and D for depositing money. There is one
output, which is whether or not the ATM session has a cost. Call the output C.
We'll now take all the combinations of the inputs and show the corresponding
outputs:</li>
<table cellspacing=0 align=center>
<tr>
<td colspan=3 style="border-right:solid windowtext 1.0pt;border-bottom:solid windowtext 1.0pt"><b>Inputs</b></td>
<td style="border-bottom:solid windowtext 1.0pt"><b>Output</b></td>
</tr>
 
<tr>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><b>P</b></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><b>W</b></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><b>D</b></td>
<td style="border-bottom:solid windowtext 1.0pt"><b>C</b></td>
</tr>
<tr>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td>0</td>
</tr>
<tr>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td>0</td>
</tr>
<tr>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td>1</td>
</tr>
<tr>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td>1</td>
</tr>
<tr>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td>1</td>
</tr>
 
<tr>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td>0</td>
</tr>
<tr>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">0</td>
<td>1</td>
</tr>
<tr>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td style="border-right:solid windowtext 1.0pt">1</td>
<td>1</td>
</tr>
</table>
 
<p class=caption>Figure 1: Truth table</p>
 
<p>In the above table 1=true (on), 0=false
(off)</p>
 
<p><b>Inputs: </b>P=print, W=withdraw, D=deposit</p>
 
<p><b>Output: </b>0=false (do not charge), 1=true (charge $1.00)</p>
 
<li><b>Boolean Equation</b> The
combinations that yield an output of <b><i>1</i></b> are kept. Our approach
will be, for each output of <b><i>1</i></b>, to determine the input values and
to AND those variables together. If an input is true, it can be used as is. For
an input that is false, we'll invert it using the horizontal bar NOT operation
we defined above. Since the output is true if any of the input condition
combinations are true, we'll form the result by using an OR operation on all
the terms formed by the AND operations. The following Boolean equation
is created:</li>
 
<p>[[Image:lab_logic_10.gif]]</p>
 
<p>You should compare this equation with the truth table to make sure you understand how this works.</p>
 
<li><b>Karnaugh Map (K-Map):</b> Begin by drawing a table like the one below that
maps out all the possible combina­tions. When deciding where to place
each of the letters, keep in mind that <b>you can only change one variable at a time between adjacent
columns</b>. For this example, the columns will chage from 00, to 01, to 11, to 10, as shown in
Figure 2. Your TA will explain this further. The cells that are true are
grouped in boxes of 2, 4, or 8 cells. This allows us to see what these cells
have in common, and use that for the
simplified Boolean equation. The K-Map in Figure 2 corresponds to the
Boolean equation we just created.</li>
 
<p>You should compare this K-Map with the equation to see why some cells are <i>1</i> and the others are <i>0</i>.</p>
 
<table cellspacing=0 align=center>
<tr>
<td style="border-bottom:solid windowtext 1.0pt"><p class=caption>&nbsp;</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p class=caption>&nbsp;</p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>W</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>W</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>W</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>W</b></p></td>
</tr>
<tr>
<td style="border-bottom:solid windowtext 1.0pt;border-left:solid windowtext 1.0pt"><p><b>&nbsp;&nbsp;&nbsp;<br>0</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p><b><u>&nbsp;&nbsp;&nbsp;</u><br>D</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>0</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>1</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>1</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>1</p></td>
</tr>
<tr>
<td style="border-bottom:solid windowtext 1.0pt;border-left:solid windowtext 1.0pt"><p><b>&nbsp;&nbsp;&nbsp;<br>1</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p><b>&nbsp;&nbsp;&nbsp;<br>D</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>0</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>1</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>1</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p align=center>0</p></td>
</tr>
</table>
 
<p class=caption>Figure 2: K-Map</p>
 
<li><b>Simplified Boolean Equation:</b> Next, we try to form the biggest
boxes we can of 2, 4, and 8 cells. In the middle of Figure 3, you can see a
box of four cells (2 rows by 2 columns), plus an overlapping box of two cells
(1 row by 2 columns).</li>
 
<table cellspacing=0 align=center>
<tr>
<td style="border-bottom:solid windowtext 1.0pt"><p class=caption>&nbsp;</p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p class=caption>&nbsp;</p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>W</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>W</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>W</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt"><p align=center><b>1<br>&nbsp;&nbsp;<br>P</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p align=center><b>0<br><u>&nbsp;&nbsp;</u><br>W</b></p></td>
</tr>
<tr>
<td style="border-bottom:solid windowtext 1.0pt;border-left:solid windowtext 1.0pt"><p><b>&nbsp;&nbsp;&nbsp;<br>0</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p><b><u>&nbsp;&nbsp;&nbsp;</u><br>D</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2><p class=entry>0</p></td>
<td style="border-top:solid windowtext 2.0pt;border-bottom:solid windowtext 1.0pt;border-left:solid windowtext 2.0pt;border-right:solid windowtext 1.0pt" colspan=2>
<p class=entry>1</p>
  </td>
 
<td style="border-top:solid windowtext 2.0pt;border-bottom:solid windowtext 3.0pt;border-left:solid windowtext 2.0pt;border-right:solid windowtext 3.0pt" colspan=2>
<p class=entry>1</p>
  </td>
<td style="border-top:solid windowtext 2.0pt;border-bottom:solid windowtext 3.0pt;border-right:solid windowtext 3.0pt" colspan=2>
<p class=entry>1</p>
  </td>
</tr>
<tr>
<td style="border-bottom:solid windowtext 1.0pt;border-left:solid windowtext 1.0pt"><p><b>&nbsp;&nbsp;&nbsp;<br>1</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt"><p><b>&nbsp;&nbsp;&nbsp;<br>D</b></p></td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2>
<p class=entry>0</p>
  </td>
<td style="border-bottom:solid windowtext 3.0pt;border-left:solid windowtext 2.0pt;border-right:solid windowtext 1.0pt" colspan=2>
<p class=entry>1</p>
  </td>
<td style="border-bottom:solid windowtext 3.0pt;border-right:solid windowtext 3.0pt" colspan=2>
<p class=entry>1</p>
 
  </td>
<td style="border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt" colspan=2>
<p align=center>0</p>
  </td>
</tr>
</table>
 
<p class=caption><b>Figure 3: K-Map with boxes</b></p>
 
<p><b>Note:</b> Always try to group the greatest number of neighbors in powers of 2.</p>
 
<p>To create a simplified Boolean equation, you must first group all
the combinations together and eliminate those that contain both values of a
variable. For example, for the big box in the middle, W is
always true, but the box includes both the true and false values of P and D.
This means that if W is true, the values of P and D don't matter since all
their combinations are included. Similarly, for the small box, if P is true and
D is false, the value of W doesn't matter since both its true and false values
are included in the box. Putting this together, if W is true, or P is true and
D is false, the output should be true, and this covers all the input conditions
required to make a true output. We can now write this as a simplified Boolean
equation:</p>
 
<p>[[Image:lab_logic_14.gif]]</p>
 
<p>As you can see, this equation is much simpler than the equation we started with, but is fully equivalent to it.</p>
<li><b>Combinational Logic Circuit:</b> We can now
construct a logic circuit from the simplified equation. Looking at the
equation, we can see that if we perform a NOT operation on D, and do an AND
operation on the result and P, we get the second term in the equation. Then, if
we take this result and do an OR operation with W, we get the overall result.</li>


<p>This is shown in Figure 4.</p>
== Simplified Boolean Equation ==
Form the largest rectangles of two, four, and eight cells. There is a rectangle of four cells (2 rows by 2 columns) plus an overlapping rectangle of two cells (1 row by 2 columns), as shown in Table 8.


[[Image:lab_logic_16.gif|frame|center|Figure 4: Combinational Logic Circuit for Simplified Equation]]
[[Image:Kmap_Boxes.gif|thumb|250px|frame|left|Table 8: K-map with boxes]]
</ol>


== <h2>6 PROCEDURE</h2> ==


<h3>Problem Statement</h3>


<p>Farmer Georgi owns a 350-acre dairy farm in upstate New York.
In addition to milk and butter, Farmer Georgi sells fresh eggs at the Union
Square Greenmarket in Manhattan. It is imperative that Farmer Georgi protects
the hen that lays his golden eggs.</p>


<p>He has two barns, one hen, and a supply of corn. A fox has been attempting to eat the hen
by hiding in a barn. The hen can move freely from one barn to the other.
Farmer Georgi sometimes stores corn in one barn, and sometimes in the other,
but he never stores it in both at the same time. The hen would like the corn;
the fox would like to eat the hen. Farmer Georgi has hired you to design an
alarm system that uses digital logic circuits to protect the hen and the corn.
Your design should use the fewest gates and input variables possible. The alarm
will sound if:</p>


<ol type="a">
<li>The fox and the hen are in the same barn, or</li>
<li>The hen and the corn are in the same barn.</li>
</ol>


<h3>Finding a Solution</h3>


<p><b>Note:</b> The two barns must be assigned a numeric equivalent before you prepare your
truth table for Step 1. For example, use <b><i>1</i> </b>for Barn 1 and <b><i>0</i></b> for Barn 2. For
the alarm output, use <b><i>0</i></b> to indicate the alarm should be
off, and <b><i>1</i></b> to indicate that the alarm should be on.</p>


<ol>
<li>On a sheet of lined lab note paper from the [https://eg.poly.edu/downloads/Note_paper.zip EG Web site],
create a truth table that
includes three inputs and one output. Assign the input variables. Make sure you
include all possible scenarios for the hen, the corn, and the fox.</li>


<li>Compute the output column. To do this, analyze the three inputs and determine whether
the alarm would sound in each scenario. Place a <b><i>1 </i></b>in the output
column if the alarm will sound and a <b><i>0 </i></b>if it will not.</li>


<li>Note all the combinations that produce a <b><i>1 </i></b>in the output column.</li>


<li>Create a Boolean equation from this table that includes each of the inputs that
produced a positive output.</li>


<li>Create a <b><i>K-Map. </i></b>Draw a map that lists all the possible combinations. Use
the Boolean equation to fill in the <b><i>1's</i></b> on the K-Map.</li>


<li>Circle the pairs of <b><i>1's. </i></b>The <b><i>1's </i></b>may only be circled in
Always try to group the greatest number of common values in powers of 2.
powers of 2 starting with the largest possible combination and working down to
the smallest. The unfavorable outcomes are discarded.</li>


<li>This process yields the <b><i>simplified Boolean equation. </i></b>Write this
To create a simplified Boolean equation, group all the combinations together and eliminate those that contain both values of a variable. For example, in the big rectangle in the middle, W is always true, but the rectangle also includes both the true and false values of P and D. This means that if W is true, the values of P and D do not matter since all their combinations are included. Similarly, for the small rectangle, if P is true and D is false, the value of W does not matter since both its true and false values are included in the rectangle. Putting this together, if W is true, or P is true and D is false, the output should be true, and this includes all the input conditions required to produce a true output. A simplified Boolean equation for this problem is shown in Figure 6.
simplified equation down.</li>


<li>Draw a schematic diagram of your simplified Boolean equation.</li>
<math>C = W + P\overline{D}\,</math>


<li>Have your TA <b>sign </b>your work.</li>
Figure 6: Simplified Boolean equation


<li>After you have created your
This equation in Figure 6 is much simpler than the original equation, but is fully equivalent to it.
circuit, it must be tested. Build the circuit in LabVIEW. Make sure you use
your simplified Boolean equation. Open LabVIEW and select New VI. Pull down the Window menu, select Tile Left and
Right.</li>


<li>Place three switches on the front
== Combinational Logic Circuit ==
panel that represent the hen, the corn, and the fox. Place one Boolean
Construct a combinational logic circuit using the simplified equation. If a NOT operation is performed on D, and an AND operation is performed on the result then P, the second term in the equation, is found. This result combined with performing an OR operation with W produces the result.
indicator to represent the output.</li>


<li>Open the Functions palette. Select Boolean and choose the AND, NOT, and
This is shown in Figure 7.
OR gates necessary for your circuit. Your TA will assist you in this process.</li>


<li>Once you have completed your
[[Image:lab_logic_16.gif|frame|center|Figure 7: Combinational logic circuit diagram for the simplified equation.]]
LabVIEW program, have your TA <b>check </b>your work.</li>


<li>Now we will build the circuit on the <b><i>Digital Logic Trainer</i></b>.</li>
= Problem Statement =
A farmer owns a 350-acre dairy farm in upstate New York. In addition to milk and butter, the farmer sells fresh eggs at the Union Square Greenmarket in Manhattan. It is imperative that the farmer protect the hen that lays his eggs.


<p><b><font color=#ff0000>Warning:</font></b><i> Don't plug in the
He has two barns, one hen, and a supply of corn. A fox has been attempting to eat the hen by hiding in a barn. The hen can move freely from one barn to the other. Farmer Georgi sometimes stores corn in one barn and sometimes in the other, but he never stores it in both at the same time. The hen would like to eat the corn and the fox would like to eat the hen. Farmer Georgi needs an alarm system that uses digital logic circuits to protect the hen and the corn. The design should use the fewest gates and input variables possible. The alarm will sound if:
Digital Logic Trainer until instructed to do so.</i></p>


<li>On the trainer, identify each of
# The fox and the hen are in the same barn
the three black chips as an <b><i>AND, OR, </i></b>or <b><i>NOT </i></b>gate.
# The hen and the corn are in the same barn
To do this, read the number on the chip itself and match it with the list in
the <b><i>Materials and Equipment </i></b>section of this lab. Use the pinouts
in Figure 5 to wire your gates. You can tell that you are using the proper end
of the chip by looking for the notch at one end, and match it to diagrams in
Figure 5.</li>


[[Image:lab_logic_17.jpg|frame|center|Figure 5: IC Pinouts]]
= Procedure =


<li>Before we begin, we must connect
<span style="color: red;">'''''Prior to Beginning the Procedure'''''</span>
our gates to a power supply and ground them. Insert one end of a wire into the
small breadboard that is above the larger breadboard on the logic trainer.
Insert the wire into the hole on the small breadboard marked <b><i>5V. </i></b>Insert
the other end of the wire into the hole on the breadboard nearest pin <b><i>14 </i></b>on
the gate. Repeat this process for all three gates.</li>


[[Image:lab_logic_20.gif|frame|center|Figure 6: Breadboard Layout]]
Before performing the lab, the integrated circuits (IC) used must be tested to determine if they are functioning. If the procedure is completed without verifying that the ICs work, problems may occur in the circuit that require additional time and troubleshooting. The system for checking the ICs uses an Arduino to send and receive signals from the AND/OR/NOT chips and determines if they are functioning properly.


<p>The Breadboard is set up in the following manner:</p>
First, load the chip onto the IC tester (Figure 8) and start the Serial Monitor on the Arduino program. The code will cycle through the basic inputs (0, 1 for NOT; 00, 01, 10, 11 for AND/OR) and then send the outputs of each gate within the chip back into the Arduino. The code compares those results to the expected result. It displays each input/output pair and displays the final result showing if the chip is functional or defective. The goal is to determine if the gates are outputting the correct results. '''''Remove the chip carefully from the IC tester.'''''


<ol type="a">
[[Image:IC_Tester.JPG|thumb|500px|center| Figure 8: IC Tester.]]
<li>The top two and bottom two rows of slots are connected horizontally; however there
is a break in the middle separating the rows, as shown above.</li>
<li>The rest of the breadboard is connected vertically.</li>
</ol>


<p><b><font color=#ff0000>Warning:</font></b><i> There
'''''Problem Statement Procedure'''''
are different breadboards available in the Lab, some only having one top </i><i>and bottom row. If you
have any problems, ask your Lab TA for help.</i></p>


<li>Ground the circuit using the same method. Insert one end of a wire into the hole
Note: The two barns must be assigned a numeric equivalent before the truth table is prepared for Step 1. Use 1 for Barn 1 and 0 for Barn 2. For the alarm output, use 0 to indicate the alarm should be off, and 1 to indicate that the alarm should be on.
marked <b><i>ground </i></b>on the small breadboard, and the other end into pin
# On a sheet of lined lab note paper from the [http://eg.poly.edu/downloads/Note_paper.zip EG Website], create a truth table that includes three inputs and one output. Assign the input variables. Include all possible scenarios for the hen, the corn, and the fox.
<b><i>7 </i></b>of the logic gate. Repeat this process for all three gates.</li>
# Compute the output column. To do this, analyze the three inputs and determine if the alarm will sound in each scenario. Place a 1 in the output column if the alarm will sound and a 0 if it will not.
# Note all the combinations that produce a 1 in the output column.
# Create a Boolean equation from this table that includes each of the inputs that produced a true output.
# Create a K-map. Draw a map that lists all the possible combinations. Use the Boolean equation to fill in the 1s on the K-map.
# Circle the pairs of 1s. The 1s may only be circled in powers of 2 starting with the largest possible combination and working down to the smallest. The outcomes that do not contribute to the solution are discarded.
# This process yields a simplified Boolean equation. Write this simplified equation down.
# Draw a schematic diagram of the simplified Boolean equation.
# Have a TA sign the diagram.
# Test the circuit diagram. Build the circuit in LabVIEW. Use the simplified Boolean equation. Open LabVIEW and select New VI. Pull down the Window menu, select Tile Left and Right.
# Place three switches on the front panel that represent the hen, the corn, and the fox. Place one Boolean indicator on the front panel to represent the output.
# Open the Functions palette. Under Programming, select Boolean and choose the AND, NOT, and OR gates necessary for the circuit. A TA will assist in this process.
# Once the LabVIEW program is complete, have a TA check the circuit.
# Build the circuit on a prototyping board.
# On the board, identify each of the three black chips as an AND, OR, or NOT gate. To do this, read the number on the chip and match it with the list in the [[#Materials and Equipment|Materials and Equipment]] section of this lab. Use the pinouts in Figure 9 to wire the gates. Look for the notch at one end of each chip to orient the chip to diagrams in Figure 9 to match the pinouts.
#: [[Image:lab_logic_17.jpg|frame|center|Figure 9: IC Pinouts.]]
# Power the chips. Insert one end of the wire into a hole on Row 54 (marked +5V) of the side breadboards. Insert the other end of the wire into the hole on the breadboard nearest Pin 14 on the chip. Repeat this process for all three chips.
#: [[Image:lab_logic_20.gif|frame|center|Figure 10: Breadboard layout. Wiring diagram, left. Photograph, right.]]
#: The breadboard is set up in the following manner:
#:# The leftmost and rightmost columns of slots (the ones in between the red and blue lines) are connected vertically.
#:# The rest of the breadboard is connected horizontally, however, there is a break that runs down the center of the breadboard, separating Columns A-E and F-J, as shown in Figure 10.
# Ground the chips using the same method. Insert one end of a wire into a hole on Row 53 (marked Ground) of the small breadboards and the other end into Pin 7 of the chip. Repeat this process for all three chips.
# Look at the top right corner of the breadboard to find the Digital Input/Output (DIO) holes.  Select one of the DIO row of holes to use as one of the variables and begin wiring the circuit based on the simplified Boolean equation. Assign the other DIO rows for the remaining variables.
# Continue this process until the entire circuit is wired. Insert one end of the wire into the final output of the simplified Boolean equation. Attach the other end to any hole marked LED on the board.
# Plug in the NI-ELVIS II+ and connect the USB cable to the lab PC.
# Power on the NI-ELVIS II+ by toggling the switch on the back of the device. When the pop-up window appears, select NI-ELVISmx Instrument Launcher and click OK (Figure 11).
#: [[Image:lab_logic_21.png|frame|center|Figure 11: New data acquisition device dialog window.]]
# Click on the DigOut Icon on the Instrument Launcher window (Figure 12).
#: [[Image:lab_logic_22.png|frame|center|Figure 12: NI ELVISmx Instrument Launcher dialog window.]]
#[[Image:lab_logic_23.png|thumb|200px|right|Figure 13: Digital Writer dialog window.]]Select the appropriate range for the ''Lines to Write'' setting in the Digital Writer dialog window that corresponds to the DIO rows chosen. For example, if fox, hen, and corn are on DIO 21, DIO 22, and DIO 23, select 16&ndash;23.
# Click ''Run'' and toggle the switches corresponding to fox, hen, and corn.<br clear="both"/>
# Have a TA check the circuit.


<li>Select one of the three variables and begin to wire this circuit based on your
The lab work is now complete. Please clean up the workstation. Return all unused materials to a TA. Refer to '''''[[#Assignment|Assignment]]''''' for the instructions to prepare the lab report.
simplified Boolean equation. Insert a wire into the one of the first three
switches on the small breadboard. Insert the other end of the wire into the
first input on the appropriate gate.</li>


<li>Continue this process until you have wired the entire circuit. Insert one end of the
= Assignment =
wire into the final output of your simplified Boolean equation. Attach the
other end to a <b><i>Logic Indicator</i></b>.</li>


<li>Have your TA <b>check </b>your circuit.</li>
== Team Lab Report ==
<b>Note:</b> You will be writing a team lab report rather than an individual one. See the [[Team Authoring Strategies]] page in the <i>Technical Communication</i> of this online manual for guidance of how to do this.


<li>With your TA's permission, plug in the trainer and turn it on. Using your original
Follow the lab report guidelines laid out in the page called [[Specifications for Writing Your Lab Reports]] in the ''Technical Communication'' section of this manual. The following points should be addressed in the appropriate section of the lab report:
truth table, throw each switch in combination with the other switches to
* Describe the problem that was solved in the Introduction
simulate all the scenarios. Make sure the alarm (represented by the LEDs) sounds when it is supposed to.</li>
* Describe how AND, OR, and NOT gates work
* What is a truth table? How does it contribute to obtaining a Boolean equation?
* What is a K-map? How does it contribute to obtaining a simplified Boolean equation? To demonstrate the simplification, show what the equation would look like if terms were written for each of the true values and the simplified equation by applying the K-map. Discuss how much simpler the circuitry is as a result of applying the K-map
* Describe how to construct a digital logic circuit using Boolean equations and K-maps
* Explain why the alarm system did or did not work
* Why is there a need for the minimization of a logic design and what are the advantages?
* How does the use of a combinational logic circuit contribute to advances in technology?
* Discuss other possible design/procedural improvements
* Describe how the final combinational logic circuit was obtained
* Insert a screenshot of the front and back panels in the report; include a picture of the NI ELVIS wiring, truth table/unsimplified boolean equation and k-map/simplified eqn


<li>Unplug the Digital Logic Trainer. Take apart your circuit <b>leaving </b>the chips on
{{Lab notes}}
the breadboard. Return the wires to the kit.</li>
</ol>


<p>Your lab work is now complete. Please
== Team PowerPoint Presentation ==
clean up your workstation. Return all unused materials to your TA. Refer to section <b><i>3 Your
Follow the presentation guidelines laid out in the page called [[EG1003 Lab Presentation Format]] in the ''Introduction to Technical Presentations'' section of this manual. When preparing the presentation, consider the following points:
Assignment </i></b>for the instructions you need to prepare your lab report.</p>
* How does digital logic impact the world today?
* Look into the future, how will digital logic change the world?


<h2>Footnotes</h2>
= Footnotes =
{{Reflist}}


<p><sup>1</sup> <i>Boole</i><i>, George, </i>Encyclopedia Britannica, 2003. Encyclopedia Britannica Online.
{{Laboratory Experiments}}
Retrieved July 29<sup>th</sup>, 2003 <i>http://www.britannica.com/eb/article?eu=82823</i></p>
[[Main_Page | Return to Table of Contents]]

Revision as of 17:02, 26 January 2020

NI ELVIS Tutorial Video

General Engineering has created a video that discusses breadboard wiring and digital logic circuits: NI ELVIS Tutorial Video. This video provides information on the educational NI-ELVIS II + prototyping board that will aid in designing and wiring the physical circuit. Material covered in the video will be on the Lab 8 quiz. Viewing the video is a mandatory pre-lab assignment.

Objectives

The experimental objective of this lab is to design a combinational logic circuit that will activate under specific conditions and test it using LabVIEW. After testing, it will be built on an NI-ELVIS II+ prototyping board.

Overview

The first step in understanding the digital circuits that control the function of electronic devices is the mastery of Boolean logic. George Boole, an English mathematician, established modern symbolic logic in 1854 with the publication of his paper, "Laws of Thought." Boolean logic is the foundation of digital circuitry. Boole's method of logical inference allows conclusions to be drawn from any proposition involving any number of terms. Boolean logic demonstrates that the conclusions found are logically contained in the original premises.[1]

In Boolean logic, there are only two values, true and false, represented by the numbers 1 and 0, respectively. These values are combined in equations to yield results that also have these two values. The equations are represented by truth tables that show the inputs to the equation and the outputs produced for those inputs. The rows of the table contain all the possible combinations of 1s and 0s for the inputs. The number of rows is determined by the number of possible combinations.

Boolean logic is applied to digital circuitry through the use of simple logic gates. There are symbols for each of these gates, and the connections between them are represented by lines running from the output of one gate to the input of the other. A line can connect only one output to each input. There are seven of these gates: the NOT, AND, OR, NAND, NOR, XOR, and XNOR gates. Only the first three will be used in this lab.

The NOT gate is the simplest of these three. It is an inverter. It has one input and produces its opposite as output. The symbol for a NOT gate is shown in Figure 1.

Figure 1: NOT gate symbol.


The truth table for a NOT gate has one input, or A in this example, and one output. The symbol for the operation is a horizontal bar over the variable. The truth table for a NOT gate is shown in Table 1.

0 1
1 0

The AND gate performs a multiplication operation on its inputs. If all the inputs are true, the output is also true. But if either of the inputs is false, the output is also false. An AND gate can have two or more inputs, but for this lab, it will have two inputs. The symbol for an AND gate is shown in Figure 2.

Figure 2: AND gate symbol.

This gate has two inputs, or A and B in this example, and one output. The symbol for the AND operation is a dot (·) or the two inputs one after the other with nothing between them. The truth table for an AND gate is shown in Table 2.

0 0 0
0 1 0
1 0 0
1 1 1

An OR gate performs an addition operation on its inputs. If either of the inputs is true, the output is also true. But if all the inputs are false, the output is also false. An OR gate can have two or more inputs, but for this lab, it will have two inputs. The symbol for an OR gate is shown in Figure 3.

Figure 3: OR gate symbol.

An OR gate has two inputs, or A and B in this example, and one output. The symbol for the OR operation is a plus (+). The truth table for an OR gate is shown in Table 3.

0 0 0
0 1 1
1 0 1
1 1 1

The truth table attached to each of these gates indicates when the gate will return a value of true. These tables are used to write a Boolean equation for a problem. All the combinations that yield an output of 1 are kept, and the equation is written. This is called a Sum of Products solution.

A truth table showing every possible combination of inputs and their corresponding outputs yields a Boolean equation that is the solution to a problem in digital logic. This equation can be simplified using a Karnaugh map (K-map). A K-map identifies and eliminates all the conditions that do not contribute to the solution. This simplified equation is used to build the digital circuit and will be a combination of the gates described above.

A K-map is a two-dimensional representation of the truth table that shows the common characteristics of the inputs. For an equation with three inputs, usually all the combinations of the first two inputs are shown as four columns and the values for the third input are shown as two rows. For four inputs, all the combinations of the third and fourth inputs are shown as four rows. Only one value can change at a time in adjacent rows or columns. For example, in the truth table in Table 4, A, B, and C are the inputs and D is the output.

0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1

This table looks complex, but it can be simplified with a K-map (Table 5).

0 0 0 1 1 1 1 0
0 0 0 1 0
1 1 1 1 1

Look for the cells that have values in common. For example, the entire bottom row has ones in all its cells. This means that any time C is true, the output is true. This can be done in a more organized manner. Look for cells that form rectangles, where the number of cells in the rectangle is a power of 2: 1, 2, 4, or 8 and so on. The bottom row is an example of this. There is another small rectangle of two cells in the column with 1 1 at the top. This means that the output is true whenever A and B are true. The rectangles are allowed to overlap so the same cells can be used more than once, which happened here. Look for the biggest rectangles first, and keep finding smaller rectangles until all the cells with a 1 in them are used. This means that sometimes just single cells will remain at the end. In this example, all the cells containing a 1 were covered with two rectangles. This means is that if the conditions for either rectangle are true, the output will be true. Looking at the row and column labels, the bottom row is C, and for the column, the header is AB. This yields the simplified Boolean equation shown in Figure 4.

Figure 4: Simplified Boolean Equation

This equation meets the conditions in the truth table and achieves the desired result with the minimum number of logic elements.

Materials and Equipment

  • A 7432 IC (4 dual-input OR gates)
  • A 7408 IC (4 dual-input AND gates)
  • A 7404 IC (6 single-input NOT gates)
  • A lab PC with LabVIEW software
  • An NI-ELVIS II+ with prototyping board
  • Wiring

Sample Problem

An ATM has three options: print a statement, withdraw money, or deposit money. The ATM will charge a $1 fee to:

  1. Withdraw money
  2. Print a statement without depositing money

Truth Table

The inputs are the ATM's three functions. Let variable P stand for printing a statement, W for withdrawing money, and D for depositing money. There is one output, which is whether or not the ATM session has a cost. The output is C. The truth table in Table 6 shows the combinations of the inputs and their corresponding outputs.

Table 6: Truth table.
Inputs Output
P W D C
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1

In Table 6, a 1=true and 0=false.

The inputs are P=print, W=withdraw, D=deposit. The output is 0=false (do not charge) or 1=true (charge $1.00).

Boolean Equation

The combinations that yield an output of 1 are kept. For each of these combinations, determine the input values and multiply those variables together. If an input is true, it can be used as is; for an input that is false, invert it using the horizontal bar NOT operation. Since the output is true if any of the combinations are true, the equation is formed by using addition operations on all the terms formed by the product of each combination. The Boolean equation in Figure 5 is created.

Figure 5: Boolean Equation

Karnaugh Map

A table like the one in Table 7 that maps out all the possible combinations is drawn. Only one variable can change at a time between adjacent columns. For this example, the columns will change from 00 to 01 to 11 to 10, as shown in Table 7. A TA will explain this further. The cells that are true are grouped in rectangles of two, four, or eight cells. This shows the values that these cells have in common. These common values yield the simplified Boolean equation. The K-map in Table 7 corresponds to the Boolean equation created.

Compare this K-map in Table 7 with the equation to see why some cells are 1 and the others are 0.

Table 7: K-map.
0 0 0 1 1 1 1 0
0 0 1 1 1
1 0 1 1 0

Simplified Boolean Equation

Form the largest rectangles of two, four, and eight cells. There is a rectangle of four cells (2 rows by 2 columns) plus an overlapping rectangle of two cells (1 row by 2 columns), as shown in Table 8.

Table 8: K-map with boxes







Always try to group the greatest number of common values in powers of 2.

To create a simplified Boolean equation, group all the combinations together and eliminate those that contain both values of a variable. For example, in the big rectangle in the middle, W is always true, but the rectangle also includes both the true and false values of P and D. This means that if W is true, the values of P and D do not matter since all their combinations are included. Similarly, for the small rectangle, if P is true and D is false, the value of W does not matter since both its true and false values are included in the rectangle. Putting this together, if W is true, or P is true and D is false, the output should be true, and this includes all the input conditions required to produce a true output. A simplified Boolean equation for this problem is shown in Figure 6.

Figure 6: Simplified Boolean equation

This equation in Figure 6 is much simpler than the original equation, but is fully equivalent to it.

Combinational Logic Circuit

Construct a combinational logic circuit using the simplified equation. If a NOT operation is performed on D, and an AND operation is performed on the result then P, the second term in the equation, is found. This result combined with performing an OR operation with W produces the result.

This is shown in Figure 7.

Figure 7: Combinational logic circuit diagram for the simplified equation.

Problem Statement

A farmer owns a 350-acre dairy farm in upstate New York. In addition to milk and butter, the farmer sells fresh eggs at the Union Square Greenmarket in Manhattan. It is imperative that the farmer protect the hen that lays his eggs.

He has two barns, one hen, and a supply of corn. A fox has been attempting to eat the hen by hiding in a barn. The hen can move freely from one barn to the other. Farmer Georgi sometimes stores corn in one barn and sometimes in the other, but he never stores it in both at the same time. The hen would like to eat the corn and the fox would like to eat the hen. Farmer Georgi needs an alarm system that uses digital logic circuits to protect the hen and the corn. The design should use the fewest gates and input variables possible. The alarm will sound if:

  1. The fox and the hen are in the same barn
  2. The hen and the corn are in the same barn

Procedure

Prior to Beginning the Procedure

Before performing the lab, the integrated circuits (IC) used must be tested to determine if they are functioning. If the procedure is completed without verifying that the ICs work, problems may occur in the circuit that require additional time and troubleshooting. The system for checking the ICs uses an Arduino to send and receive signals from the AND/OR/NOT chips and determines if they are functioning properly.

First, load the chip onto the IC tester (Figure 8) and start the Serial Monitor on the Arduino program. The code will cycle through the basic inputs (0, 1 for NOT; 00, 01, 10, 11 for AND/OR) and then send the outputs of each gate within the chip back into the Arduino. The code compares those results to the expected result. It displays each input/output pair and displays the final result showing if the chip is functional or defective. The goal is to determine if the gates are outputting the correct results. Remove the chip carefully from the IC tester.

Figure 8: IC Tester.

Problem Statement Procedure

Note: The two barns must be assigned a numeric equivalent before the truth table is prepared for Step 1. Use 1 for Barn 1 and 0 for Barn 2. For the alarm output, use 0 to indicate the alarm should be off, and 1 to indicate that the alarm should be on.

  1. On a sheet of lined lab note paper from the EG Website, create a truth table that includes three inputs and one output. Assign the input variables. Include all possible scenarios for the hen, the corn, and the fox.
  2. Compute the output column. To do this, analyze the three inputs and determine if the alarm will sound in each scenario. Place a 1 in the output column if the alarm will sound and a 0 if it will not.
  3. Note all the combinations that produce a 1 in the output column.
  4. Create a Boolean equation from this table that includes each of the inputs that produced a true output.
  5. Create a K-map. Draw a map that lists all the possible combinations. Use the Boolean equation to fill in the 1s on the K-map.
  6. Circle the pairs of 1s. The 1s may only be circled in powers of 2 starting with the largest possible combination and working down to the smallest. The outcomes that do not contribute to the solution are discarded.
  7. This process yields a simplified Boolean equation. Write this simplified equation down.
  8. Draw a schematic diagram of the simplified Boolean equation.
  9. Have a TA sign the diagram.
  10. Test the circuit diagram. Build the circuit in LabVIEW. Use the simplified Boolean equation. Open LabVIEW and select New VI. Pull down the Window menu, select Tile Left and Right.
  11. Place three switches on the front panel that represent the hen, the corn, and the fox. Place one Boolean indicator on the front panel to represent the output.
  12. Open the Functions palette. Under Programming, select Boolean and choose the AND, NOT, and OR gates necessary for the circuit. A TA will assist in this process.
  13. Once the LabVIEW program is complete, have a TA check the circuit.
  14. Build the circuit on a prototyping board.
  15. On the board, identify each of the three black chips as an AND, OR, or NOT gate. To do this, read the number on the chip and match it with the list in the Materials and Equipment section of this lab. Use the pinouts in Figure 9 to wire the gates. Look for the notch at one end of each chip to orient the chip to diagrams in Figure 9 to match the pinouts.
    Figure 9: IC Pinouts.
  16. Power the chips. Insert one end of the wire into a hole on Row 54 (marked +5V) of the side breadboards. Insert the other end of the wire into the hole on the breadboard nearest Pin 14 on the chip. Repeat this process for all three chips.
    Figure 10: Breadboard layout. Wiring diagram, left. Photograph, right.
    The breadboard is set up in the following manner:
    1. The leftmost and rightmost columns of slots (the ones in between the red and blue lines) are connected vertically.
    2. The rest of the breadboard is connected horizontally, however, there is a break that runs down the center of the breadboard, separating Columns A-E and F-J, as shown in Figure 10.
  17. Ground the chips using the same method. Insert one end of a wire into a hole on Row 53 (marked Ground) of the small breadboards and the other end into Pin 7 of the chip. Repeat this process for all three chips.
  18. Look at the top right corner of the breadboard to find the Digital Input/Output (DIO) holes. Select one of the DIO row of holes to use as one of the variables and begin wiring the circuit based on the simplified Boolean equation. Assign the other DIO rows for the remaining variables.
  19. Continue this process until the entire circuit is wired. Insert one end of the wire into the final output of the simplified Boolean equation. Attach the other end to any hole marked LED on the board.
  20. Plug in the NI-ELVIS II+ and connect the USB cable to the lab PC.
  21. Power on the NI-ELVIS II+ by toggling the switch on the back of the device. When the pop-up window appears, select NI-ELVISmx Instrument Launcher and click OK (Figure 11).
    Figure 11: New data acquisition device dialog window.
  22. Click on the DigOut Icon on the Instrument Launcher window (Figure 12).
    Figure 12: NI ELVISmx Instrument Launcher dialog window.
  23. Figure 13: Digital Writer dialog window.
    Select the appropriate range for the Lines to Write setting in the Digital Writer dialog window that corresponds to the DIO rows chosen. For example, if fox, hen, and corn are on DIO 21, DIO 22, and DIO 23, select 16–23.
  24. Click Run and toggle the switches corresponding to fox, hen, and corn.
  25. Have a TA check the circuit.

The lab work is now complete. Please clean up the workstation. Return all unused materials to a TA. Refer to Assignment for the instructions to prepare the lab report.

Assignment

Team Lab Report

Note: You will be writing a team lab report rather than an individual one. See the Team Authoring Strategies page in the Technical Communication of this online manual for guidance of how to do this.

Follow the lab report guidelines laid out in the page called Specifications for Writing Your Lab Reports in the Technical Communication section of this manual. The following points should be addressed in the appropriate section of the lab report:

  • Describe the problem that was solved in the Introduction
  • Describe how AND, OR, and NOT gates work
  • What is a truth table? How does it contribute to obtaining a Boolean equation?
  • What is a K-map? How does it contribute to obtaining a simplified Boolean equation? To demonstrate the simplification, show what the equation would look like if terms were written for each of the true values and the simplified equation by applying the K-map. Discuss how much simpler the circuitry is as a result of applying the K-map
  • Describe how to construct a digital logic circuit using Boolean equations and K-maps
  • Explain why the alarm system did or did not work
  • Why is there a need for the minimization of a logic design and what are the advantages?
  • How does the use of a combinational logic circuit contribute to advances in technology?
  • Discuss other possible design/procedural improvements
  • Describe how the final combinational logic circuit was obtained
  • Insert a screenshot of the front and back panels in the report; include a picture of the NI ELVIS wiring, truth table/unsimplified boolean equation and k-map/simplified eqn

Remember: Lab notes must be taken. Experimental details are easily forgotten unless written down. EG1004 Lab Notes Paper can be downloaded and printed from the EG1004 Website. Use the lab notes to write the Procedure section of the lab report. At the end of each lab, a TA will scan the lab notes and upload them to the Lab Documents section of the EG1004 Website. One point of extra credit is awarded if the lab notes are attached at the end of the lab report. Keeping careful notes is an essential component of all scientific practice.

Team PowerPoint Presentation

Follow the presentation guidelines laid out in the page called EG1003 Lab Presentation Format in the Introduction to Technical Presentations section of this manual. When preparing the presentation, consider the following points:

  • How does digital logic impact the world today?
  • Look into the future, how will digital logic change the world?

Footnotes

  1. ^ Boole, George, Encyclopedia Britannica, 2003. Encyclopedia Britannica Online. Retrieved July 29th, 2003 http://www.britannica.com/eb/article?eu=82823