Difference between revisions of "Digital-Electronics Obstacle Course"

From Advanced Projects Lab
Jump to: navigation, search
(Bistable Circuits - Flip-Flops - Digital Memory)
(Materials to borrow when necessary)
 
(17 intermediate revisions by one other user not shown)
Line 12: Line 12:
 
=== Materials to borrow when necessary ===
 
=== Materials to borrow when necessary ===
 
- LTSpice circuit simulation software (on computers in lab)<br>
 
- LTSpice circuit simulation software (on computers in lab)<br>
- lab copy of ''The Art of Electronics'', Horowitz & Hill (H&H)<br>
+
- ''The Art of Electronics - 2nd Edition'', Horowitz & Hill (H&H)<br>
 
- inductance meter<br>
 
- inductance meter<br>
 
- Keithley voltage supply
 
- Keithley voltage supply
Line 29: Line 29:
  
 
=== Activities ===
 
=== Activities ===
 +
  
 
[[File:Traninverter.png|right|200px]]
 
[[File:Traninverter.png|right|200px]]
 
# Read chapter 8 of Horowitz & Hill's ''The Art of Electronics''.
 
# Read chapter 8 of Horowitz & Hill's ''The Art of Electronics''.
 
# Read Chapters 10 and 11 of Keith Brindley's eBook ''Starting Electronics''.
 
# Read Chapters 10 and 11 of Keith Brindley's eBook ''Starting Electronics''.
 +
* '''CLEAN UP THE OBSTACLE COURSE SETUP AFTER USE - PUT BACK ELECTRONIC COMPONENTS IN APPROPRIATE PLACES AFTER EACH ACTIVITY'''
 +
* Keep a journal of your activities, results and answers to any questions asked in the activities below. You will use this for your write-up.
 +
 +
 
==== The Inverter or NOT Gate ====
 
==== The Inverter or NOT Gate ====
 
# Using T1 = TIP31C, R = 10k, R2 = 1k, Vcc = 10VDC construct the circuit shown at the right.
 
# Using T1 = TIP31C, R = 10k, R2 = 1k, Vcc = 10VDC construct the circuit shown at the right.
Line 110: Line 115:
 
[[File:SRNORbistable.png|thumb|300px|The S-R NOR Bistable or Latch and Function Table]]
 
[[File:SRNORbistable.png|thumb|300px|The S-R NOR Bistable or Latch and Function Table]]
 
[[File:NORtt.gif|left|thumb| NOR Truth Table| 300px]]
 
[[File:NORtt.gif|left|thumb| NOR Truth Table| 300px]]
Recall that the NOR gate is an inverting OR gate. Also recall that an OR gate's output is High when either or both of its inputs is High. So, a NOR gate's output is only High when '''both''' its inputs are Low.  
+
Recall that the NOR gate is an inverting OR gate. Also recall that an OR gate's output is High when either (or both) of its inputs is High. So, a NOR gate's output is only High when '''both''' its inputs are Low.  
  
Now consider the NOR latch symbolic circuit shown at the right with both S and R initially High (S and R stand for Set and Reset respectively). Each NOR gate must output a Low signal, as each NOR gate has one High input. Because the outputs of the NOR gates are cross-coupled, each will now one Low input (output of the other gate) and one High input (input signal from S or R).
+
Now consider the NOR latch symbolic circuit shown at the right. Let's assume both S and R are initially High (S and R stand for Set and Reset respectively). Each NOR gate must then output a Low signal. Because the outputs of the NOR gates are cross-coupled, each will now one Low input (output of the other gate) and one High input.
  
 
If R is set to Low, the output of the R-gate must become High (both of its inputs are low). Since the output of the R-gate is cross-coupled to the input of the S-gate, the S-gate will remain Low (both inputs are high).  
 
If R is set to Low, the output of the R-gate must become High (both of its inputs are low). Since the output of the R-gate is cross-coupled to the input of the S-gate, the S-gate will remain Low (both inputs are high).  
  
Now consider what happens if S subsequently goes Low. Since the input to the S-gate is now still a combination of a Low and a High (from the R-gate output) its output is still Low.  
+
Now consider what happens if S subsequently goes Low. Since the input to the S-gate is now still a combination of a Low and a High (from the R-gate output) its output is still Low. Changing S back to High, will also not change the output of the S-gate.
  
 
Therefore, the output <math>\bar{Q}</math> is "latched" Low and Q is "latched" High regardless of subsequent changes in S. The outputs "remember" their states.  
 
Therefore, the output <math>\bar{Q}</math> is "latched" Low and Q is "latched" High regardless of subsequent changes in S. The outputs "remember" their states.  
  
