Skip to content

Commit 3662350

Browse files
committed
Editing, new content, and more graphics.
1 parent 828fb75 commit 3662350

19 files changed

+486
-31
lines changed

chapters/calculator.tex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
\section{Building an Adding Machine}
2+
All of these little units, experiments, and instruction have been moving towards a goal -- to make a primitive electronic calculator. Here, we will be able to add two four-bit numbers using only full adders, toggle switches, and LED blocks, all wired together on a breadboard. At the end of this unit, you will be able to enter two numbers in binary using toggle switches, and read the result on an LED readout, also in binary. There's no reason you have to stop at 4 bits -- the 8-LED block means you could add two 7-bit numbers if you have seven full adders and more toggle switches, without \emph{overflowing} the capabilities of the setup. ``Overflow'' means that you have tried to put numbers into the system that cannot be represented by the computer because they are too large, or else the result is too large to display.
3+
4+
\subsection*{Wiring up the adders}
5+
6+
Put two sets of toggle switches on a breadboard and, if desired, two 8-LED readouts (one for each set of toggles). Wire up power and ground to the switches and LEDs, and wire the switch outputs to the LED inputs, moving from right to left, because the rightmost digit is the smallest number value in our example, either 0 or 1.
7+
8+
Run wires out from the switches, perhaps using one color for one bank of switches, and a different color for the second bank, to each input of each full adder, and wire up each ``carry-out'' to the next (leftward!) ``carry-in''. The left-most carry-out digit should run to another LED, perhaps not on the 8-LED output, to indicate an overflow. The overflow, a type of error, means the answer is not correctly displayed on the LED output bar.
9+
10+
Run each adder ``sum" wire to each output LED input. In doing this you will have wired up each column of output, meaning you can read off the sum of the two numbers.

chapters/logiccircuits.tex

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ \subsection*{A Half Adder}
1414

1515
&
1616

17-
\begin{tabular}{ll | ll | c}
17+
\begin{tabular}{ll | cc | c}
1818
\multicolumn{5}{c}{\textbf{Truth Table}}\\
1919
\hline\\[\negsep]
20-
\textbf{A} & \textbf{B} & \textbf{S} & \textbf{C} & \textbf{Decimal}\\
20+
\textbf{A} & \textbf{B} & \textbf{Sum} & \textbf{Carry} & \textbf{Decimal}\\
2121
\hline
2222
0 & 0 & 0 & 0 & 0 \\
2323
1 & 0 & 1 & 0 & 1 \\
@@ -35,7 +35,7 @@ \subsection*{A Half Adder}
3535
\end{figure}
3636

3737

38-
\begin{figure}[h!]
38+
\begin{figure}[hb!]
3939
\begin{center}
4040

4141
\input{./include/halfadder2.tex}
@@ -58,7 +58,17 @@ \subsection*{Full Adder}
5858
\end{figure}
5959

6060

61-
\newpage
61+
\begin{figure}[h!]
62+
\begin{center}
63+
\includegraphics[scale=0.19]{FullAdderboard.png}
64+
\caption{A full-adder circuit, implemented on a small circuit board, with individual integrated circuit gates instead of discrete transistors. You can see the circuits easily but the board is much simpler to work with, compared to the single-gate boards.}
65+
\end{center}
66+
\end{figure}
67+
68+
69+
70+
71+
\clearpage
6272

6373
\subsection*{Equality}
6474

@@ -139,3 +149,4 @@ \section*{Memory}
139149
\caption{A static ram cell. It uses six transistors per bit instead of one transistor and a capacitor for bit (as used in dynamic ram, the main memory for the computer), so it's expensive and bulky, but it's also faster. Usually SRAM is used very close to the CPU core, so it is available for immediate use by the core processing operations. To keep the diagram simple, no resistors are shown. If you look closely at the M1/M2 and M3/M4 transistors, you can see that they are acting like inverters (that is, each pair makes a NOT gate).} % from Wikipedia and http://www.iue.tuwien.ac.at/phd/entner/node34.html
140150
\end{center}
141151
\end{figure}
152+

chapters/logicgates.tex

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,13 @@ \subsection*{The NOT Gate}
283283
\clearpage
284284
\newpage
285285

286-
\subsection*{Complex Gates}
286+
\section{Complex Logic Gates}
287287

