Analog and Digital Simulation Lab

advertisement
2008 Nov
Analog and Digital Simulation Lab
Electronic Workbench Hints & Kinks
0. Create a folder in the C:\Ph623 directory with your name
1. Start Electronic Workbench (EWB). “File”  “New” if you don’t start up with a blank schematic sheet.
2. “File” --> “Save As” : find the folder with your name, save the circuit with a reasonable name (such as "diff amp". Don't put
any "." extension on it).
3. Circuit --> Schematic Options --> Show/Hide: check Show nodes, Show labels, Show values
4. Same menu, Wiring tab: check "Manual-route wires" -- click "OK"
5. "Basic" parts bin (with picture of resistor): Drag a couple of resistors, a couple of unpolarized capacitors, and a "connector dot"
onto your schematic area. "Sources" parts bin (battery picture) has battery, ground, and AC voltage source (for input). Get one
of each.
6. Right-click a component --> "component properties" bring up a box where you can change the value. Be sure units are what
you want -- you can change them too. "Copy" and "Paste" to make as many copies as you need.
7. Right-click component --> "rotate" or "flip" to reorient.
Analog simulation:
8. "Transistors" bin --> NPN transistor: drag one onto schematic area. Right Click --> "Component properties" allows you to
select particular type: National 2N3904. Make copy and "Horizontal flip" it to get second transistor.
9. Arrange parts and wire them. Get cursor near enough to component lead that a dot appears, then left mouse down -- you need
to hold it down until you've moved a little distance away from the connection, then you can let it up. Click once for each rightangle bend you want in the wire as you route it (NB: this only works if you've set manual routing -- item 4 above). You don't
have to line up the bends exactly; it will align itself. "Connector dots" have four connection points around the edges -- watch
where the black dots appear and use the one on the near side for good appearance. You can attach the second end of a wire to an
existing wire: get close enough that a little circle appears, then click. To attach the first end to a wire, you need to add a
connector dot, so whenever possible start your wire at the component. If you are not sure that a wire is really attached, try
moving the component (good wires stay attached). If you really want to be clever, you can notice that most of the circuit is
mirror-symmetric. So just draw half of it, then copy, paste, and horizontal flip the copy. Then join the two halves.
10. If you use coupling capacitors on outputs, they need to have a DC connection somewhere. Put 10-Meg resistors to ground to
fix this.
11. Attach an AC voltage generator to each input. Set voltage, frequency, and phase to values appropriate for measuring
differential or common-mode gain.
12. Get the Q-point bias values by "Analysis" --> "DC Operating Point" You can print out the resulting table for your notebook.
13. Transient Analysis: "Analysis" --> "Transient . . ." Select nodes you want to look at. Click "Simulate" to run transient
analysis. (have "end time" set to a total time that corresponds to ~5 cycles)
14. "Analysis" --> "Display graphs" to see results. DC bias point is on first tab. Transient analysis on third. Click "toggle grid"
and "toggle legend" (but legend won’t print!). You can resize graph by edges or corner, and move legend around. On print
command (from top bar of this window) select pages you want to print -- they are numbered in same order as tabs. “Properties”
lets you change scales, colors, etc.
15. You can also print out your schematic from bar above main menu. Check "Schematic" box. (check "x-y plot" to get scope
display, other options are named more recognizably.) You may need to experiment with the scale factor, but try 200% first.
"Analysis" —> "AC Frequency" to make Bode Plot (gain and phase vs frequency). Use log-log scales. This takes over the
frequency settings of any AC voltage sources you have in the circuit. However, it does not preserve your 180-degree phase
setting for differential input, so you'll need to ground the negative input and just use a single source on the plus input. Look at
both outputs and see if you can explain the differences at high frequencies (remember that the major high-frequency factor is the
collector-base miller capacitance in the transistor). The generic transistor is "ideal" and won't show any high frequency effects —
be sure you have the transistor properties set to 2N3904.
Digital simulation:
“File”  “New” to get rid of (hopefully saved) analog circuit and get new blank sheet. “Save as” with appropriate name. (You
will probably have to navigate back to your folder again.)
Use generic flip flops and gates of the illustrated types from the top row of the "Logic Gates" and "Digital" parts bins (with
pictures of and gate and RS f/f). For the comparator, do NOT use the generic comparator (it doesn't work unless you put a lowpass filter on the output). Use a three-terminal op-amp, right-click to modify properties, choose the default ideal model, then
click on "Edit". Find the positive and negative voltage swing items, and change them to +5V and 0V respectively. You now
have an op-cmp whose output will saturate at TTL logic levels, which is what you want for a comparator. (The op-amp is ideal,
so the the poor behavior of real op-amps when used as comparators does not matter.) Again, if you want to be clever, you can
notice that there is a large unit of the circuit that is repeated four times. So draw just this part once, copy, and paste it three times.
You can then interconnet.
The "Word generator" can generate an arbitrary timing diagram on up to sixteen lines. Each 4-hex-digit "word" in the list drives
the sixteen output lines (four bits per digit), and the generator advances through the list of words at the clock rate that is set in the
generator. Eight clock pulses are enough for a conversion, so you can use just the first sixteen words. Set "end" to 000F to stop
it at this point. You can use one bit for the clock, one to make the "reset" pulse (so you don't need a switch), and one to make the
"start" pulse. If you use just the lsb of three of the hex digits, it will be easier to “read” your table.
The logic analyzer clock should be set about 64x word generator clock rate to give good resolution, then set "clocks per division"
to about 64 for a reasonable display. (Double-click logic analyzer to open its display, then click on the "set" box under "clock" to
set rate.) You can monitor the clock, start and reset pulses as well as the four D flip-flop outputs and the comparator out (and the
four J-K f/f outputs if you want). If you “color code” the wires going into the logic analyzer, the corresponding traces on the
analysis plot will come out in the same color. This can be handy.
[(need to look after buffer if you use the true comparator. Also need RC low-pass filter with 20 ohm resistor and 20 pf capacitor
between DAC output and comparator input with this device.) ]
Use oscilloscope to look at the comparator inputs (the multimeter does not work for some reason).
You can use a battery as the "Vin" source to measure with your ADC. Right-click on it to set the voltage to any value.
Cycling the power (0-1) rocker switch in the upper right corner resets all the plots to start at the left edge.
If you get in trouble making the second circuit in time, you can ask the instructor for a pre-drawn one.
Download