If we swap the roles of S and R above (after both are low, keep S low and change R), the analysis remains valid.  
+
If we swap the roles of S and R above, the analysis remains valid.  
  
  
 
[[File:FlipFlopDiagram.PNG|thumb|right|300px| Flip-Flop Transistor Circuit]]
 
[[File:FlipFlopDiagram.PNG|thumb|right|300px| Flip-Flop Transistor Circuit]]
1. Using a proto-board, two [[Media:2N4401BU.pdf| 2N4401BU]] transistors and LEDs  build the flip-flop circuit shown at the right.
 
  
The outputs are the collector voltages and the inputs (S and R) are the switches. When the switches are set such that their bases and emitters are shorted R and S are both Low.
 
  
2. Verify the S-R NOR latch function table.
+
#Build the flip-flop circuit shown at the right Using a proto-board, two [[Media:2N4401BU.pdf| 2N4401BU]] transistors and LEDs. The two inputs, S and R are the switches and the outputs, Q and <math>\bar{Q}</math>, are the collector voltages (i.e. LEDs).
 +
##When a switch is closed, what happens to the transistor's base-emitter voltage? Does this represent a low or high input for the NOR gate?
 +
##Verify the S-R NOR latch function table.
  
  
In addition to the SR NOR bistable there is a SR NAND bistable. Beyond these there are other bistables with added functionality like the clocked SR bistable which allows several bistables to be synchronized. Like with the transistor logic gates considered above there are commercially available Latch ICs that are inexpensive and easy to use.
+
In addition to the SR NOR bistable, there also exists a SR NAND bistable. Beyond these there are other bistables with added functionality. For example, the clocked SR bistable allows several bistables to be synchronized. Like with the transistor logic gates considered above, there are commercially available Latch ICs that are inexpensive and easy to use.
  
 
==== Timing ====
 
==== Timing ====
Line 203: Line 208:
  
 
Microcontrollers integrate a CPU (logic processing), memory, I/O and other peripherals onto a single chip. Microcontrollers are designed to perform specific tasks as opposed to microprocessors (which contain only a CPU, are general purpose and are more powerful and costly as well).
 
Microcontrollers integrate a CPU (logic processing), memory, I/O and other peripherals onto a single chip. Microcontrollers are designed to perform specific tasks as opposed to microprocessors (which contain only a CPU, are general purpose and are more powerful and costly as well).
 +
 +
===== FPGAs =====
 +