288-
Combining gates is possible to produce more complex circuits that answer different questions. A ``NOT-AND", or ``NAND", gate just reverses the value obtained from an AND gate -- so it has the exact opposite truth table. Since a NAND gate just reverses the output of AND, you can put a NOT gate on the result (output) line of an AND gate and make a NAND gate, just like you were using Legos.
288+
Combining gates is possible to produce more complex circuits that answer different questions, like outputs that tell us if two inputs are ``NOT AND" or ``NOT OR" or ``Exclusively OR". Each of these gates allows new comparisons between two inputs, but each is composed of the fundamental three gates, seen above. There is even an "Exclusive NOT OR" gate, which is how computers determine if two numbers are equal to each other.
289+
290+
\subsection*{The NAND Gate}
291+
292+
A ``NOT-AND", or ``NAND", gate just reverses the value obtained from an AND gate -- so it has the exact opposite truth table. Since a NAND gate just reverses the output of AND, you can put a NOT gate on the result (output) line of an AND gate and make a NAND gate, just like you were using Legos.
289293

290294

291295
\medskip
@@ -345,7 +349,7 @@ \subsection*{Complex Gates}
345349

346350
\begin{figure}[h!]
347351
\begin{center}
348-
\includegraphics[scale=0.25]{trimmednandgate.png}
352+
\includegraphics[scale=0.16]{trimmednandgate.png}
349353
\caption{A circuit board designed to make a NAND gate. Note that it uses four transistors.}
350354
\label{fig:nandgate}
351355
\end{center}
@@ -354,6 +358,8 @@ \subsection*{Complex Gates}
354358
\clearpage
355359
\newpage
356360

361+
\subsection*{The NOR Gate}
362+
357363
Not surprisingly, there is also a NOR gate, that has the reverse truth table to an OR gate. NOR gates are easy to implement, though as we have said elsewhere, more complicated NOR gates save power.
358364

359365
\medskip
@@ -421,7 +427,8 @@ \subsection*{Complex Gates}
421427
\clearpage
422428
\newpage
423429

424-
There is also the ``eXclusive-OR", or ``XOR", gate. The XOR gate output (result) is 1 when \emph{the inputs are not the same}. It returns a 1 if, and \emph{only} if, both inputs are different. That is, it provides a one ``exclusively if'' there is a single ``one'' (sometimes called ``logic high", for ``voltage above zero") in the two inputs. XOR gates take a lot of transistors to implement. The most common version requires 12, though it is possible to make an XOR gate with 8 transistors.
430+
\subsection*{The Exclusive-OR Gate}
431+
There is also the ``eXclusive-OR", or ``XOR", gate. The XOR gate output (result) is 1 when \emph{the inputs are not the same}. It returns a 1 if, and \emph{only} if, both inputs are different. That is, it provides a one ``exclusively if'' there is a single ``one'' (sometimes called ``logic high", for ``voltage above zero") in the two inputs. XOR gates take a lot of transistors to implement. The most common version requires 12, though it is possible to make an XOR gate with 8 transistors. See Figure \ref{fig:xorgate}.
425432

426433
\medskip
427434
\begin{center}
@@ -475,6 +482,24 @@ \subsection*{Complex Gates}
475482

476483
\bigskip
477484

485+
\begin{figure}[h!]
486+
\begin{center}
487+
\fbox{
488+
\includegraphics[scale=0.15]{xorgatebreadboard.jpg}
489+
}
490+
\caption{An XOR gate wired up on a breadboard with discrete transistors and resistors. This is the same schematic (and the same color-coded signal wires) seen in Figure \ref{fig:xorgate}. The red switch is signal A and the blue switch is signal B. On the LED line, 0 and 1 are A and B, and 2 and 3 (lit up) are NOT A and NOT B.}
491+
\label{fig:xorbreadboard}
492+
\end{center}
493+
\end{figure}
478494

479495

496+
\begin{figure}[h!]
497+
\begin{center}
498+
\input{include/xorgate.tex}
499+
\caption{An exclusive-or (XOR) gate, composed of 12 transistors and some supporting resistors. You don't need to understand how it works, but it's not that hard if you break it down into signals and AND gates.}
500+
\label{fig:xorgate}
501+
\end{center}
502+
\end{figure}
503+
504+
\clearpage
480505

computertheoryforkids.pdf

1.07 MB
Binary file not shown.

computertheoryforkids.tex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,19 @@
127127
%---------------------------
128128

129129

130-
% Finally -- how do computers add?
130+
% How do computers add?
131131
% How do they store results?
132132
%---------------------------
133133
\newpage
134134
\input{./chapters/logiccircuits.tex}
135135
%---------------------------
136136

137+
% Finally -- Let's make a simple calculator!
138+
%---------------------------
139+
\newpage
140+
\input{./chapters/calculator.tex}
141+
%---------------------------
142+
137143