[http://en.wikipedia.org/wiki/Field-programmable_gate_array Field-Programable Gate Arrays] (FPGAs) are chips of thousands (or more!) of logic gates. These gates can be configured (and often reconfigured) for the chips to perform various tasks. Often, the chip's action can be defined through a variety of specific programming languages (e.g. VHDL) or visually via graphical layout systems. The code that is written is then compiled to tell the chip's logic gates how connect to perform the given task. This allows for creation of "hardware" that is flexible and can be modified simply, without needing to design and build an entire new circuit.<br>
 +
 +
* Submit a write-up outlining your activities, results and the answers to all the questions asked above.
 +
 +
 +
* '''CLEAN UP THE OBSTACLE COURSE SETUP AFTER USE

Latest revision as of 13:53, 16 May 2017

Permanent Materials (located in the electronics area):

Electronic station.jpg

- power supplies
- function generators
- oscilloscopes
- Fluke 179 multimeter (MM)
- capacitance meter
- electronic proto-boards
- wire, resistors, capacitors, inductors, diodes, Op-Amps, other ICs


Materials to borrow when necessary

- LTSpice circuit simulation software (on computers in lab)
- The Art of Electronics - 2nd Edition, Horowitz & Hill (H&H)
- inductance meter
- Keithley voltage supply

Digital Electronic Component Symbols














Activities

Traninverter.png
  1. Read chapter 8 of Horowitz & Hill's The Art of Electronics.
  2. Read Chapters 10 and 11 of Keith Brindley's eBook Starting Electronics.
  • CLEAN UP THE OBSTACLE COURSE SETUP AFTER USE - PUT BACK ELECTRONIC COMPONENTS IN APPROPRIATE PLACES AFTER EACH ACTIVITY
  • Keep a journal of your activities, results and answers to any questions asked in the activities below. You will use this for your write-up.


The Inverter or NOT Gate

  1. Using T1 = TIP31C, R = 10k, R2 = 1k, Vcc = 10VDC construct the circuit shown at the right.
    1. Apply 0V to input A. What's the output Q?
    2. Apply 10V to input A. What's the output Q?
    3. Taking 0 (or close to zero) volts to be logic state "0" and 10 (or close to ten) volts to be logic state "1" construct the logic state truth table for this circuit (see right).
      Truth table
    4. What type of logic gate does the truth table indicate?
    5. Letting the input = A and the output = B write a Boolean statement describing this NOT gate (i.e., Q = ???).

We can also use the "True" and "False" representation of digital logic with a "0" state equated with a "False" value and "1" state equated with a "True" value. Yet another digital logic representation is the "High" and "Low" representation equated with the "1" and "0" states respectively.




The OR Gate

Orgate.png
  1. Using two 2N4401BU transistors with R = 10k, R1 = 4.7k and Vcc = 6VDC construct the circuit shown at the right.
    1. Apply 0V to A and 0V to B. What is Q?
    2. Apply 1V to A and 0V to B. What is Q?
    3. Apply 0V to A and 1V to B. What is Q?
    4. Apply 1V to A and 1V to B. What is Q?
    5. Construct a truth table for this circuit.
    6. What type of logic gate does the truth table indicate?
    7. Letting the input = A and the output = B write a Boolean statement describing this OR gate.






The AND Gate

Andgate.png
  1. Using two 2N4401BU transistors with R = 10k, R1 = 4.7k and Vcc = 6VDC construct the circuit shown at the right.
    1. Apply 0V to A and 0V to B. What is Q?
    2. Apply 1V to A and 0V to B. What is Q?
    3. Apply 0V to A and 1V to B. What is Q?
    4. Apply 1V to A and 1V to B. What is Q?
    5. Construct a truth table for this circuit.
    6. What type of logic gate does the truth table indicate?
    7. Letting the input = A and the output = B write a Boolean statement describing this AND gate.



The NOR, NAND, XOR and XNOR Gates

It should be clear that we could follow the OR gate with a NOT gate and get a NOT OR gate (a NOR gate). What does this truth table look like?

We could follow an AND gate with a NOT gate and get a NOT AND gate (a NAND gate). Write down the truth table for the NAND gate.

In addition, there are other basic gates like the XOR (exclusive OR) and the XNOR (exclusive NOR).

An OR gate outputs "True" when either (or both) of its inputs is "True". However, an XOR gate outputs True (we'll drop the quotes) when either of its inputs is True (but not both). The XNOR gate is a combination of an XOR gate and an inverter (a NOT XOR gate). What do you think the the truth tables for the XOR and XNOR gates look like?

Digital ICs

It would be extremely tedious (though in principle possible) to build every logic circuit from discrete transistor elements. There are dedicated digital ICs that perform these logic functions reducing cost, saving time and generally making it easier to build complex digital circuits.

Bistable Circuits - Flip-Flops - Digital Memory

The type of logic gates examined above are known as combinational (or time independent) logic gates. That is, their output is a function (only) of their present combined inputs. This means that combinational logic has no memory.

For a circuit to have memory its output must depend not only on its present input but also on its past input. Logic of this type is known as sequential logic. Virtually all circuits in practical digital devices are a mixture of combinational and sequential logic.

The SR-Type NOR Bistable or Latch

The S-R NOR Bistable or Latch and Function Table
NOR Truth Table

Recall that the NOR gate is an inverting OR gate. Also recall that an OR gate's output is High when either (or both) of its inputs is High. So, a NOR gate's output is only High when both its inputs are Low.

Now consider the NOR latch symbolic circuit shown at the right. Let's assume both S and R are initially High (S and R stand for Set and Reset respectively). Each NOR gate must then output a Low signal. Because the outputs of the NOR gates are cross-coupled, each will now one Low input (output of the other gate) and one High input.

If R is set to Low, the output of the R-gate must become High (both of its inputs are low). Since the output of the R-gate is cross-coupled to the input of the S-gate, the S-gate will remain Low (both inputs are high).

Now consider what happens if S subsequently goes Low. Since the input to the S-gate is now still a combination of a Low and a High (from the R-gate output) its output is still Low. Changing S back to High, will also not change the output of the S-gate.

Therefore, the output is "latched" Low and Q is "latched" High regardless of subsequent changes in S. The outputs "remember" their states.

If we swap the roles of S and R above, the analysis remains valid.


Flip-Flop Transistor Circuit


  1. Build the flip-flop circuit shown at the right Using a proto-board, two 2N4401BU transistors and LEDs. The two inputs, S and R are the switches and the outputs, Q and , are the collector voltages (i.e. LEDs).
    1. When a switch is closed, what happens to the transistor's base-emitter voltage? Does this represent a low or high input for the NOR gate?
    2. Verify the S-R NOR latch function table.


In addition to the SR NOR bistable, there also exists a SR NAND bistable. Beyond these there are other bistables with added functionality. For example, the clocked SR bistable allows several bistables to be synchronized. Like with the transistor logic gates considered above, there are commercially available Latch ICs that are inexpensive and easy to use.

Timing

The Astable Multivibrator
The astable multivibrator

A circuit that is similar to the previous SR-type NOR latch is the astable multivibrator. Unlike the latch which is bistable (stable in either of two states) the astable multivibrator is not stable in either of two states. As such, it oscillates between the two states.

  1. Construct the circuit shown at the right using R1 = R4 = 5k, R2 = R3 = 1k and C1 = C2 = 1uF.
    1. What is the waveform?
    2. What is the waveform's frequency?
    3. Change C1 to 10uF. Has anything changed?






The 555 Timer IC
LM555 Timer

We've seen in the previous section that in principle it's possible to construct timing circuits with discrete transistors. However, as was previously the case concerning logic gates, this is a tedious task and there are a number of commercially available IC options. The 555 is a well known and used timing IC. It can function as a one-shot pulse generator, an oscillator or as a bistable flip-flop.

  1. Employ an LM555 and additional components to construct a free-running oscillator at around 500Hz with a duty cycle around 10%.
  2. Configure the LM555 for a one-shot pulse of width around 10ms.



Analog to Digital Conversion (ADCs)

A very simple ADC
  • Read section 9.15-9.21 of Horowitz and Hill's The Art of Electronics.

How do we get continuous (analog) data into a digital processor? The answer is analog-to-digital conversion

Construct the circuit shown at the right. As Vin rises above Vn1/2/3/4 the output of OA1/2/3/4 goes high lighting up Led1/2/3/4.

The continuous, analog Vin is mapped to a discrete set of four output values.

  1. For Vin in the range of 0 to 12V (in 20 evenly spaced steps) plot the output voltage as a function of input voltage.
    1. Repeat the measurement but divide Vin's range into 5 and 10 steps. What changes?
    2. How would the output change if the input range was divided into 100 steps?

As was the case previously, there are a number of commercial ADCs that reduce cost and save time (see H&H Table 9.5).


Digital to Analog Conversion (DACs)

A very simple DAC

We've just seen how to get analog signals into a digital processor but the reverse is also important. How do we get digital signals out of a digital processor and into the analog world? The answer is digital-to-analog conversion

One simple method for this is scaled resistors into a summing junction (see right).

  1. Construct the circuit at the right with the 1.25k resistor's tolerance at 5%. Hand pick the 2.5k resistor to have an actual resistance within 2.5% of 2.5k. Hand pick the 5k resistor to within 1.25% and the 10k resistor to within 0.75%.
    1. Can you explain why the resistors are factor of two apart?
    2. How many bits is this DAC?
    3. Which input represents the most significant bit (msb)?
    4. Which input represents the least significant bit (lsb)?
    5. Map the binary numbers 0000, 0001, 0010, 0100, 1000 onto the inputs and measure the output voltage. Does the output voltage accurately reflect the binary input?

A story you're now very familiar with: A great number of DAC ICs are commercially available (table 9.4 H&H).

Microcontrollers and FPGAs

All of the components, gates, circuits and ICs examined above can be configured (that is, hard-wired) to perform a given task. For example, if you construct an OR gate it functions as an OR gate and not something else. To change the function of the circuit you must physically rewire the circuit's components.

Wouldn't it be nice not to have to physically rewire the circuit to change its function? Also, wouldn't it be nice to not have to individually construct the logic components plus the memory components plus the timing components plus any DAC or ADC and input/outputs needed for a complex digital project?

Wouldn't it be great if there were things that combined all of these (hardware) components (power supplies, logic, memory, timing, DAC/ADC, input/output) into a convenient and inexpensive package? Wouldn't it also be nice if that package somehow allowed for the quick and easy repurposing of its internal components without the need to physically rewire the components?

Microcontrollers

Microcontrollers integrate a CPU (logic processing), memory, I/O and other peripherals onto a single chip. Microcontrollers are designed to perform specific tasks as opposed to microprocessors (which contain only a CPU, are general purpose and are more powerful and costly as well).

FPGAs

Field-Programable Gate Arrays (FPGAs) are chips of thousands (or more!) of logic gates. These gates can be configured (and often reconfigured) for the chips to perform various tasks. Often, the chip's action can be defined through a variety of specific programming languages (e.g. VHDL) or visually via graphical layout systems. The code that is written is then compiled to tell the chip's logic gates how connect to perform the given task. This allows for creation of "hardware" that is flexible and can be modified simply, without needing to design and build an entire new circuit.

  • Submit a write-up outlining your activities, results and the answers to all the questions asked above.


  • CLEAN UP THE OBSTACLE COURSE SETUP AFTER USE