138144
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139145
\end{document}

images/FullAdderboard.png

154 KB
Loading

images/NOTgate.png

-58.6 KB
Binary file not shown.

images/soldering2.jpg

1.89 MB
Loading

images/trimmednandgate.png

77 KB
Loading

images/trimmednotgate.png

90.1 KB
Loading

images/xorgatebreadboard.jpg

902 KB
Loading

images/xorgatev1.png

148 KB
Loading

include/CMOSNOT.tex

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,39 @@
44
(0,4.0) node[ocirc](in) {} % IN node
55
(0,4.0) node[left] {{\color{red}$IN$}} % IN label
66

7-
(8.5,4) node[ocirc](out){} % OUT node
8-
(8.75,4) node[right] {{\color{red}$OUT$}} % OUT label
9-
(7,4) |- (out)
10-
(7,4) node[circ](){}
7+
(6.5,4) node[ocirc](out){} % OUT node
8+
(6.75,4) node[right] {{\color{red}$OUT$}} % OUT label
9+
(5,4) |- (out)
10+
(5,4) node[circ](){}
1111

1212
% Vdd:
13-
(7,7.5) node[vcc](vin){}
14-
(6.5,7.5) node[above] {$V_{in}$} % Vin
13+
(5,6.0) node[vcc](vin){}
14+
(4.5,6.0) node[above] {$V_{in}$} % Vin
1515

1616
% GND
17-
(7,0) node[ground](ground){}
17+
(5,0) node[ground](ground){}
1818
% (7.75,0.5) node[below] {{\color{red}$GND$}} % GND
1919

2020
% P-type FET
21-
(7,5) node[pmos, emptycircle, xscale=1](Q1){}
22-
(7.5,5.0) node[above]{$Q_1$}
21+
(5,5) node[pmos, emptycircle, xscale=1](Q1){}
22+
(5.5,5.0) node[above]{$Q_1$}
2323

2424
% N-type FET
25-
(7,3) node[nmos, rotate=0](Q2){}
26-
(7.5,2.5) node[above]{$Q_2$}
25+
(5,3) node[nmos, rotate=0](Q2){}
26+
(5.5,2.5) node[above]{$Q_2$}
2727

2828
% Resistors:
29-
(5,3) to [R, l^=$R_1$](5,0)
29+
(3,3) to [R, l^=$R_1$](3,0)
3030
(Q2.S) to [R, -*, l^=$R_2$](ground)
3131
(in) to [R, -*, l^=$R_3$](3,4)
32-
(3,3) to [R, l^=$R_4$](3,0)
33-
3432

3533
% nets:
3634
(vin) |- (Q1.S)
37-
(5,3) |- (Q2.G)
3835
(3,3) |- (3,5)
39-
(5,3) node[circ](){}
40-
(5,0) node[circ](){}
4136
(3,3) node[circ](){}
4237
(Q1.D) |- (Q2.D)
43-
(5,0) |- (ground)
44-
(3,3) |- (5,3)
38+
(3,0) |- (ground)
39+
(3,3) |- (Q2.G)
4540
(3,5) |- (Q1.G)
46-
(3,0) |- (5,0)
4741
;
4842
\end{circuitikz}

include/NOTgateBOM.tex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
\hline\\[\negsep]
55
JP1 & Input/Output & Pin header & 1X02 header & Standard 2-pin 0.1" header \\[\sep]
66
JP2 & $V_{in}$ \& $GND$ & Pin header & 1X02 header & Standard 2-pin 0.1" header \\[\sep]
7-
Q1 & BS250 & BS250 & TO-92-3 & P-type MOSFET transistor \\[\sep]
7+
Q1 & ZVP3306A & ZVP3306A & TO-92-3 & P-type MOSFET transistor \\[\sep]
88
Q2 & 2N7000 & 2N7000 & TO-92-3 & N-type MOSFET transistor \\[\sep]
99
R1 & 100K & Small resistor & 0204/5 & Pull-\emph{down} resistor \\[\sep]
1010
R2 & 10K (10,000$\Omega$) & Small resistor & 0204/5 & Current-limiting resistor \\[\sep]
1111
R3 & 100R (100$\Omega$) & $\frac{1}{4}$-watt resistor & 0207/7 & Current-limiting resistor \\[\sep]
12-
R4 & 100K & Small resistor & 0204/5 & Pull-\emph{down} resistor \\[\sep]
1312

1413
\hline\\
1514
\end{tabular}

0 commit comments

Comments
 (0)