Micro-Cap 7 STUDENT EDITION Software by: Spectrum Software Manual written by: Martin S. Roden Discovery Press 4 8Discovery Press, 2002 This manual is being made available at no charge to faculty who have adopted the text Electronic Design, From Concept to Reality, Fourth Edition, by Martin S. Roden, Gordon L. Carpenter, and William Wieserman Discovery Press, 2002 It may be freely duplicated for distribution to students in classes where the text is being used. If duplicated for this purpose, this must be done on a "not-for-profit" basis (i.e., faculty or departments may charge students only for the actual cost of reproduction). Multiple copies can also be obtained at nominal charge from Discovery Press. See website (www.discovery-press.com) for details and ordering information. CONTENTS Preface 2 To the Student 2 Objectives 3 Features 4 Organization of this Manual 4 Installing the Student Edition of Micro-Cap 7 4 Chapter 1 - Introduction to the Student Edition 5 What Next? 5 Some Easy Examples 5 Another Easy Example 9 Transient Analysis 10 AC Analysis 14 DC Analysis 17 Chapter 2 - Creating a Circuit 20 Editing Schematics 37 Chapter 3 - Transient Analysis 38 Introduction 38 Transient Analysis Limits 39 Transient Analysis Menu 43 Scope Menu 46 Probe 47 Monte Carlo Analysis 49 Digital Analysis 56 Chapter 4 - AC Analysis 60 Introduction 60 Analysis Limits 62 AC Menu 65 Scope Menu 67 Probe 68 Monte Carlo Analysis 70 Chapter 5 - DC Analysis 71 Introduction 71 Analysis Limits 72 Running the Analysis 75 DC Pull-Down Menu 75 Probe 75 Monte Carlo Analysis 76 INDEX 77 Micro-Cap 7 Student Edition: Page 1 Preface This manual is copyrighted by Discovery Press. It is being made available at no charge to faculty who have adopted the text Electronic Design, From Concept to Reality, Fourth Edition, by Martin S. Roden, Gordon L. Carpenter, and William Wieserman, 8Discovery Press, 2002. It may be freely duplicated for distribution to students in classes where the text is being used. If duplicated for this purpose, this must be done on a "not-for-profit" basis (i.e., faculty or departments may charge students only for the actual cost of reproduction). Multiple copies can also be obtained at nominal charge from Discovery Press. See the publisher=s website (www.discovery-press.com) for details and ordering information. To the Student: Welcome to the world of computer-based circuit analysis with Micro-Cap 7. The Student Version of Micro-Cap 7 is an integrated schematic editor and mixed analog/digital simulator that provides an interactive sketch and simulate environment for electronics engineers. Micro-Cap 7 makes it exceptionally easy to enter your circuits into a personal computer because the entry process is menu driven. The circuit schematic unfolds before your eyes as you interact directly with the software. The program uses screens with pull-down menus, hot keys, and mouse support. It is easy to interface with SPICE circuit text files. Waveforms are displayed in real time, so you can terminate runs without waiting for completion. You can probe the schematic for various waveforms or use a scope feature to examine details of a simulation result. Circuit simulation programs are useful in design. A real-life circuit does not behave exactly as the ideal theory predicts. Simplified models of elements and devices exclude many of the more complex dependencies that occur when the circuit is constructed. Computer simulation programs allow you to check the performance of a circuit before building it. You can easily make changes in the circuit at this stage since you need only change the input to the computer program. You avoid a lot of time and expense, and you can fine tune your design for optimum performance. You can perform multiple simulations to examine the worst possible case, or find the probability that a component or system will fail. You have in your hands the Student Version of a software package used by engineering professionals. The graduating engineer or engineering technologist cannot survive in the technological world without an understanding of, and familiarity with, the use of the computer as a design tool. Computer-aided engineering (CAE) is an integral part of electrical engineering. Designers use state-of-the-art computer systems to optimize component selection. Even small personal computers can aid in checking designs and indicating which parameters require modification. Micro-Cap is becoming the industry standard for use in electronic circuit analysis and design. Very minor differences exist between the Student Version and the Professional Version of this software: The Student Version limits the number of components to 50 and the number of equations (nodes + inductors + sources) to 100. The Professional Version easily handles circuits of 10,000 nodes or more. Speed is deliberately reduced. Analysis run times vary from the same for small circuits to four 2 times longer for the largest circuits, relative to the Standard Version. The use of some features such as optimization, filter design, 3D plots, PCB functions, performance plots, and multiple parameter stepping is limited. The Professional Version includes a MODEL program which is an interactive program that takes numbers from data sheet graphs or tables and produces an optimized set of device model parameters. This MODEL program is not included in the Student Version. The Student Version libraries of pre-entered devices (such as bipolar transistors) are limited to the most common devices, although you can add any device to the library. Micro-Cap 7's SPICE-based circuit analysis program contains models of many popular electronic devices. This program forms an ideal base for a student-oriented electronic circuit design programBnot only because students will use the Professional Version after they graduate, but also because the program's general features are representative of a broad class of analysis software. A word of caution is appropriate if this is your first experience with simulation tools. Just as the proliferation of calculators did not eliminate the need to understand the theory of mathematics, electronic circuit simulation programs do not eliminate the need to understand electronic theory. As in the case of calculators, MICRO-CAP V can free the designer from tedious calculations, allowing more time for doing the kind of creative work a computer cannot do. Before performing a computer analysis of a network, you should have some idea of what to expect. We suggest you use this software to check your designs. In the process you may uncover some unexpected results, because a paper design rarely incorporates models as sophisticated as those used by this program. To keep down the price and make this software available to more students, we have intentionally eliminated some material from this manual. For example, although the Student Version and Professional Version operate in essentially the same ways, the manual you are holding is less than 100 pages long while the documentation accompanying the Professional Version spans about 500 pages. Not every fine point of the simulation is covered in this student manual. Experimentation and the help screens should fill in many of the blanks. Objectives: The primary objectives of the Student Edition of Micro-Cap 7 are as follows: !To provide a tool for handling the tedious calculations of circuit design, thus affording you more time for creative design work. !To help you design circuit boards for your course work and prepare you for using Micro-Cap 7 in your profession. !To provide a package that has been carefully designed to save you money while not compromising features significant at this phase in your education. Micro-Cap 7 Student Edition: Page 3 Features: The Student Edition of Micro-Cap 7 the following features: !A library of standard passive and active devices, including popular models of BJTs, MOSFETs, JFETs, op-amps, digital logic gates, digital ICs and diodes. !The capacity to custom-define devices and add them to the library for later use. !Three types of analysis: transient analysis, ac analysis, and dc analysis. Within each of these types of analysis, you can perform iterative analysis (temperature stepping and parameter stepping), PROBE analysis where you can display multiple waveforms by clicking the mouse at the appropriate points in the circuit, and Monte Carlo probabilistic analysis to provide for random variation of device parameters. Organization of this Manual: The Student Version manual is organized into five chapters. The first is a general introduction, and that chapter will lead you through some simple examples in order to give an overview of the power of the program. Chapter two teaches you how to draw circuits using Micro-Cap 7's schematic capture features and drawing tools. Chapters three through five present the three types of analysis, transient, ac and dc. Installing the Student Edition of Micro-Cap 7 Installation of the software is straightforward. Insert the CD in your computer=s CD-ROM drive. Follow the installation instructions that appear. If the Micro-Cap screen does not appear, select Run from the Start menu and enter drive:\setup.exe where Adrive@ is your CD-ROM drive letter. Now you are ready to start the program. Simply click on the Mc5demo icon, or navigate to it from "My Computer" or other techniques (e.g., Windows Explorer). We want to give you at least one way to exit from the keyboard in case you cannot wait for that section of the manual (for example, if you get an important phone call and must turn off the computer now). You can clear any window by pressing the Esc key. Then press the Alt F4 function key. The program asks you to confirm that you want to exit, and you simply type Y for yes. You have now left Micro-Cap 7. Of course, in Windows you exit as you do with any other program by clicking on the X in the upper right corner. 4 Chapter 1 Introduction to the Student Edition Now that you have installed the software, you are ready to explore the power of this simulation program. There are two radically different approaches toward learning to use a piece of software. One is to read the entire manual and then approach the computer, hoping you remember most of what you have read. The second is to sit down at the computer and learn as you go along. Fortunately, Micro-Cap 7 is sufficiently user-friendly that you can take the second approach. The only possible damage you can do is to erase a portion of the files. Since you have not yet created your own files, such damage is easily correctable by reinstalling the software. Therefore, we encourage you to experiment. Learn what each instruction does by reading the manual and then trying it on the computer. Another feature of Micro-Cap 7 is the context-sensitive help screens available in each menu. Any time you need more information before completing a task, simply press the F1 function key (or pull down the Help menu). If you do this before running a simulation, you get a help index that allows you to select the topic in which you are interested. The Help pull-down menu also provides options for running a tutorial. Before attempting to draw your own circuit, we recommend that you run the tutorial. Do this by pulling down the Help menu, and selecting the demo. You will either have a choice of running the full (i.e., General) demo, or if you have Version 2.0 or later of the software, you can run selected portions. Just click on your choice and sit back and relax. You can exit the demo at any time by pressing the ESC key. You can pause at any time by pressing "Pause" (Break on some keyboards), and resume by pressing "Pause" again. If you are a speed reader and want to shorten the pauses between screens, press any key to move forward. Don't try to use your mouse during the demonstration. This will only frustrate you as the demonstration program takes complete control of your computer. What Next? OK, you have run the tutorial, and are now very excited about the program. There are two distinct parts to using the program. (1) Drawing (or retrieving) a schematic, and (2) running the simulation. You should now be sitting at your computer. This manual is NOT bedside reading (unless you have a laptop in bed). Some Easy Examples We'll begin by skipping the drawing part (we'll come back to that in a few minutes). It's really pretty easy, but we want you to see a simulation within the first five minutes of running the program. So let's save the time of entering a circuit by retrieving one of the schematics that came packaged with your program. Pull down the File menu, select Open, and you have a list of circuits in the file that came with your program. Note that these circuits end with the extension ".cir". Select the circuit that we used to illustrate performance, that is, perf1.cir. Your screen should now contain the circuit shown in Figure 1. Micro-Cap 7, Student Edition: Page 5 Figure 1 This is an RLC circuit driven by a pulse source. We will run a transient analysis, and leave the other forms of analysis up to you. This type of analysis plots the output (or any other parameter) as a function of time. You should pull down the Analysis Menu and select Transient Analysis (note the hot key you can use to save time in the future). This presents you with an Analysis Limits window, as shown in Figure 2. Let's look at the way this window is currently configured (this is stored in memory with the sample circuit). Figure 2 Micro-Cap 7, Student Edition: Page 6 The first entry is the Time Range. Note that the entry is "1u". This means that the simulation will run from time zero to 1 microsecond (we hope you are not bothered by the modified Greek mu. You certainly would not want to go through the trouble of entering a symbol. However, if you prefer you can enter 1E-6 instead of u, or you could even enter 0.000001 if you wish). If you wanted the simulation, instead, to run from 1 microsecond to 2 microseconds, you would enter 2u,1u. The first number is the ending time and the second is the starting time. The default starting time is zero, so we didn't need a second entry in the example circuit. The second line shows Maximum Time Step. Micro-Cap simulates operation of a circuit by stepping in time. At each step, the program calculates parameters and compares them with the previous calculated values. If a circuit contains capacitance or inductance, the program also monitors the time rate of change of the charge and flux. Internal algorithms control the size of the derivative. If it is too large, the time step is decreased. If it is too small, the time step is increased up to the specified maximum. If the maximum time increment is too large, the resolution suffers, while if it is too small, the program takes a long time to run. You can often smooth a resulting curve by reducing the maximum time step. Note that we have set this to 5 nanoseconds. This means that there will be at least 200 points within the 1 microsecond analysis window. The Number of Points is used for numeric output (that is, a table, as opposed to a graph). It sets the number of points to be printed (number of rows in the printout table). The default value is 51. If the specified points do not fall directly on values used in the iteration, the printed value is interpolated from calculated values. Temperature enters into the parameter equations for devices and components. One or more temperature values (in degrees Celsius) can be specified for the analysis. The format is High [,Low[,Step]] where we have used the convention that square brackets indicate parameters you can omit. The default value of Low is High, while the default value for Step is the difference between High and Low. Therefore, if only one value is specified, the simulation runs at that temperature. If two values are specified, the simulation runs at those two values. We now move down to the waveform options fields. The first box is labeled P. When several variables are plotted, you have a choice of superimposing them on the same set of axes or having them appear on separate, non-overlapping graphs. The numeric entry in the P column is a number from 1 to 9 specifying which graph you want that curve to appear in. The X Expression field specifies the expressions for the X-axis variable. In most transient cases, this is a time variable. You could do fancier things like plotting a hysteresis curve, where in that case, the X expression would be an input voltage. The Y Expression field specifies the expressions for the Y-axis variables. These may be simple voltages or currents, or more complex math expressions. Examples of variables include V(A) [voltage at node A], V(A,B) [voltage at node A minus voltage at node B], V(D) [voltage across the device called D], I(D) [current through the device called D]. The next two fields are the ranges. The format is High[,Low]. We see in the example that the X range is simply 1e-06. We could have also entered 1u, or 0.000001. This sets the X range to go from zero to 1 microsecond. The Y range is "9,-6" which means it ranges from -6 volts to +9 volts. It's easy to see how we chose the X range (it matches the analysis range, but you could have chosen just a portion of the analysis to display). The Y is not so easy to predict unless you know how the circuit behaves. You have the option of entering "auto" for one or both ranges. In that case, Micro-Cap does all the work for you. The X range will match the Micro-Cap 7, Student Edition: Page 7 analysis window, and the Y range will be adjusted to include the maximum and minimum outputs. Enough talk…..let's run the simulation. Simply click "Run". The result is shown as Figure 3. Figure 3 My gosh, we seem to have gotten a number of curves. Why did the program run more than once? Is it paid on commission? Let's examine the screen and see if there is any hint as to why multiple runs occurred. Our first clue is given by the title bar on Figure 3. Note that it says, "C1 Value=1e-010...4.1e-009". Go back to the analysis limits window by pulling down the Transient menu and clicking on Limits. Something seems to be stepping, so how about clicking on the "Stepping" box on the Transient Analysis Limits window? Now you will see why this happened. The capacitor is stepping from 0.1 nF to 4.1 nF in steps of 0.5 nF. That's why we got 9 separate plots. As you get familiar with the program, you will learn how to label these multiple curves. Now that we have solved the mystery of the multiple curves, you probably want to return to the limits window. If you lose the Limits window as you jump around, just pull down the Transient menu and select "Limits" to get it back on the screen. Now we would like you to play around with this. Start changing entries and see the result. Go to the stepping window and either eliminate the steps or increase them. Add another plot (click "Add") either on the same graph (P=1) or a separate graph (P=2). Play around until you are comfortable knowing what every button does. Micro-Cap 7, Student Edition: Page 8 It's best to learn by experimentation, but if you get too frustrated, just pull down the Help menu. You can get a table of contents, or you can search for help on a specific topic. Most of the details from the professional version are contained in this help file. Another Easy Example Let's take a moment to explore another simple example. We'll look at an RLC circuit driven by a pulse of height 5 volts and duration 1.4 microseconds. Once again, we will avoid drawing the circuit, and take advantage of the fact that the RLC circuit has been drawn for you and stored on the disk. We need simply retrieve it. Pull down the File menu, and select Open. The contents of the data directory are now displayed. Scroll down to RISE.CIR. This is the RLC circuit and it is similar to that used in the previous example. When you double-click on this entry, your window should look like Figure 4. Micro-Cap 7, Student Edition: Page 9 Figure 4 For now, don't be concerned with all of the words on the screen. We will be using this same circuit later to learn about Monte Carlo analysis. The first three MODEL statements below the circuit set tolerances that will become important later. The bottom MODEL statement describes the input pulse. In case you cannot wait until later to examine this, we'll say a bit about it now. The first two entries in parentheses specify the two voltage levels (zero and five). The five times, designated P1 to P5, describe the corners of the waveform. The rise time and fall time of this pulse are 10 nanoseconds each. Micro-Cap 7 identifies voltages according to numbered nodes. Note that Figure 4 has three nodes, and they are numbered 1, 2, and the ground. If your screen is not showing the node numbers, click on the Options pull-down menu, select View and then select Node Numbers. Micro-Cap automatically numbers any non-ground nodes for you. Transient Analysis We'll begin by running a transient analysis. Pull down the Analysis menu and select Transient Analysis. Many of the selections also have keystrokes listed, and you may find this to be a faster way to execute the analyses in the future. Once you select Transient Analysis, your screen will present the Transient Analysis Limits, as seen in Figure 5. Micro-Cap 7, Student Edition: Page 10 Figure 5 We need to make some adjustments before running the program. The first is to disable the Monte Carlo Analysis. You will learn about Monte Carlo analysis later. For now, pull down the Monte Carlo menu, select Options, and select OFF to turn off Monte Carlo. Now we need to get the Transient Analysis Limits window back on the screen, so pull down the Transient menu and select Limits. As you examine the Transient Analysis Limits window, you will see lots of items, some of which will seem confusing and some of which will look familiar from the previous example. Starting at the top middle, you see Time range, Maximum time step, Number of points, and Temperature. We will not make any changes to the last three of these entries, but we will change the "250N" in the time range. The stored circuit is meant to illustrate the rise time so the time axis goes from zero to 250 nanoseconds. However, since our pulse repeats every 11000 nanoseconds, let's enlarge the analysis window to include part of the second pulse. Use your mouse to get to the "250N" entry and change it to "12000N". This will plot the first 12000 nanoseconds (note that you could have entered 12u for 12 microseconds). The next area to look at in the window is the plot information at the bottom. This tells Micro-Cap what waveform(s) to display. The entry currently shows that plot #1 (actually there only is one plot in this example) is V(2) vs. time [i.e., X expression is T for time and Y expression is V(2), or the voltage between node #2 and ground]. This is why it is important to know how the nodes have been numbered. You need to change to X Range to 12000N. It currently shows 250N,0,5e-8. This sets the maximum to 250 nanoseconds, minimum to 0, and grid spacing to 0.5 nsec. If you leave it as is, you will only be plotting the first 250 nanoseconds (don't take my word for it, try it!). By just entering 12000N, we will be using default values for the other variables. The Y Range does not have to be changed. Now click Run. Your screen should now look like Figure 6. Notice that the part of the curve below zero volts has been cut off. Let's correct this. Pull down the Transient menu and select Limits. Now in the Transient Analysis Limits window, lets change the Y range from "10" to read "10,-2". This means that instead of displayed Y range values from zero to 10 volts, we will display -2 to 10 V. Run the analysis and see what changes. We don't want to overwhelm you this early in the game, but just one more nice feature. Go back to the Transient Analysis Limits window (see previous paragraph), use your mouse to highlight the Y range, and hit the Delete key to erase the range. Then use your mouse to click Micro-Cap 7, Student Edition: Page 11 Figure 6 the box labeled Auto Scale Ranges. Now run the analysis one more time, and note that the Y axis automatically adjusts to include the entire waveform (Figure 7). The same would have happened for the time axis had we omitted that entry. Figure 7 Micro-Cap 7, Student Edition: Page 12 Before leaving the plot, you should play around with the buttons at the top of the screen. You should have two tool bars showing. If you do not, pull down the Options menu, and click on Main Tool Bar. The item will be checked, and the tool bars will appear. Now locate the button on the tool bar that shows a picture of a curve with dots on the curve. When you point the mouse at this button, the help bar should read, "Marks the actual analysis Data Points". Click on this button and see what happens to the curve. Other buttons are used to mark points on the curve and display the actual X and Y values. You can also find distances between two cursors. You should take the time to try some of these buttons. You can't hurt anything in the process. Let's now illustrate stepping of components. Let's try to step the resistor, R2, from 10 ohms to 50 ohms in steps from 10. From the Analysis Limits Window, click on Stepping. This yields the stepping dialog box of Figure 8. Figure 8 Enter the component, the initial value, final value and step value in the appropriate boxes. Then check "Yes" under stepping. You probably want linear rather than logarithmic stepping. With linear stepping, the increment stays constant. With logarithmic, the ratio stays constant. Click OK, and then select Run from the Transient pull-down menu, or simply press F2. The result is as shown in Figure 9. Note there are now 5 plots where we previously had only one. Micro-Cap 7, Student Edition: Page 13 Figure 9 AC Analysis Now let's perform a frequency (ac) analysis on this same RLC circuit. In ac analysis, you plot output as a function of frequency. The straight-line approximation to this plot is the familiar Bode plot. The ac analysis is run in a manner similar to that of the transient analysis. If you have just finished experimenting with the transient analysis, you already have the RLC circuit loaded into the computer. However, rather than simply proceeding with the ac analysis, we are going to ask you to unload the circuit and then reload it. The reason we do this is to clear all the operations you entered during the transient analysis. For example, the last thing you did was to step the value of the resistor. If you were to proceed immediately to the ac analysis, the program would continue in the stepping mode. Press F3 to exit the simulation and return to the circuit. Pull down the File menu and select Close. You will be asked if you want to save changes. We suggest you answer No. Now reload the circuit by selecting Open, and then select the circuit, rise.cir. Pull down the Analysis window and select ac. The ac analysis limits window is now displayed as in Figure 10. It is somewhat similar to the transient analysis limits window. The first set of entries gives the Frequency range, number of points, temperature, and three additional entries for advanced analysis. Note that the frequency limit is 1E8,1E6. This means the analysis starts at 1 MHz and finishes at 100 MHz. As was the case with the transient analysis, the stored circuit has Micro-Cap 7, Student Edition: Page 14 temperature stepping. Since the temperature steps from 27 to 227 in steps of 200 degrees, we would only see two plots. Replace the temperature values with a single temperature, "27". Figure 10 Moving to the entries that create plots, you should see six entries. Since only the first one has a number in the "Plot" column, that is the only thing that will plot. The other quantities (phases, real and imaginary parts) will not plot. The X expression is frequency (F). The Y expression is the voltage at node #2 in decibels. If you click in this Y expression box and then click the right mouse button, you will see examples of the types of complex analysis variables you can select to plot. The next two entries are X Range and Y Range. If you wish, you can leave these blank and select "Auto Scale Ranges" to let Micro-Cap adaptively select the axis ranges. Click on Run and obtain the plot shown in Figure 11. Suppose you also wanted to plot the voltage across the inductor (in dB). Modify the second line in the Analysis Limits Window by first putting a "1" in the P column and then selecting the Y expression to be db(v(L1)). You should probably also clear the four ranges you are plotting, and select Auto Scale Ranges. Click Run and see the two plots. To distinguish them Micro-Cap 7, Student Edition: Page 15 Figure 11 from each other, locate the "Applies Tokens to Waveforms" button on the tool bar (near the center), click it and see what happens. You should get curves that look like Figure 12. Micro-Cap 7, Student Edition: Page 16 Figure 12 Now play around. Try changing the second plot P entry to a "2", then try applying some stepping. You can't hurt yourself by trying lots of things. When you are finished, press F3 to exit the analysis. Then close the circuit if you wish. DC Analysis The third type of analysis plots output versus input under dc conditions. Ideal capacitors become open circuits, and ideal inductors become short circuits. The dc analysis is run in the same manner as the transient and ac analysis. We'll perform this on the RLC circuit we have been using even though the result is not very exciting. Press F3 to cancel the previous analysis. Then select dc from the Analysis pull down menu. In the DC Analysis Limits window (see Figure 13), first select Variable 1 as "PULSE". Then let's plot V(2) as a function of V(1). Simply enter V(1) as the X expression and V(2) as the Y expression. Empty the range boxes and select Auto Scale Ranges. Don't forget to place a "1" in the P column. Then hit Run. The result is as shown in Figure 14. Micro-Cap 7, Student Edition: Page 17 Figure 13 Figure 14 Hmmm. A 45 degree straight line. Not too surprising since the inductor is a short and the capacitor is open. The output voltage is the same as the input voltage. The dc analysis mode becomes much more interesting when non-linear devices are present in the circuit. Micro-Cap 7, Student Edition: Page 18 We have illustrated the three circuit analysis options for a simple example. Even though the circuit you analyzed did not contain any non-linear passive devices or any active electronic devices, we hope you can sense the excitement and tremendous power of this program. The only things we have not covered in this simple example are digital analysis, how to draw your own circuit and some of the more subtle features of the program, such as Scope, Probe, and Monte Carlo analysis. The next major section of this manual takes a more detailed approach toward gaining skill with the program by first learning how to draw complex circuits. We then explore the three analysis packages in detail. Micro-Cap 7, Student Edition: Page 19 Chapter 2 CREATING A CIRCUIT When you first execute the program, you automatically open a circuit window with the name, "CIRCUIT1", as shown in Figure 15. If you have already been using Micro-Cap 7, you should use the File pull-down menu to close existing files (not really necessary, but if you a finished working with a circuit, it is a good idea to preserve working memory). Then use the File menu to select NEW. Don't be concerned if the title bar at the top calls this "CIRCUIT2" or any other number. The counter resets to zero when you exit and then re-enter the program. Figure 15 You should have two menu bars at the top of the screen. If you do not have these two "tool" bars, pull down the Options menu and select Tools. Although it is not necessary to know the function of each button at this time, we'll quickly review the major ones. Depending on the version of Micro-Cap 7 you have, you may not see all of these buttons. Each row has up to 30 buttons in it. If you point the cursor at any button, the help bar at the bottom of the screen describes the function of the button. If you do not see a help bar, pull down the Options menu and click on Help Bar. The top starts with the normal Windows buttons you should be used to. The next set of buttons serves as a type of "hot key" to select common types of components. We will see several ways to do this. For example, if you want to add a resistor to the circuit, you can click that component, then place the resistor anywhere you wish in the circuit. As you move to the Micro-Cap 7, Student Edition: Page 20 right, the next set of buttons are useful if you subdivide a large circuit into sub-circuits and place each in a separate window. These buttons allow you to view the various windows in different ways. The first four buttons on the second menu bar select the mode. The first (arrow) button clears the existing mode. The second button enables the component mode where you will be adding components to the diagram. The third button enables the text mode for adding text, and the fourth and fifth buttons enter the wire mode for adding wires–either aligned horizontally, vertically, or on a diagonal. The next button places you into the graphics mode where, by clicking anywhere on the screen, you get a choice of adding simple graphics shapes (e.g., rectangle). You click and drag to draw the shape. The button with an "I" enters the information mode. Enabling this and clicking on any component gives you the detailed description of that component. The next button, "?" enables the help mode. In this mode, if you click on any component, you will be presented with the format for entering parameters for that component. The remainder of buttons on the first row should be self-explanatory when you read the help text at the bottom of the screen. With the exception of the right-hand set of buttons, you probably will not be using most of these remaining buttons. You will probably not be using the remaining buttons. You can experiment with these, but in all cases, you can accomplish the same function by selecting from the pull down menus. We describe these pull-down menus next. File: The File menu provides commands for the management of schematic or SPICE text circuit files, model library files, or text document files. Equivalent tool bar buttons exist for some of these entries: !New: (CTRL+N). This command creates a new file. !Open: (CTRL+O). This command loads an existing file from the last used directory. !Save: (CTRL+S). This command saves the active window file to disk using the name and path shown in the title bar. !Save As: This option lets you save the active window file to disk. It invokes the Save As dialog box to let you enter a new file name and a new path. !Paths: This lets you specify one or more default paths (folders) for data and libraries and pictures. This is a nice feature if you keep data on separate disks. !Translate: This command gives y9ou various options to convert SPICE, Micro-Cap, and earlier Micro-Cap version files. !Revert: This command restores the file in the active window to the one currently on disk. Since the Undo command can only undo the last edit, this command provides a convenient way of undoing many edits. !Close: (CTRL+F4) This command closes the active file. !Print Preview: This option previews what the printed schematic will look like at a user selected scale. !Print: (CTRL+P) This command prints a copy of the document shown in Print Preview in accordance with the instructions in Print Setup. !Print Setup: This option changes the printer setting and page layout. !Prior Files: This is a list of the most recently used files. You can reload any of them by clicking on the desired file name. Micro-Cap 7, Student Edition: Page 21 !Exit: (ALT+F4) This exits Micro-Cap 7. Edit: This menu provides the following commands: !Undo: (CTRL+Z) Most operations that change a circuit file or a text field can be reversed with the Undo command. !Cut: (CTRL+X) This command deletes the selected objects and copies them to the clipboard. !Copy: (CTRL+C) This command copies selected objects to the clipboard. !Paste: (CTRL+V) This command copies the contents of the clipboard starting at the current cursor position. !Clear: (DELETE) this command deletes the selected items without copying them to the clipboard. !Select All: (CTRL+A) This command selects all objects in the current window. !Add Page: This command adds a new page to the schematic. !Delete Page: This command deletes one or more schematic pages. !Refresh Model: This command places model statements in the text area. !Box: These commands affect objects enclosed in the selected box region. !Step Box: This steps objects enclosed in a selected region a specified number of times. !Mirror Box: This command creates a horizontal or vertical mirror image of the objects enclosed in a selected region. !Rotate: (CTRL+R) this command performs a counterclockwise rotation of the objects in a selected region. !Flip X: (CTRL+F) This command flips the objects in a selected region about the X-axis. !Flip Y: Same as Flip X but flips around Y-axis. !Change Attribute Display: This lets you change the Attribute Display status of the five main attributes of all components in the circuit. !Color: This option lets you change color of selected text or graphics. !Font: This option lets you change the font, style, size, effects, and color of any selected text. !Bring to Front: A mouse click on a stack of overlapping objects selects the front object in the stack. This command makes the selected object the front object. !Send to Back: this command makes the selected object the back object. !Find: This command invokes the Search menu for searching the front window. You can search for text, node numbers, components, or a part model. !Repeat Last Find: (F3) Repeats the search and finds the next object in the circuit. !Replace: Conducts a search and replace operation. Component This menu allows you to select a component for placement in the schematic. The selections are numerous and are discussed elsewhere in this chapter. Windows The following selections are offered: !Cascade: (SHIFT+F5) This command cascades the open circuit windows in an overlapping manner. Micro-Cap 7, Student Edition: Page 22 !Tile Vertical: (SHIFT+F4) This vertically tiles the open circuit windows in a nonoverlapping manner. !Tile Horizontal: This horizontally tiles the open circuit windows in a non-overlapping manner. !Overlap: This neatly arranges any minimized circuit window icons. !Maximize: Maximizes the selected circuit window or window icon. !Zoom In: (CTRL++) Magnifies the central portion of a schematic (or the text point size). !Zoom Out: (CTRL+-) Shrinks the central portion of a schematic (or the text point size). !Toggle Drawing/Text: (CTRL+G) This command toggles the window display between the drawing and text areas. !Split Text/Drawing Areas Horizontal: Horizontally splits the front schematic window into its drawing and text areas for simultaneous viewing. !Split Text/Drawing Areas Vertical: Vertically splits the front schematic window into its drawing and text areas for simultaneous viewing. !Remove Splits: Gives full circuit window to the drawing area of the schematic. !Component Editor: This Editor is used to manage the Component Library. You will probably not use this. !Shape Editor: Manages library shapes. You will probably not use this. !Model Program: Not available in Student edition of Micro-Cap V. !Calculator: Accesses calculator. !Open Files: You can select any of the open files to become the front window circuit. Options !Mail Tool Bar: (CTRL+O) This toggles the display of the Tool bar on and off. !Status Bar: This toggles the display of the Status bar on and off. !Mode: This accesses the Mode submenu containing the following items: !Select: (CTRL+E) Selects objects for editing. !Component: (CTRL+D) Lets you add a component to schematic. !Text: (CTRL+T) Lets you add grid text to schematic. !Wire: (CTRL+W) Adds orthogonal wires to schematic. !WireD: Adds diagonal wires to schematic. !Line, Rectangle, Diamond, Ellipse, Arc, Pie: used to draw graphics objects. !Flag: Place flags on the schematic to mark locations for quick navigation. !(The next 7 selections are not available in the Student Edition) !Help: Invokes Component Help system. You click mouse on a component to see its parameter and model syntax. !Info: Click on component to display model parameters. !Point to End Paths: Clicking on a digital component displays all paths from that component to all possible end points. !Point to Point Paths: Clicking on a digital component displays all paths from that component to the next component. !View: This accesses the View submenu containing the following items: !Attribute Text: If checked, this shows component attribute text. !Grid Text: Shows grid text. !Command Text: (ALT+.) Shows command text. Micro-Cap 7, Student Edition: Page 23 !Node Numbers: Shows node numbers assigned by program. Analog nodes have rounded rectangles and digital nodes have normal angular rectangles. !Node Voltages/States: After a transient analysis is run, this displays node voltages and digital states from the last simulation run. !Pin Connections: Displays a dot at the location of each component pin. !Grid: Displays schematic grid. !Cross-hair Cursor: Adds cross-hair cursor. !Border: Adds border !Title: Add a title block to schematic. !Show all Digital Paths: Displays a list of all possible digital paths together with their delays. !Preferences: (CTRL+SHIFT+P) Accesses Preferences dialog box. !Global Settings: (CTRL+SHIFT+G) Accesses Global Settings dialog box. !Component Palettes 1-9 (Note only 1 to 4 available in Student Edition): Component Palettes provide a convenient way to select a component instead of accessing through the Component pull-down menu. Figure 16 Now let's draw a simple circuit. We'll draw the RLC circuit of the previous chapter. That circuit is repeated as Figure 16. You draw the circuit much as you would with pencil on paper–one component at a time. You have at least three different ways to select a component. Suppose, for example, you wish to draw a resistor. First make sure you are in the component mode (second button on top bar– the one with the wiggly resistor-type symbol). Then select resistor using one of the following techniques: (1) click on the resistor icon button on the top tool bar (near the middle); (2) Pull down the Component menu, select Analog Primitives and then Passive Components and Micro-Cap 7, Student Edition: Page 24 then Resistor; (3) select Resistor from one of the four component palettes. You display the component palettes by pulling down the Options menu and selecting Component Palettes. Take the time now to see what components are on each of the four palettes. The passive components are all on palette #1, and you may want to keep that palette displayed in the corner of your schematic screen. OK, so you have now selected Resistor using any of the techniques described. Let's add a 50 ohm resistor to the right side of the circuit, as shown in Figure 16. Click and hold the left mouse button and position the resistor where you want it. While holding the left button, click the right button to rotate by 90 degrees. Then release the buttons. This presents an Attribute Dialog box. You need to enter the value. Since you want this resistor to be 50 ohms, simply enter "50". Then press Return or click OK. The resistor is added to the circuit. In designating component values, you can use any of three separate formats: !Real numbers: Enter the value of the component. For example, 1 megohm would be 1000000 and 1 microfarad would be .000001. !Floating point: (Scientific notation): enter a number using powers of 10. For example, 1 megohm is entered as 1E6 and 1 microfarad by 1E-6. !Engineering notation: Use the following abbreviations for powers of 10: F Femto 1E-15 P Pico 1E-12 N Nano 1E-9 U Micro 1E-6 M Milli 1E-3 K Kilo 1E3 MEG Mega 1E6 G Giga 1E9 T Tera 1E12 Thus 1 megohm could be entered as 1MEG or 1000K. You may also add unit designations after the abbreviation without affecting the value. Do not, however, enter F by itself; 1F is 10-15 (Femto) r Resistors, capacitors, and inductors are handled in a similar manner. You make your selection and then draw the element by clicking the left mouse button. If you hold this button down, you can drag the component to any desired location on the screen. If you click the right button while still holding the left, you reorient (rotate or reflect) the element. After placing the item in the circuit, you must use the keyboard to enter the number of ohms, farads, or henries. Now continue drawing the circuit. Add the 1 nanofarad capacitor and 1 microhenry inductor. Try to position these as best you can. We will be adding the connecting wires later. We now add the pulse source. First click on Pulse Source if you have palette #1 showing. If not, you can pull down the Component menu, select Analog Primitives and then Waveform Sources. When you add this source to the diagram, the attributes box is a bit different. It seems to want you to enter a model statement The model is stored in the program and displayed in the window on the right. For now, if you select the only pulse source stored in the program, you will have the correct model. But suppose you wanted to enter your own parameters. Pull down the Help menu and search for help on Pulse Source. As an alternative, you can click Help in the Attribute dialog box, then Analog Devices, and then Pulse Source. You will see the following: Pulse Source Model Parameters Table Micro-Cap 7, Student Edition: Page 25 Name VZERO VONE P1 P2 P3 P4 P5 Parameter Zero level One level Time delay to leading edge Time delay to one level Time delay to trailing edge Time delay to zero level Repetition period Units Volts Volts s s s s s Default 0 5 1e-7 1.1e-7 5e-7 5.1e-7 1e-6 The waveform value is generated as follows: From 0 p1 p2 p3 p4 To p1 p2 p3 p4 p5 Value vzero vzero+((vone-vzero)/(p2-p1))*(T-p1) vone vone+((vzero-vone)/(p4-p3))*(T-p3) vzero where From and To are time values, and T=TIME mod p5. The waveform repeats every p5 seconds. .MODEL PULSE PUL (VZERO=0 VONE=5 P1=100N P2=100N P3=500N P4=500N P5=1U) The pulse source is a repeating pulse train with parameters as indicated in Figure 17. The pulse goes between voltages of VZERO and VONE, and P1 through P5 specify key times. Try typing the model statement shown above instead of selecting from the model stored in the program. That is, simply change the parameters in the Pulse Source box to PULSE PUL (VZERO=0 VONE=5 P1=100N P2=100N P3=500N P4=500N P5=1U) You should only have had to change two values since most of these agree with the default values. After adding the components, your screen should resemble Figure 18. Micro-Cap 7, Student Edition: Page 26 Figure 18 Now let’s connect the components with wires. Click on the icon for orthogonal (horizontal and vertical) wires and click and drag the mouse. Note that right angle corners are added as needed. When you are finished, the circuit should look like Figure 19. Figure 19 Micro-Cap 7, Student Edition: Page 27 Now try running a transient analysis. Recall that we need node numbers, so pull down the Options menu, select View, and then Node numbers. Then try running the transient analysis by pulling down the analysis menu and selecting Transient. Whoops - you should get an error message. EVERY circuit MUST have a ground. You better add one so the circuit looks like Figure 16. The ground is found in Palette #1, or on the top toolbar, or from Components pull down menu, then select Analog Primitives and then, Connectors. Note that the number of nodes changes from 1, 2, 3 to just 1 and 2. That is because the ground is always node #0. Take note of which node is the output. In our case, it is node #1. Now enter the transient analysis mode. You will probably have correct values in the analysis limits to plot both V(1) and V(2) on the same plot. If you only get one plot, don’t worry at this time. We will discuss the settings in detail in the next chapter. For now, we simply run the analysis to get the output of Figure 20. Now Press F3 to exit the analysis and return to the circuit. Figure 20 Drawing Other Components The Transformer is a passive component. When you select this, you insert a four-terminal transformer model consisting of two inductors with a mutual inductance between them. You are prompted to enter a "define" statement. If you click on "syntax", you will find that there are three parameters. For example, if you enter .01,.0001, .98 you are specifying a transformer with primary inductance of 10 millihenries, secondary inductance of 0.1 millihenry, and a coefficient of coupling of 98% Things start really getting interesting when we work with diodes and active devices. For Micro-Cap 7, Student Edition: Page 28 example, the diode model contains 31 parameters. Try adding a diode and choosing any of the models in the library. Then click on "Edit", and you will see a table of all of the parameters. Many of these parameters can be deduced from data sheets. However, we recommend that you select the part number of the diode closest to the one you plan to use and not worry about creating your own model. The active devices consist of the following 12 possibilities: NPN, PNP, NMOS, PMOS, DNMOS, DPMOS, NJFET, PJFET, Opamp, GaAsFET, NPN4 and PNP4. You add these components to the circuit in the same way as you add passive components (left mouse button and drag, right mouse button to rotate). We now briefly describe each of these. NPN and PNP: Once you add either of these bipolar junction transistors to your circuit, you can select from the list of models stored in the program. If necessary, you can modify the parameters once you make a selection. For example, if you add an npn transistor, the 2N2222A, you can click on Edit and see a display of 54 parameters. As one example, BF is 301.483. This is the forward beta. If you want to change that, simply edit that entry. The following table defines the major parameters for the BJT model. We don't expect you to be familiar with all of these parameters. You would have to read about the computer models used for SPICE to understand all of the details. You should, however, be familiar with some of the major parameters from reading transistor data sheets. NAME Parameter Units Default Value IS Saturation Current A 5E-12 BF Ideal maximum forward beta 200.0 NF Forward current emission coefficient 1.20 VAF Forward Early voltage V 100 IKF BF high-current roll-off corner A 0.1 ISE BE leakage saturation current A 2E-12 NE BE leakage emission coefficient 1.50 BR Ideal maximum reverse beta 2.00 NR Reverse current emission coefficient 1.00 VAR Reverse Early voltage V 0 IKR BR high-current roll-off corner A 35 ISC BC leakage saturation current A 1E-14 NC BC leakage emission coefficient 2.00 NK High Current Roll-Off Coefficient 0.5 ISS Substrate p-n Saturation Current A 0.0 NS Substrate p-n Emission Coefficient 1 RE Emitter resistance 0.5 Micro-Cap 7, Student Edition: Page 29 RB Zero-bias base resistance 0 RBM Minimum RB at high currents RB IRB Current where RB falls by half A 0 RC Collector resistance 1E-3 CJE BE zero-bias depletion capacitance F 4E-11 VJE BE junction built-in potential V 0.7 MJE BE junction grading coefficient 0.5 CJC BC zero-bias depletion capacitance F 3E-10 VJC BC built-in potential V 0.7 MJC BC junction grading coefficient 0.5 XCJC Fraction of BC dep. Cap. To internal base 1 CJS CS junction zero-bias capacitance F 0.00 VJS CS junction built-in potential V 0.75 MJS CS junction grading coefficient 0.00 FC Forward-bias depletion coefficient 0.5 TF Ideal forward transit time S 4E-10 XTF Transit time bias coefficient 0.5 VTF VBC dependence on TF V 10 ITF Transit time dependence on IC A 0.01 PTF Excess phase 0 TR Ideal reverse transit time S 2E-7 EG Energy gap eV 1.11 XTB Temperature coefficient for betas 0.00 XTI Saturation current temperature exponent 3.00 KF Flicker-noise coefficient 0.00 AF Flicker-noise exponent 1.00 NMOS, DNMOS, PMOS, and DPMOS: The letter "D" stands for "discrete" while the absence of a "D" indicates an integrated circuit MOS transistor. The appropriate symbols appear on the screen when you add any of these active devices to your circuit. The library for MOSFETs contains standard entries. The models have 56 parameters. Of these, 42 are from the original SPICE 2G.6 model. We refer you to references for the details. NJFET and PJFET: Adding either type of JFET is done in the same manner as other active Micro-Cap 7, Student Edition: Page 30 devices. The library of JFETs contains 5 standard entries, each of which has a model with 20 parameters. OP-AMPS: The op-amp model library contains 26 standard entries, each of which has 20 parameters. Note that the first parameter is the model level, which can take on one of three values. Level 1 is the simplest model, and it is only uses three parameters. The reason you might want to use one of the lower level models is that the simulation will run faster. Level 2 adds another four parameters to this list and is a three-stage, two-pole model with slew rate limiting, finite gain, and output resistance. Level 3 is an enhanced Boyle model similar to those implemented in other SPICE programs as subcircuits. It uses all 18 operational parameters. The second parameter describes the op-amp type: NPN, PNP or JFET. GaAsFETs: Gallium Arsenide n-channel FET devices are capable of much higher speeds than devices fabricated using silicon. The MESFET is an example of this type of device. The GaAsFET model used by Micro-Cap (SPICE 2G.6 has no model for the GaAsFET) contains 22 parameters. The first parameter specifies one of three possible model levels. There are no models stored in your program, so you will have to create a model if you wish to use Gallium Arsenide devices. Refer to the Help screen for the syntax for the model statement. NPN4 and PNP4 are four-terminal versions of the basic junction transistors. The additional terminal is the substrate. Waveform Sources When you select Waveform sources from the Analog Primitives selection in the Components menu, you are presented with another menu containing eight entries: Battery, Pulse Source, Isource, User Source, Sine Source, V, I, and Fixed Analog. Battery: If you select Battery and then enter the component on the schematic, you are prompted for the battery voltage. Simply enter the battery voltage. Pulse Source: We used this source earlier. The waveform is specified by seven parameters (See Figure 15 presented earlier) as defined below: !VZERO is the zero level, or the initial value of the waveform. The default value is zero. !VONE is the one level, or the pulse height in volts. The default value is 5 volts. !P1 is the delay time in seconds. This parameter models the time delay from time equals zero to the leading edge of the waveform. It can be any non-negative value, including zero. The default is 1.0E-7, or 0.1 µs. !P2 is the time delay to the one level. The rise time is the difference between P2 and P1. Default value for P2 is 1.1E-7, yielding a rise time of 10 ns. You can create an infinite slope by setting P2 equal to P1. !P3 is the time delay to the start of the trailing edge. Default is 5.0E-7 or 0.5 µs. !P4 is the time at which the low value is reached. Fall time is P4 minus P3. Default value is 5.1E-7 yielding a decay time of 10 ns. !P5 is the period of the waveform. Default is 1.0E-6, or 1 µs. Isource: This is a dc current source. You specify the value after drawing the source on the screen. User Source: This is a voltage source that gets its values from a user-defined file in an ASCII Micro-Cap 7, Student Edition: Page 31 text file. This file contains N sequential values representing the waveform at N successive time points. Sine Source: This is an independent voltage source defined by seven parameters. Once you add this, you can choose one of six in the library. You enter the model the same way you did for the pulse source. If you simply enter "General", all seven default parameters will be used as indicated in the following table. Name Parameter Units Default F Frequency Hz 1E7 A Amplitude Volts 1 DC DC level Volts 0 PH Phase Radians 0 RS Source Resistance Ohms 0.001 Seconds 1E-6 Seconds 2.5E-7 RP TAU Repetition period of exponential Exponential time constant V and I: These are independent sources. You can specify pulse, sinusoid, exponential, tabular, or frequency modulated waveform. In addition, you can specify an ac source with a given magnitude and phase for use in ac analysis. We will see an example of this later. The Analog Primitives selection on the Components pull down menu contains four other types of sources, these being Function, Laplace, Z Transform, and Dependent. We briefly describe these next. Function Sources: When you select function sources, you are presented with another menu containing six entries. These are NFV, NFI, NTVofI, NTIofI, NTIofV and NTVofV. The function source can be specified either by an algebraic formula (NF) or by a table of values (NT). The formula type function source uses an algebraic formula to compute the value of the output variable as a function of any set of time-domain variables. The source can be either current or voltage, designated as NFI or NFV respectively. The available functions are summarized below: P(X,Y,Z) E(X,Y,Z) Power flowing into a circuit section. X, Y, and Z are nodes. There must be a resistor or inductor between nodes X and Y. This is needed to measure the current. The current is multiplied by the voltage drop between nodes Y and Z. Energy flowing into a circuit section. T Transient analysis simulation time. F Real ac analysis frequency value (in Hz.) S Complex radian frequency = 2jF + Addition - Subtraction Micro-Cap 7, Student Edition: Page 32 * / MOD Division Modulus SIN(x) Multiplication COS(x) Sine function (x in radians) Cosine function (x in radians) TAN(x) Tangent function (x in radians) ATN(x) Arc tangent function SINH(x) Hyperbolic sine COSH(x) Hyperbolic cosine TANH(x) Hyperbolic tangent Hyperbolic cotangent COTH(x) LN(x) Natural log LOG(x) Base 10 log EXP(x) ex ABS(x) Absolute value DB(x) Decibels D(x) Delta, or change. A derivative can be formed as a ratio of two deltas. SQRT(x) Square root SGN(x) +1 if x>0, -1 if x<1 or x=0 ^ Exponentiation operator AND AND operator XOR Exclusive OR operator NOT Negation operator OR OR operator Laplace Sources: When you select this item, you are presented with another menu containing eight entries, each beginning with "L" for Laplace. These are LFIofV, LFIofI, LFVofV, LFVofI, LTIofV, LTIofI, LTVofV and LTVofI. These represent controlled sources where the source and the controlling variable can be either voltage or current. This yields four possible combinations (for example, voltage-controlled voltage source, current-controlled voltage source). Each of the four possibilities has two types of sources: those specified by a formula and those specified by a table. The formula sources contain an "F" in the specification, while tabular sources contain a "T". The formula sources can be used to simulate a transfer function. For example, if you Micro-Cap 7, Student Edition: Page 33 specify the formula (after adding LFVofV source to the diagram. The formula is entered in the "Value" box) as 1/(1+.001*s), your controlled source acts as a first-order lowpass filter with 3dB cutoff frequency at 1000 radians/sec (159 Hz). Figure 21 shows the circuit for this function. Figure 22 shows the frequency response plot that results. Note that we have a generic sinusoidal source, where we have specified default parameters. The plot was produced using the ac analysis program, which we describe in Chapter 4. Figure 21 Micro-Cap 7, Student Edition: Page 34 Figure 22 Z Transform Sources: These sources are mapped into their equivalent Laplace sources with the transform of exp(S/FC) where FC is the clock frequency. The Z transform sources are used to handle Z transform expressions. <fexpr> defines the Z transform expression, and it must contain at least one instance of the variable Z. <freq> is the frequency at which the Z expression is sampled. 1/<freq> is equivalent to the sampling period. This device lets you model anything from a simple delay device to a complex digital filter. These sources come in four configurations as follows: ZIofI Current dependent current source ZIofV Voltage dependent current source ZVofI Current dependent voltage source ZVofV Voltage dependent voltage source You need simply enter the z transform expression [e.g., z/(z-1)] Dependent Sources: When you make this selection, you are presented with eight choices: IovV, IofI, VofI, VofV, HVOFI, GIOFV, FIOFI, EVOFV. The first four are conventional dependent sources. If you add one of these to the diagram, you are prompted to enter the proportionality constant for that source. For example, if you select VofV and enter 5, the controlled source voltage is five times the voltage at the input nodes. The last four entries (preceded by E, F, G, and H) are SPICE polynomial-dependent sources. If you are familiar with the SPICE device statements, the conversion to MICRO-CAP is simple. The syntax is identical. If you are not familiar, you probably will not need the sources for the course you are taking. Micro-Cap 7, Student Edition: Page 35 Connectors: If you select Connectors from the analog primitives, you are presented with 5 entries: Ground, Tie, Jumper, Jumper 2, and jumdiag1. Ground: This entry is used to draw a ground. If you hold down the left mouse button, you can drag the ground around the screen to any desired position. While holding down the left button, you can reorient the ground by clicking the right button. Every circuit must have a ground before you run a simulation. Tie and Jumper: When two lines cross in Micro-Cap a drawing, it is assumed that a connection exists between the two lines. It would therefore seem necessary to make a two-dimensional drawing of the circuit without any intersecting lines (unless they are to be connected). As circuits become more complex, it is not possible to make such a planar drawing. We need ways to cross lines without making an electrical connection. Jumper is used whenever lines that are not electrically connected intersect. You add this component and position the loop to lie over the second line. Two different length jumpers for horizontal or vertical placement in the circuit, and one for diagonal placement are available. Sometimes points that are widely separated must be electrically connected. We could do this by drawing lines connecting the point, using jumpers when necessary. However, this may clutter the diagram unnecessarily. The Tie selection provides a simple alternative. You use it to mark the two points with any identical label. They are then electrically tied together. You position the arrow over one of the points and click the mouse. Then you type the label. You repeat the operations for the second point. You can do this for any number of points. SMPS: This entry produces various subcircuits. Miscellaneous: The next entry in the Analog Primitives submenu is labeled Miscellaneous. It contains a submenu with seven entries: Sample and Hold, S(V-Switch), Switch, W(I-Switch), Arrow, Bubble1 and Bubble2. The Arrow and Bubble entries are included to illustrate that you can define a variety of shapes to suit your particular applications. These particular shapes are included as drawing tools to make your circuit diagram more complete. We describe only the basic Switch and refer you to help screens for the other entries. Three types of switches can be used in circuits: current-controlled, voltagecontrolled, and time-controlled. If you use a current-controlled switch, you must insert an inductor across the input nodes of the switch. Voltage-controlled switches are controlled by the voltage across the two input nodes, while time-dependent switches use the time variable, In all cases, the open switch is represented by a high resistance, ROFF, while the closed switch is represented by a low resistance, RON. Switches are used only in transient analysis. After you draw a switch, you are prompted to type in the value. This is done in the following format: S,N2,N2 S is the controlling parameters (I for current-controlled and V for voltage-controlled and T for time-controlled). N1 and N2 are threshold values of the controlled parameters between which the switch changes state. You can simulate either a normally open or normally closed switch, depending on whether N1>N2 or N2>N1. If N2>N1, the switch is normally open, and it closes when the parameter is between N1 and N2. If N1>N2, the switch is normally closed, and it opens when the parameter is between N1 and N2. Micro-Cap 7, Student Edition: Page 36 S Two Port gives a way of modeling devices using s-parameters. Editing Schematics Now that you know how to draw a schematic using the various tools and components available to Micro-Cap 7, we are ready to see how to modify the diagram. This is done by using the Edit pull-down menu accessed from the Schematic Editor window. When you pull down the Edit menu, you are presented with the following choices, some of which should already be familiar to your from other software: !Undo: Undo reverses the last change. !Cut: Deletes the selected objects and copies them to the clipboard. !Copy: Copies selected objects to the clipboard. !Paste: Copies contents of clipboard starting at current cursor position. !Clear: Deletes the selected items without copying to clipboard. !Select All: Selects all objects in current window. !Add Page: Adds new page to schematic !Delete Page: Deletes one of more schematic pages !Add Model Statements: Places model statements in the text area for any parts that don't have one. It searches through all model libraries including the default. If it fails to find the part model, it places a default model statement in the schematic text area. !Box: These commands affect objects enclosed in a box you select. You can step contents vertically or horizontally, you can create a mirror image of the contents, you can rotate, or flip the entries. !Change: Allows you to change attribute display, including color and font !Bring to Front: A mouse click on a stack of overlapping objects selects the front object in the stack. If the front object isn't the one you want, a method is needed to select another object from the stack. This command makes the selected object the front object and thus accessible to clicking. !Send to Back: Selected object moves to back. !Find: Invokes Search menu which is used to search the front window for a variety of objects (text, parameters text, grid text, node numbers, components) !Replace: Conducts a search and replace for text in a text window or the schematic text area. Micro-Cap 7, Student Edition: Page 37 Chapter 3 TRANSIENT ANALYSIS INTRODUCTION If you have gone through Chapter 2, you are now an expert at drawing any circuit on the monitor. The next three chapters explore the various forms of analysis you can perform using Micro-Cap 7. Transient analysis is used to plot time waveforms at various points in the circuit. It involves generating a new set of equations dynamically for each time point, solving these equations, printing and graphing the solutions, and setting up a new set of equations whose content depends on the prior solution. Transient analysis evolves from the state space approach, which you may have been exposed to in your systems courses. You begin by drawing a circuit, either by entering each component as described in Chapter 2, or by retrieving a network from the data file. We illustrate transient analysis using the Differential Amplifier circuit that is one of the files already stored in the program. If you currently have any circuit in the Schematic Editor window, close it using the File pull-down menu. Then recall the differential amplifier file from memory by using the File pull-down menu from the main (top) menu bar, selecting Open, and then loading "DIFFAMP.cir" (you can scroll down to diffamp using the mouse or arrow keys, or type "d" to jump down to the first entry starting with the letter d). The screen should look like Figure 23. Figure 23 Once you have the network on the screen, initiate the analysis by pulling down the Analysis menu, and selecting Transient analysis. Alternatively, you can use the keyboard by typing the Micro-Cap 7, Student Edition: Page 38 hot key (identified on the pull-down menu) by simply pressing "ALT+1" After you initiate the transient analysis, you are presented with the Transient Analysis Limits window. This is shown in Figure 24. We begin this tutorial with a discussion of this analysis limits window. We then discuss each of the menu selections in the transient analysis. Figure 24 TRANSIENT ANALYSIS LIMITS After activating the transient analysis, you are presented with a window showing limits used in the analysis. When you store a circuit, the selected limits are stored with it. If you create a new circuit, default limits are used until you choose different values. The limits stored in the differential amplifier circuit are shown in Figure 24. If you wish to change any of the analysis limits, click the mouse on that limit, and then type in the new value. We now describe each field in this window. However, if you are impatient to see an analysis run, you can simply click on Run (or press the F2 function key). Numeric limits fields: The upper portion of the window contains a field with four entries. Time range: This is used to specify the time over which the simulation is performed. You can specify two parameters: The starting time (tmin) and the ending time (tmax). The format for simulation time is "tmax[,tmin]". When we specify input parameters, the terms in square brackets are optional. If they are omitted, the default values are used. The default value for tmin is zero. You are not permitted to specify negative values for either of these times. The example of Figure 24 shows a time range of 10us. This means the simulation runs from time 0 to 10 microseconds. We could have specified the same range by entering "10us,0". Maximum time step: Micro-Cap 7 simulates operation of a circuit by stepping in time. Each time the program calculates parameters, these are compared with the previous calculation. If a circuit contains capacitance or inductance, the program monitors the time rate of change of the charge and flux. Internal algorithms control the size of this derivative. If it is too large, the time step is decreased. If it is too small, the time step is increased up to the specified maximum. The internal algorithm controls accuracy of the results. If the maximum time increment is too large, Micro-Cap 7, Student Edition: Page 39 the resolution suffers, while if it is too small, the program takes a long time to run. You can often smooth a resulting curve by reducing the maximum time step. The default value for the time step is (tmax-tmin)/50. This means that 50 iterations are performed over the length of the simulation. The program uses the default value if you either leave the field blank on the Analysis Limits window, or if you enter zero for the maximum time step as we have done in this example (clearly if the program ran with a zero time step, you would have to wait forever for a single plot to develop). Number of points: This specification is used for numeric output (i.e., a table, as opposed to a graph). It sets the number of points to be printed (number of rows in the printout table). The default value is 51 that corresponds to the default value for the time step. If the specified points do not fall directly on values used in the iteration, the printed value is interpolated from calculated values. Temperature: Temperature enters into the parameter equations for devices and components. One or more temperature values (in degrees Celsius) can be specified for the analysis. The format is: High [,Low[,Step]]. The square brackets indicate you can omit Step, or you can omit both Low and Step. The default value for Low is High while the default value for Step is the difference between High and Low. Therefore, if only one value is specified, the simulation runs at that temperature. If two values are specified, the simulation runs at those two values, the Low and High temperatures. For example, "27,25" runs the simulation twice, once at 25 and once at 27 degrees centigrade (27o is room temperature). An entry of "35,20,5" runs the simulation at 20, 25, 30 and 35 degrees. The "Linear" to the left of the parameter means that the temperature is stepped in equal increments. Waveform options fields: We now turn our attention to the wide table occupying the lower half of the Analysis limits window of Figure 24. The table contains four waveform option buttons in addition to five columns. Each row in this table represents a plot on the resulting graph. Linear/Log: The first two buttons toggle the x axis and y axis between linear and log scale. Try clicking on these and see what happens. Notice that the markings on the button change from linear to log and back again. Of course, if you choose a log scale, the scale ranges must be positive numbers. Color Menu: The third button, the solid color button, takes you to the color menu. Numeric Values: The fourth button controls the table option. When pressed, a table of numeric values is printed. The remaining five columns specify details of the waveform. These are described below: P: When several variables are plotted, we have a choice of superimposing the plots on the same set of axes, or having them appear on separate non-overlapping graphs. The numeric entry in the P column is a number from 1 to 9. This indicates to which group the particular waveform is assigned. If you use the same number for several rows, these waveforms are plotted on the same set of axes. If the ranges are not the same, the plot uses the union of the individual ranges. Micro-Cap 7 analyzes equations independent of units. For example, a plot Micro-Cap 7, Student Edition: Page 40 with a range from 0 to 1 could be used for a voltage curve ranging from 0 to 1 volts, and simultaneously for a current curve ranging from 0 to 1 amps. The example of Figure 24 creates two curves plotted on two separate sets of axes. If we wanted the two curves superimposed, we would assign the same P number to both. Expression fields: The remaining four columns relate to the expressions to be plotted. You can see choices by first clicking the item with the left mouse button, and then clicking the right mouse button. X Expression: This field specifies the expressions for the X-axis variable. In most cases, this is a time variable, but it could be another parameter. For example, you may wish to plot a hysteresis curve, in which case the X expressions may be an input voltage. Y Expression: This field specifies the expressions for the Y-axis variables. These may be simple voltages or currents, or they could be more complex math expressions such as power. For example, we might have an electronic circuit where we plot V(VCC)*I(VCC). If VCC is the label assigned to the DC source, this plot represents the power flow from the source. Alternatively, you could plot the output/input voltage ratio in decibels by specifying DB(VOUT/VIN), where we assume you have labeled the input voltage as VIN and the output as VOUT. The section on Function Sources in Chapter 2 summarizes the various functions and equations available in Micro-Cap 7. We will not repeat that list here, but we do take a moment to list the variety of variables you can specify (we are restricting our attention to analog variables for now). V(A) The voltage at node A. If the node is not labeled, you can use its number. V(A,B) Voltage at node A minus voltage at node B. V(D) Voltage across the device called D. I(D) Current through the device called D. T Time F Frequency (in Hz.) S Complex frequency = 2*B*F*j V(A)*I(A) Power Note that in the example of Figure 24, we plot two expressions, V(a,b) and V(Outa,Outb). These represent differential voltages between pairs of nodes. The nodes are labeled on the schematic of Figure 23. Signal Processing Functions: Micro-Cap 7 can perform a variety of signal processing functions. In specifying the Y expression for plotting, you can choose any of 12 different processing functions. These are listed below. FFT(X) Forward Fourier transform of waveform X IFT(X) Inverse Fourier transform of spectrum X CONJ(X) Conjugate of spectrum X CS(X,Y) Cross spectrum of X and Y = CONJ(FFT(x)*FFT(y)) AS(X) Auto spectrum of spectrum X = CS(x,x) CC(X,Y) Cross correlation of waveforms x and y = IFT(CS(x,y)) Micro-Cap 7, Student Edition: Page 41 AC(X) Auto correlation of waveform x = IFT(CS(x,y)) COH(X,Y)Coherence of waveforms x and y = CC(x,y)/sqr(AC(x(0)*AC(y(0))) REAL(X) Real part of spectrum X produced by FFT IMAG(X) Imaginary part of spectrum X produced by FFT MAG(X) Magnitude of spectrum X produced by FFT PHASE(X)Phase of spectrum X produced by FFT You can gain familiarity with some of these functions by experimenting with the circuits stored in your program. In particular, FFT1.CIR demonstrates the use of some functions in transient analysis. You should experiment with that circuit and plot the various FFT parameters as you vary the length of the time interval. See if this agrees with what you learned about FFT in your Digital Signal Processing course. X range: This sets the scale ranges for the X waveforms. The format is "High[,Low]". In our example, we have a single entry, 1E-5. This means that X runs from 0 to 10 microseconds. Note that this matches the time range of the simulation. You can enter "auto" for this field and Micro-Cap 7 automatically sets the range. Enter "auto" by placing the cursor on the appropriate field and typing auto. We give a faster way to enter auto in the next section (if you can't wait, just look directly above the "Y Expression" column heading). The range must be a subset of the simulation time. That is, you cannot plot a response for a range of values if the simulation was not performed for that range. If you use the "auto" entry, the program must run the entire simulation prior to setting the plotting range. You will not see the result plotted in real time. Y range: Same as X range, except for the Y variable. You can enter "auto" for this field, and Micro-Cap 7 automatically scales the range so the plots fill the graph. The upper right portion of the Transient Analysis Limits window contains some additional choices. You have three choices for "Run Options". These are Normal (runs simulation without saving to disk), "Save" (runs simulation and saves to disk) and "Retrieve" (loads previously saved simulation and plots and prints as if it were a new run). You also have three choices for state variables, depending on whether you want to set initial values to zero, read values from a file, or use the values at the end of the last run. This leaves three more boxes on the window: Operating Point: This calculates a dc operating point. Operating Point Only: This calculates a dc operating point only, and does not run the analysis. Auto Scale Ranges: This does the same thing as entering "Auto" for the ranges. It sets the X and Y range to whatever is necessary to display the entire waveform. Once you are satisfied with the analysis limits, you are ready to run the analysis. Run the analysis by clicking the Run button in the upper left corner of the screen. The transient analysis is produced, as shown in Figure 25. You can stop the simulation at any time by pressing the ESC key. Micro-Cap 7, Student Edition: Page 42 Figure 25 Note that we have plotted two waveforms on the two graphs of Figure 25. You can play around with the table in the transient analysis limits screen to plot in various formats. To get back to this screen following the run, either pull down the Transient menu and select Limits, or press F9. Then try changing the second table line by changing P=2 to P=1. Run the simulation and see what happens. You can add a third plot either by typing the new line, or copying and modifying an existing line. For example, if you click next to the P=2 entry on the second line and then click Add at the upper left, a third line is added which is a duplicate of the second line. If you click Delete, that line is removed. Now let's look at the screen of Figure 25. Below the title bar for the Transient Analysis window are three pull-down menus: Transient, Scope, and Monte Carlo. We now discuss each of these. TRANSIENT ANALYSIS MENU Once you select transient analysis from the Run menu, you can pull down the Transient menu either with the mouse, or by pressing "Alt+T". The menu contains 11 selections. Run Limits Stepping Optimize Analysis Window Watch Breakpoints Numeric output State Variables Editor Micro-Cap 7, Student Edition: Page 43 DSP Parameters Reduce Data Points Run: You select this menu entry to run the simulation without changing the analysis limits. Limits: This opens the Analysis Limits window so you can change limits. The Analysis Limits window is automatically opened when you select Transient analysis from the Run menu, so you access this from the Transient Analysis menu only if you wish to make changes following a simulation run. Stepping: Component parameters may be stepped from one value to another, producing multiple runs with multiple output waveforms. You activate this feature by selecting Stepping from the Transient menu and then entering instructions in the dialog box. The dialog box for the differential amplifier example is shown in Figure 26. Figure 26 Step What: This is where you specify which parameter you wish to step. For example, if you named one or more resistors "R1", you would enter R1 to step their values. In the case of stepping device parameters, you enter the device name on the first line, and the parameter you wish to vary on the second. The arrows to the right permit you to select from choices. In the differential amplifier example, we are stepping the forward beta of the transistor labelled N1 (see model statement on the original circuit, Figure 23), so we enter NPN N1 for the component (or select it from the list that results when the arrow is selected), and BF for the entry on the next line. (Case makes no difference to Micro-Cap 7 so don't be concerned if your screen shows npn n1 instead of NPN N1) Limits: From specifies the starting value of the parameter. To specifies the ending value of the parameter. Step Value specifies the amount by which to step the parameter. In our example circuit, we are varying the beta of transistor 1 from 100 to 350 in steps of 50. Before continuing with our analysis of the Transient pull-down menu entries, let's run this stepping example. Move to the "Step it" radio buttons below the step value, and select "Yes" (Figure 26 shows "No"). Note that the steps are linear and we are changing a parameter in the transistor model. Also note that you can do a nested stepping of a second parameter, but we Micro-Cap 7, Student Edition: Page 44 will not select "Yes" for this stepping operation. Click "OK". Then either pull down the transient menu and select "Run", or simply press F2. The simulation now produces a family of 6 curves. These are for beta values of 100, 150, 200, 250, 300 and 350. We now return to entries in the Transient pull-down menu. Optimize: The optimizer systematically changes user-specified parameters to maximize, minimize, or equate a chosen performance function, while keeping the parameters within prescribed limits and conforming to any specified constraints. Analysis Window: This selection gives you the opportunity to change plot characteristics such as the line width. Watch: This displays the Watch window where you define expressions or variables to watch during a breakpoint invocation. Breakpoints: This accesses the Breakpoints dialog box. Breakpoints are Boolean expressions that define when the program will enter single-step mode so that you can watch specific variables or expressions. Typical breakpoints are T>=100ns AND T<=10ns, or V(OUT)>5.5. Numeric output: If you have enabled the fourth waveform option button (associated with a particular plot in the Transient Analysis Limits menu), the numeric output is available as soon as you run the simulation. You access this numeric output table from the Transient pull-down menu. State Variables Editor: This command activates the State Variables Editor. You use this after you run the simulation. The editor is used to view and edit node voltages and inductor currents. The editor for the differential amplifier example is shown in Figure 27. We are showing this for the case where we DO NOT step transistor beta. The figure shows eight node voltages. Our differential amplifier circuit does not contain any inductors, so the right portion of this editor window is blank. Micro-Cap 7, Student Edition: Page 45 Figure 27 You normally do not change these values unless you want to explore the effects of an initial condition variation. There are two other selections in the pull down menu, DSP Parameters, and Reduce Data Points. We will not be using these in this basic introduction to Micro-Cap 7. However, you can get details on any function by simply clicking on "Help". This generally gives you the text from the professional version manual. SCOPE MENU The Scope pull-down menu, which can be accessed after a simulation is run, is used to select various scope commands. The menu provides you with a number of options regarding the display. Our suggestion is that you experiment with this and use the Help screens if you run into difficulty. Of particular interest is the cursor mode that allows you to place cursors on the plots. Once you place a cursor, you can drag it with the mouse. The text below the plot shows the numerical values at the cursor points. The cursor function selection allows you to set cursors at key points on the curve, such as Peak, Valley, High, Low, and Inflection. Peak and valley are Local maxima and minima, while high and low are the global maximum and minimum. The Inflection mode locates points where the second derivative of the waveform goes through zero (changes sign). [NOTE: We hope you are trying these operations for the differential amplifier example. If you are doing so and thinking about what you are seeing on the screen, you are probably thinking that the High and Low are yielding the opposite of what you expect. However, keep in mind that V(a,b) is negative, so the high values are at the bottom of the graph and the low values are at the top. Additionally, since the output curve for this example asymptotically approaches the steady state values, it is not a good example to illustrate the use of Peak and Valley. You may Micro-Cap 7, Student Edition: Page 46 get some incorrect answers due to roundoff error in the process of comparing adjacent slopes.] PROBE PROBE is a powerful tool that allows you to view waveforms at various points in the schematic, just as you would use a probe from a laboratory oscilloscope. PROBE performs the transient analysis, saves the entire analysis in a disk file, and then allows you to probe points in the circuit. PROBE functions like a normal simulation, but you need not specify in advance which outputs you wish to plot. Let's continue working with the differential amplifier schematic. Exit any run that you are currently in (press F3), and you should have the schematic on the screen. If you are just starting, load the differential amplifier schematic. Before running the simulation, pull down the Analysis menu and select Probe Transient Analysis. This places you in the probe mode. The program runs the simulation, which may take a while since your computer is doing more work than it does to plot one or two variables. After the run, click on any component with the mouse. We have selected resistor R4. Your display should look like Figure 28. Figure 28 The circuit (or part of it) is on the right, and a transient analysis plot is on the left. We now describe four of the pull-down menus, Probe, Vertical, Horizontal, and Scope. The Probe pull-down menu contains eight entries: New run: Probe stores results in data files on the disk. These files are named CIRCUITNAME.TSA. If you have not changed the circuit since the last PROBE run, the program does not rerun the simulation when you go to the probe mode. If you have changed the circuit, the program detects this and performs a new run. If you have not changed the circuit, but still wish to have a new simulation (e.g., suppose you changed a component model), you Micro-Cap 7, Student Edition: Page 47 select New run from the Probe menu. Limits: Gives the transient analysis limits. Add Curve: This allows you to add the plot of another parameter to the already existing graph. You are prompted to type the name. For example, if you type V(R1), you will plot the voltage across resistor R1. Delete Curves: This option lets the user remove a single waveform from the plot by selecting it from a scrollable list. Delete All Curves: This option removes all waveforms from the plot. One Curve: This command selects the single trace mode. When a new waveform is selected, it replaces the previous one. Many Curves: This command is used to select multiple traces for the Probe waveform display. Up to six waveforms can be displayed. As you probe various points, the new waveforms are added to the diagram. If you have multiple waveforms with widely varying ranges, this option may make it difficult to read the smaller waveforms since the vertical axis will scale for the largest waveform. In such cases, you may wish to select the One Trace option. Save All: This command causes all Probe variables to be saved. Save V&I Only: This causes only voltages and currents to be saved during the save run. If these are the only variables you will wish to probe, this option will speed things up and save disk space. The Vertical and Horizontal pull-down menus contain identical entries. These are used to determine the variables, operators, and scale types (log or linear) used for the horizontal and vertical axes. If you have selected Save V&I Only in the Probe menu, many of the selections will not be available to you (i.e., only the voltage or current can be selected for display). If you have saved all variables, you can choose to display: Voltage Current Energy (displays energy curves) Power (displays power curves) Resistance (displays the resistance when mouse is clicked on a resistor) Charge (displays charge when the mouse is clicked on a capacitor) Capacitance (displays capacitance associated with the charge) Flux (displays flux when the mouse is clicked on an inductor) Inductance (displays inductance associated with the charge) B field (displays B field when the mouse is clicked on a core) H field (displays H field when the mouse is clicked on a core) Time (usually selected for horizontal display) If you have selected Many traces from the Probe menu, you can click additional nodes and superimpose up to 6 waveforms. Micro-Cap 7, Student Edition: Page 48 In addition to node voltages, you can also select lead-to-lead voltages. First remove all waveforms using the Probe pull-down menu and selecting Delete All Plots, or by pressing the Cntrl+F9 function key. Then position the cursor midway between the base and collector of the left Q1 and click the left mouse button. You will then plot either VCB or VBC, depending on whether the cursor was closer to the base or closer to the collector. The result is shown in Figure 29. Figure 29 If a portion of the circuit extends beyond the visible region, you can scroll the circuit using the right mouse button. PROBE is a very powerful tool in debugging circuits. If the output is not what you expect it to be, you can often determine the cause of the discrepancy by probing intermediate points in the circuit. MONTE CARLO ANALYSIS In the real world, circuits do not behave in the simple manner one assumes in an elementary circuits or electronics course. For example, a 100 ohm resistor is never exactly 100 ohms, but may have a value that varies over a range from about 90 to 110 ohms. The same is true of the parameter values for electronic devices. For example, the beta of a transistor has a certain tolerance associated with it. In a paper design, one often uses "worst case" analysis where parameter values are set at the appropriate extreme of the tolerance ranges (i.e., the end of the range which yields the "worst" results). Comprehensive probability analysis of circuits is complicated by non-linear operations. As an example, suppose you know that the beta of a transistor has a certain mean value, and is Gaussian (normal) distributed around the mean. To see the effects of this random distribution on an output parameter, you have to track probability distributions through each Micro-Cap 7, Student Edition: Page 49 portion of the circuit. As soon as you come to a non-linear operation, your theoretical analysis comes to an abrupt halt. The computer opens up an exciting possibility in this area. It can randomly set parameters within the tolerance limits, and run the simulation many times compiling a family of output curves. The family of curves can then be examined to generate statistics of any output parameter. If enough simulation runs are performed, the "law of large numbers" indicates that we generate an approximation to the probability distribution of the output variables. This is the essence of Monte Carlo analysis, the name deriving from the probabilities that apply to gambling. During Monte Carlo analysis, multiple runs are performed. For each run, a new circuit is generated from components whose numerical parameter values are randomly selected. The selection process is based upon user-specified parameter tolerances and specified distributions within these tolerances. The display of the outputs is both in the form of multiple superimposed curves and histograms displaying statistical data. We begin by running a simple example, and then follow up with detailed descriptions of the various functions. We will abandon our differential amplifier example used so far in this tutorial since the circuit specification does not contain any component tolerances. Instead, press the F3 function key to exit the simulation, then close the differential amplifier and open the schematic called CARLO.CIR from the file. The circuit is shown in Figure 30. Figure 30 Before we printed this circuit, we displayed node numbers on the figure. We did this by either pulling down the Options menu, selecting Viewing and then Node Numbers, or by simply clicking on the icon in the second row with the picture of a component and a node number. These node numbers are needed to identify the plotted parameters since we have not labeled the nodes with names. If you now run the transient analysis you are presented with the Transient Analysis Limits Micro-Cap 7, Student Edition: Page 50 window as shown in Figure 31. Figure 31 Note that two variables are to be plotted, V(1) and V(2). Since the P entry on the Transient Analysis Limits window is 1 for both variables, they will be superimposed on the same set of axes with a Y variable range of -3 to +7 volts. The stored circuit has enabled Monte Carlo analysis. That is done from the Monte Carlo pull-down menu, selecting Options, and clicking the On radio button. Figure 32 shows the Monte Carlo Options menu. Figure 32 We will be discussing this in detail in a few moments. For now, note that 100 runs will be performed. Activate the simulation either by selecting Run from the Transient menu or by pressing the F2 function key. The simulation runs 100 times. The result is shown in Figure 33. 100 curves for V(2) are drawn superimposed on each other. Micro-Cap 7, Student Edition: Page 51 Figure 33 Now pull down the Monte Carlo menu and select Histograms; then Add Histograms. This produces Figure 34. You should see an entry of the form, Risetime[V(1),1,1,1,2]. Then click OK, and you will see a screen similar to Figure 35. Figure 34 Micro-Cap 7, Student Edition: Page 52 Figure 35 Our selection of Rise_Time in the Add Histogram mode (Figure 34) means we are plotting the distribution of the amount of time it took the waveform to rise from the low value of 1 to the high value of 2 (note that this represents only the beginning portion of the rise). The histogram shows that for 19 of the trials, the rise time as between 10.94 ns and 11.08 ns. Similarly, 20 of the trials had rise times between 11.08 ns and 11.22 ns. You may have learned in your probability course that the outline of this histogram should theoretically follow a Gaussian density function. The numbers at the top of each bar represent the percentage of results falling in the corresponding range (with 100 runs, it is also the number of outcomes). 100 runs is not sufficient to develop the true probability distribution of the output. We reran this for 1000 runs, with the result displayed in Figure 36 (see next page). The result approximates a Gaussian curve with mean value of 11.05 nsec and standard deviation of 0.32 nsec (we are reading these from the bottom of the figure). The bar to the right of the histogram lists every one of the outcomes. This concludes the simple example of Monte Carlo analysis. Now that you have experienced the excitement of this powerful tool, we take an organized look at the various functions and features. Tolerances Before you can run a Monte Carlo analysis, you need to specify tolerances for the devices and components in your circuit. In the case of components, the tolerance is applied to the numeric parameter (e.g., ohms, farads). You can specify tolerance as an actual value or as a percentage of the nominal value. Absolute tolerances are specified using a LOT statement. The form of specification is LOT=X[%]. As an example, suppose a resistor is labeled as R1 and it is nominally a 10 kohm Micro-Cap 7, Student Edition: Page 53 Figure 36 resistor. The tolerance is 5%. Since 5% represents an actual tolerance of 500 ohms, you have a choice of either of the following specifications for the resistor. We are using a .DEFINE statement which you place anywhere on the screen. ".DEFINE R1 10K LOT=500 5 " or ".DEFINE R1 10K LOT=5% 5 " In the case of components, you can also specify tolerances directly on the schematic as you label the parameter values. Thus, for example, when drawing the resistor on the circuit, you could enter its value as "10K LOT=5%". The same approach is used to apply tolerances to device parameters. For example, suppose transistor Q1 is an NPN transistor with a nominal beta of 100 and tolerance of 20%. The .MODEL statement you type would read, ".MODEL Q1 NPN (BF=100 LOT=20%)" The forward beta then ranges from 80 to 120. If there are several transistors labeled Q1, the program selects a beta for each run and applies it to all Q1 transistors. Absolute (LOT) tolerance applies to all components or devices given the particular name. You can also specify a relative tolerance, where the lot tolerance, if any, is applied to all of the similarly named devices, and then the relative tolerance is applied to each individual device. To do so, you use DEV in the same way you used LOT. If there is only one device with the particular label, it does not matter which designation you use. Suppose, for example, that the absolute tolerance of the beta of our transistor is 10% (i.e., an entire lot can be expected to have a beta between 90 and 110) and the relative tolerance is 1% (within the lot, the variation is "1% of the lot value). The .MODEL statement then reads, ".MODEL Q1 NPN (BF=100 LOT=10% DEV=1%) 5 " Micro-Cap 7, Student Edition: Page 54 Probability Distributions During the simulation runs, the program randomly adds or subtracts a delta value to the nominal value. The probability of adding a particular delta value depends upon the specified probability distribution. Three distributions are available: Worst case, Linear, and Gaussian. In the Worst case distribution, the delta value is the full tolerance value. Thus, for example, if the only circuit device with an associated tolerance were transistor Q1 with a nominal beta of 100 and tolerance of 10%, beta would only take on two values during the various simulations, either 90 or 110. There would be a 50% probability of the value being either of these two numbers. If more than one component or device has an associated tolerance, various combinations of the extreme values would occur during subsequent simulation runs. In a Linear distribution, the value of delta is uniformly distributed within the tolerance range. All values within the range are equally likely. In a Gaussian (or Normal) distribution, the value of delta is Gaussian distributed within the tolerance range. Since the Gaussian probability density does not go identically to zero, and values of delta outside the tolerance range are not permitted, we use a truncated distribution. The default value for standard deviation is the tolerance/2.58. Therefore, the extreme values represent 2.58 standard deviations away from the mean. Using this value, the delta is within the tolerance range 99% of the time. You can specify a standard deviation different from this default value by using the Global Settings menu. You may wish to do this if you have detailed manufacturer specifications. Suppose, for example, the supplier of the device guarantees that 95% of all resistors fall within a specified tolerance. Reference to tables of Gaussian densities (error function tables) indicate that you should set the standard deviation so that the tolerance represents 1.96 standard deviations. Before going further, let's change the distribution from Gauss to Worst case. Run the simulation, and you will get the result of Figure 37. Micro-Cap 7, Student Edition: Page 55 Figure 37 Although the simulation runs 100 times, only four distinct curves result. Think about this! If you examine the circuit, you find that only two components have tolerances associated with them. The inductor has a nominal value of 1 microhenry. Applying the tolerance, it has an inductance of either 0.9 uh or 1.1 uh. The capacitor has a nominal value of 1 nf, and worst case tolerance values of 0.9 or 1.1 nF. All simulations run using inductor values of either 0.9uh or 1.1uh, and capacitor values to 0.9nF or 1.1nF. Thus there are only four combinations of parameter values. This leads to a total of four curves. DIGITAL ANALYSIS Micro-Cap 7 handles mixed analog and digital analysis. Producing a timing diagram for a digital circuit is identical to producing a transient analysis run for an analog circuit. Digital components are entered from the components menu, and Micro-Cap 7 contains a library of many digital circuits. We illustrate transient analysis using the decoder circuit. Simply open decoder.cir . Your circuit will look like Figure 38. We are simply feeding a four bit counter into a 74145 decoder chip. If you study the data sheets for this chip, you find that only one output is high depending on the input. If, for example, the input is a binary 3 (0011), output number 3 is high and the others are low. Let's run a transient analysis. Selecting Transient from the Analysis pull-down menu presents the Transient Analysis Limits window, as shown in Figure 39. Notice we are plotting all 14 pin waveforms, and instead of plotting voltage, we are using d( ) [recall that the program is not case sensitive so d( ) is the same as D( )]which plots the digital state waveform. Since this circuit is entirely digital, we could not use V( ) expressions (try it). We then run the analysis to obtain the result shown in Figure 40. Micro-Cap 7, Student Edition: Page 56 Figure 38 Micro-Cap 7, Student Edition: Page 57 Figure 39 Micro-Cap 7, Student Edition: Page 58 Figure 40 This is a classic timing diagram of the type that might be found in a data sheet. Note that the model in Micro-Cap 7 is not ideal. The output waveforms are delayed about 25 nsec (you can use the cursor to measure this delay). If you want another good example from the circuits on your disk, we suggest you try the circuit called Counter2. Micro-Cap 7, Student Edition: Page 59 Chapter 4 AC ANALYSIS INTRODUCTION AC analysis provides a means of evaluating the small-signal transfer characteristics of a circuit. If the circuit contains any nonlinear elements, the program calculates the DC operating point to determine the small-signal characteristics of each nonlinear element. The element is then replaced with a linear element representing these small-signal characteristics. The circuit must contain one of more independent (waveform) sources. The simulation replaces Pulse, Sine, and User sources with fixed 1-volt amplitude AC signals. In the case of circuits containing SPICE independent sources (V and I), these already have userspecified AC signal amplitudes. The analysis is performed using complex phasor quantities. Since the phasors are complex, the program performs specified operations on the output in order to present plots. These operators include real, imaginary, dB, magnitude, phase, and group delay. In addition to plotting voltages and currents as a function of frequency, the program can also produce Nyquist diagrams. A Nyquist diagram is a plot of the imaginary part of the output vs. the real part of the output. Begin by drawing a circuit, either by entering each component as described in Chapter 2 or by retrieving a network from the data file. If you already have a circuit in the Schematic editor window, close it using the File menu. Although you may use any circuit you have created, we illustrate AC analysis for the perf1.cir circuit. Retrieve this by pulling down the File menu, selecting Open, and then scrolling to perf1.cir (recall that you can skip to the first "P" entry by typing "P"). The screen should look like Figure 41. Micro-Cap 7, Student Edition: Page 60 Figure 41 This is and RLC circuit. Once the network is on the screen, the analysis is initiated by pulling down the Analysis menu and selecting AC analysis. Alternatively, you can use the keyboard by entering the hot key (identified on the pull-down menu) by simply pressing ALT+2. After you initiate the AC analysis, you are presented with the AC analysis limits window. We begin this tutorial with a discussion of this analysis limits window. We then discuss each of the menu selections in the AC analysis. Micro-Cap 7, Student Edition: Page 61 Figure 42 ANALYSIS LIMITS After activating the AC analysis, you are presented with a window showing the limits used in the analysis. When you store a circuit, the limits are stored with it. If you create a new circuit, default limits are used. The limits stored in the perf1 circuit are shown in Figure 42. We now describe each of these analysis limits. However, if you are impatient to see an analysis run, you can simply pull down the AC menu (using the mouse, or by pressing "ALT+A") and select Run (or press the F2 function key). Numeric limits fields: The upper portion of the window contains a field with six entries. Frequency range: The format for this is Fmax[,Fmin]. The analysis starts at Fmin and ends at Fmax. If you omit Fmin, it defaults to Fmax so the analysis is performed at a single point. Negative frequency values are not allowed. If you perform an analysis at a single frequency, the output plot contains only one point. In fact, when you look at the graph you may think it is blank. You can read the value at this single frequency point in two convenient ways. You could specify numeric output in the Limits menu, or you can use the cursor mode after the simulation is run. If you select the Cursor mode from the Scope pull-down menu, the cursor will immediately position itself at the single frequency point, and you can read out the values. Number of points: There is no interpolation in AC analysis (as there is in transient analysis), so the points calculated are the same as the points printed. The frequency values at which the calculation is performed depends on a selection you make in the Options window (we discuss this window in a few minutes). You select either Auto frequency, Fixed linear step, or Fixed log step. If you have selected Auto frequency, the number of points is controlled by the Maximum change value. We discuss this shortly when we examine the Maximum change selection. If you have selected either fixed linear or fixed log step, the Number of points entry in the Analysis limits window determines the selected frequencies. For fixed linear steps, the frequency step size is Micro-Cap 7, Student Edition: Page 62 (fmax-fmin)/(Number of points-1) For fixed log steps, the frequency step is (fmax/fmin)1/(Number of points-1) The default value for Number of points is 51. Temperature: Temperature enters into the parameter equations for devices and components. One or more temperature values (in degrees Celsius) can be specified for the analysis. The format is High [,Low[,Step]]. The square brackets indicate you can omit Step, or you can omit both Low and Step. The default value for Low is High while the default value for Step is the difference between High and Low. Therefore, if only one value is specified, the simulation runs at that temperature. If two values are specified, the simulation runs at those two values, the Low and High temperatures. For example, 27, 25 runs the simulation twice at 25 and 27 degrees centigrade (27o is room temperature). An entry of 35,20,5 runs the simulation at 20, 25, 30 and 35 degrees. Maximum change %: If the Auto step option is selected, the program automatically adjusts the frequency step up and down during the analysis. The maximum change you enter is a percentage. If the plot values change by more than this percent of full scale, the system reduces the step size. Typical Maximum change values needed to produce smooth curves range from 1 to 5 percent. Noise input: This field is used to specify the name of the source where input noise is calculated. The field applies only to the calculation of Inoise and Onoise. Noise output: This field is used to specify the node at which output noise is calculated. The format is node1[,node2]. Two nodes separated by a comma specify a differential output noise voltage. This field applies only if Inoise or Onoise variables are calculated. Waveform options fields: We now turn our attention to the wide table occupying the lower half of the Analysis limits window of Figure 42. The table contains 10 columns. Each of these is described below: The first four entries consist of buttons. These perform the same function as in the transient analysis case, as follows. Linear/Log: The first two buttons toggle the x axis and y axis between linear and log scale. Try clicking on these and see what happens. Notice that the markings on the button change from linear to log and back again. Of course, if you choose a log scale, the scale ranges must be positive numbers. Color Menu: The third button, the solid color button, takes you to the color menu. There are 16 possible color choices for each individual waveform. Numeric Values: The fourth button controls the table option. When pressed, a table of numeric values is printed. Type of Chart: The final button chooses the type of chart: rectangular, polar or Smith chart. P: When several variables are plotted, we have a choice of superimposing them on the same set of axes, or having them appear on separate non-overlapping graphs. The numeric entry in the P column is a number from 1 to 9. This indicates to which group the particular waveform is assigned. If you use the same number for several rows, these waveforms are plotted on the same set of axes. If the ranges are not the same, the plot uses the union of the individual ranges. You should exercise caution in plotting dissimilar variables on the same set of axes. Micro-Cap 7 does not track the units in its calculations. If, for example, you plot a gain that runs from 0 to 10 dB on the same set of axes as a phase that ranges from 0 to 360 degrees, the gain curve would only occupy a small portion of the range. Micro-Cap 7, Student Edition: Page 63 The example of Figure 42 will generate three curves plotted on one set of axes. If we wanted the curves on separate plots, we would assign different P numbers to them. Note that we are not currently plotting either noise parameter. We examine noise later in this tutorial. Expression fields: The remaining 5 columns relate to the expressions to be plotted. X expression: This field specifies the expressions for the X-axis variable. In most cases, this is a frequency variable. One notable exception is a Nyquist plot, where the X expression is the real part of the output. Y expression: This field specifies the expressions for the Y-axis variables. Since the program operates with complex phasors, complex operators are used. You can choose from among the following operators, where X is a labeled voltage or a variable such as V(A,B). RE(X) Real part of X IM(X) Imaginary part of X MAG(X) Magnitude of X PH(X) Phase of X in degrees GD(X) Group delay = rate of change of phase with (radian) frequency You can also plot mathematical functions of these operators, such as dB(MAG(X)) for a decibel plot of the magnitude. You can see all of the possibilities by clicking on the particular entry and then using the right mouse button. If you plot the phase of a variable, the plot begins at the second analysis point. This delay occurs because of an algorithm written into the program that removes phase ambiguity. It must compare the second point to the first before establishing a phase reference. If you need the exact phase at a particular frequency, start the analysis below that frequency. X range: This sets the scale ranges for the X waveforms. The format is High[,Low]. (You can also add two more numbers to specify grid spacing, which sets the spacing between grid, and bold grid spacing, which sets the spacing between bold grids. You can only set these grid spacings in the linear mode. Logarithmic scales use a natural grid spacing of 1/10 the major grid values and bold is not used.) In our example, we run the simulation from 100 kHz to 100 MHz, so the entry reads, 1E8, 1E5 for the X range. The default for Low is zero [Caution: Do not use the default value for Low if you a plotting X on a log scale. If you do so, an error message will be produced.]. You can enter "auto" for this field and Micro-Cap 7 automatically sets the range using the designated frequency range. You can enter "auto" by placing the cursor on the appropriate field and typing "auto". A faster way is to use the Limits menu as discussed in the next section. Y range: Same as X range, except for the Y variable. You can use "auto" for this entry, and Micro-Cap 7 automatically sets the range to fill the screen after running the simulation. Once you are satisfied with the analysis limits, you are ready to run the analysis. Run the analysis by clicking the Run box in the upper left corner of the screen. Alternatively, you can simply pressing the F2 function key. The AC analysis is produced, as shown in Figure 43. Micro-Cap 7, Student Edition: Page 64 Figure 43 As in the case of other types of analysis, you can exert two types of immediate control on the simulation as it is running. You can terminate the simulation by pressing the ESC key. If you press "P" during the run, you toggle a numeric display. This display shows the X and Y expression values during the simulation run. We seem to have gotten three families of curves. Each family contains nine separate curves. If you paid attention during the previous chapter, you should already realize that something must be stepped. In fact, in the title bar just above the curves, we clearly see that C1 is stepping from 0.1 nF to 4.1 nF. If we go back to the AC Analysis Limits window (pull down the AC menu and select Limits, or press F9), we can click on the Stepping button in the top row. We clearly see that C1 is being stepped. You can disable this by selecting No in the stepping box. Now looking back at Figure 43, we briefly describe the pull-down menus. These are essentially the same as those for the transient analysis. AC MENU Once you select AC analysis from the Run menu, you can pull down the AC menu either with the mouse, or by pressing "Alt+T". The menu contains 13 selections. Run Limits Stepping Optimize Analysis Window Micro-Cap 7, Student Edition: Page 65 Watch Breakpoints 3D windows Performance windows Numeric output State Variables Editor DSP Parameters Reduce Data Points Run: You select this menu entry to run the simulation without changing the analysis limits. Limits: This opens the Analysis Limits window so you can change limits. The Analysis Limits window is automatically opened when you select AC analysis from the Run menu, so you access this from the AC Analysis menu only if you wish to make changes following a simulation run. Stepping: Component parameters may be stepped from one value to another, producing multiple runs with multiple output waveforms. You activate this feature by selecting Stepping from the Transient menu and then entering instructions in the dialog box. The dialog box for the perf1 example is shown in Figure 44. Figure 44 Step What: This is where you specify which parameter you wish to step. For example, if you named one or more resistors "R1", you would enter R1 to step their values. In the case of stepping device parameters, you enter the device name on the first line, and the parameter you wish to vary on the second. The arrows to the right permit you to select from choices. In the perf1 example, we are stepping the capacitor, C1, so we enter C1 for the component and Value (or select by clicking the arrow) for the entry on the next line. (Case makes no difference to Micro-Cap 7, so don't be concerned if your screen shows VALUEn1 instead of Value) Limits: From specifies the starting value of the parameter. To specifies the ending value of the parameter. Step Value specifies the amount by which to step the parameter. In our example Micro-Cap 7, Student Edition: Page 66 circuit, we are varying C1 from 0.1 nF to 4.1 nF in steps of 0.5 nF. We now return to entries in the AC pull-down menu. Optimize: The optimizer systematically changes user-specified parameters to maximize, minimize, or equate a chosen performance function, while keeping the parameters within prescribed limits and conforming to any specified constraints. The optimizer function is limited in the Student Edition of the software. Analysis Window: This selection gives you the opportunity to change plot characteristics such as the line width. Watch: This displays the Watch window where you define expressions or variables to watch during a breakpoint invocation. Breakpoints: This accesses the Breakpoints dialog box. Breakpoints are Boolean expressions that define when the program will enter single-step mode so that you can watch specific variables or expressions. 3D windows: This feature is not available on the Student Version of the software. Performance windows: This feature allows you to sort and search individual results. Its function is beyond the scope of this manual. Numeric output: If you have enabled the fourth waveform option button (associated with a particular plot in the Transient Analysis Limits menu), the numeric output is available as soon as you run the simulation. You access this numeric output table from the AC pull-down menu. State Variables Editor: This command activates the State Variables Editor. However, in AC analysis, you are looking for steady state values, so you will most likely not use this editor. In fact, if you select it, notice that the state variables are all zero. There are two other selections in the pull down menu, DSP Parameters, and Reduce Data Points. We will not be using these in this basic introduction to Micro-Cap 7. However, you can get details on any function by simply clicking on "Help". This generally gives you the text from the professional version manual. SCOPE MENU The Scope pull-down menu, which can be accessed after a simulation is run, is used to select various scope commands. The menu provides you with a number of options regarding the display. Our suggestion is that you experiment with this and use the Help screens if you run into difficulty. Of particular interest is the cursor mode that allows you to place cursors on the diagram. Once you place a cursor, you can drag it with the mouse. The text below the plot shows the numerical values at the cursor points. The cursor function selection allows you to set cursors at key points on the curve, such as Peak, Valley, High, Low, and Inflection. Peak and valley are Local maxima and minima, while high and low are global maximums and minimums. The Inflection mode locates points where the second derivative of the waveform goes through zero (changes Micro-Cap 7, Student Edition: Page 67 sign). [NOTE: We hope you are trying these operations for the differential amplifier example. If you are doing so and thinking about what you are seeing on the screen, you are probably thinking that the High and Low are yielding the opposite of what you expect. However, keep in mind that V(a,b) is negative, so the high values are at the bottom of the graph and the low values are at the top. Additionally, since the output curve for this example asymptotically approaches the steady state values, it is not a good example to illustrate the use of Peak and Valley. You may get some incorrect answers due to roundoff error in the processing of comparing adjacent slopes.] PROBE PROBE is a powerful tool that allows you to view waveforms at various points in the schematic, just as you would use a probe from a laboratory oscilloscope. PROBE performs the AC analysis, saves the entire analysis in a disk file, and then allows you to probe points in the circuit. PROBE functions like a normal simulation, but you need not specify in advance which outputs you wish to plot. Let's continue working with the differential amplifier schematic we used in the previous chapter. Exit any run that you are currently in (press F3), and then load the DIFFAMP schematic on the screen. Before running the simulation, pull down the Analysis menu and select Probe AC Analysis. This places you in the probe mode. The program runs the simulation, which may take a while since your computer is doing more work than it does to plot one or two variables. After the run, click on any component with the mouse. We have selected resistor R4. Your display should look like Figure 45. Micro-Cap 7, Student Edition: Page 68 Figure 45 The circuit (or part of it) is on the right and an ac analysis plot is on the left. We describe four of the pull-down menus, Probe, Vertical, Horizontal, and Scope. The Probe pull-down menu contains eight entries: New run: Probe stores results in data files on the disk. These files are named CIRCUITNAME.TSA. If you have not changed the circuit since the last PROBE run, the program does not rerun the simulation when you go to the probe mode. If you have changed the circuit, the program detects this and performs a new run. If you have not changed the circuit, but still wish to have a new simulation (e.g., suppose you changed a component model), you select New run from the Probe menu. Add Curve: This allows you to add the plot of another parameter to the already existing graph. You are prompted to type the name. For example, if you type V(R1), you will plot the voltage across resistor R1. Delete Curves: This option lets the user remove a single waveform from the plot by selecting it from a scrollable list. Delete All Curves: This option removes all waveforms from the plot. One Curve: This command selects the single trace mode. When a new waveform is selected, it replaces the previous one. Many Curves: This command is used to select multiple traces for the Probe waveform display. Up to six waveforms can be displayed. As you probe various points, the new waveforms are added to the diagram. If you have multiple waveforms with widely varying ranges, this option may make it difficult to read the smaller waveforms since the vertical axis will scale for the largest waveform. In such cases, you may wish to select the One Micro-Cap 7, Student Edition: Page 69 Trace option. Save All: This command causes all Probe variables to be saved. Save V&I Only: This causes only voltages and currents to be saved during the save run. If these are the only variables you will wish to probe, this option will speed things up and save disk space. The Vertical and Horizontal pull-down menus contain identical entries. These are used to determine the variables, operators, and scale types (log or linear) used for the horizontal and vertical axes. If you have selected Save V&I Only in the Probe menu, many of the selections will not be available to you (i.e., only the voltage or current can be selected for display). If you have saved all variables, you can choose to display: Voltage Current Inoise (displays the resistance when mouse is clicked on a resistor) Onoise (displays charge when the mouse is clicked on a capacitor) Frequency (displays capacitance associated with the charge) The lower portion of the pull-down menu lets you select the type of plot (e.g., dB, magnitude). If you have selected Many traces from the Probe menu, you can click additional nodes and superimpose up to 6 waveforms. In addition to node voltages, you can also select voltages across a component. First remove all waveforms using the Probe pull-down menu and selecting Delete All Plots, or by pressing the F9 function key. Then position the cursor over the component you are interested in. You will then plot the voltage across this component. If a portion of the circuit extends beyond the visible region, you can scroll the circuit using the right mouse button. PROBE is a very powerful tool in debugging circuits. If the output is not what you expect it to be, by probing intermediate points in the circuit, you can often determine the cause of the discrepancy. MONTE CARLO ANALYSIS Performing Monte Carlo AC analysis is virtually the same as with transient analysis. We will not repeat the discussion of the previous chapter. Instead we urge you to experiment and use the Help pull down menus when needed. Micro-Cap 7, Student Edition: Page 70 Chapter 5 DC ANALYSIS INTRODUCTION DC analysis evaluates input/output characteristics in the DC condition. The input can be a voltage appearing on a user-specified node (relative to ground) or a differential voltage between two nodes. Alternatively, the input can be a current source. The program evaluates the DC output, which can be either a voltage (for a node relative to ground, or differential between two nodes) or a current flowing through a resistor specified by the two resistor nodes. The system replaces all inductors with short circuits and all capacitors with open circuits. It then applies a stepped DC source to the input and calculates the resulting DC output. Begin by drawing a circuit on the screen, either by entering each component as described in Chapter 2 or by retrieving a network from the data file. Although you may use any circuit you have created, we illustrate DC analysis for the Differential Amplifier circuit. If you already have a circuit in the Schematic editor window, begin by closing this circuit using the File menu. Retrieve the differential amplifier circuit by pulling down the File menu, selecting Open, and then scrolling to DIFFAMP.cir (recall that you can skip to the first "D" entry by typing "D"). The screen should look like Figure 46. Figure 46 Once the network is on the screen, the analysis is initiated by pulling down the Analysis menu and selecting DC analysis. Alternatively, you can use the hot key (identified on the pulldown menu) by simply pressing ALT+3. Micro-Cap 7, Student Edition: Page 71 After you initiate the DC analysis, you are presented with the DC Analysis limits window. We begin this tutorial with a discussion of this analysis limits window. We then discuss each of the menu selections in the DC analysis. ANALYSIS LIMITS After activating the DC analysis, you are presented with a window showing limits used in the analysis. When you store a circuit, the limits are stored with it. If you create a new circuit, default limits are used. The limits stored in the DIFFAMP circuit are shown in Figure 47. Figure 47 We now describe each of these analysis limits. However, if you are impatient to see an analysis run, you can simply select Run (or press the F2 function key). Numeric limits fields: The upper portion of the window contains a field with 7 entries. Input 2 range: The program has the capability of stepping two independent inputs. Input 2 is the secondary independent voltage/current sweep. The format is Final[,Initial[,Step]]. The analysis starts at Initial and ends at Final. The system calculates N solutions spaced equally over the range, Final-Initial with spacing of Step. If you omit Step, this parameter defaults to (Final-Initial), so the simulation runs twice, once at the initial and once at the final value. If you omit Initial, this parameter defaults to zero. If the secondary independent source is not used, enter NONE, as we have done in this example. Input 2: This determines where this input will be placed. The format is Plus[,Minus][,I or V]. Plus is the node name or number of the node where the positive lead of the input source is to be connected. For current sources, it can be thought of as the node toward which the directional arrow is pointing. Minus is the node name or number of the node where the negative lead of Micro-Cap 7, Student Edition: Page 72 the input source is to be connected. The third field designates whether the input is a current source or a voltage source. The default for the third field is V (voltage source), and the default for Minus is ground. Instead of specifying nodes, you could give the label of the source. For example, you might have a voltage sources labeled vin, in which case you simply enter this name. Input 1 range: This is the main input source. The format is the same as that for Input 2 range except that the specified step size is the maximum step size. Thus the format is Final[,Initial[,MaxStep]]. MaxStep is the maximum step possible during a sweep. The actual step size might be smaller since it is a function of the Maximum change (the last entry in this field). The default value of Initial is zero. If you omit MaxStep, the program sets step values based on the Maximum change. Note that Input 1 uses a variable step size while Input 2 uses a fixed step size. Input 1: This determines where this main input will be placed. The format is the same as that for Input 2. Number of Points: This entry specifies the number of points calculated for numeric output. The default is 51 and the minimum is 5. Numeric output is calculated using linear interpolation of the simulated results. Hence the number of points requested for numeric output need not match the number of data points. Temperature: One or more temperature values can be specified for the analysis. The format is High[,Low[,Step]]. The simulation is performed at temperatures between the Low and High, spaced by Step. Thus, for example, an input of 35,20,5 would produce separate runs at 20, 25, 30, and 35 degrees Centigrade. If Step is omitted, two runs are performed, one at the Low and one at the High temperature. Thus the default value of Step is High-Low. If both the Step and Low are omitted, one run is performed at the High temperature. Thus, the default value of Low is High. Maximum change %: This field affects the size of the step taken by "Input 1" during the simulation. A setting of 5% usually gives acceptable results. You might need a smaller step if device transitions (discontinuities in the input/output relationship) are involved. Of course, a smaller specification forces the simulator to take smaller steps and increases the time required for the simulation. We see from Figure 47 that the selected limits for this example are as follows: MThere is no secondary input. MThe main input is the voltage source, V1. MThe voltage source, V1, is stepped from -0.005 to +0.005 volts. Since no MaxStep is specified, the step size is set so that the maximum change is 5%. MThe simulation runs at one temperature, 27 degrees. If you wish to change any of the analysis limits, click the mouse on that limit and then type in the new limit. Waveform options fields: We now turn our attention to the wide table occupying the lower half of the DC Analysis Limits window of Figure 47. The table contains ten columns. The first four of these are the Micro-Cap 7, Student Edition: Page 73 same buttons we saw in transient and ac analysis. Linear/Log: The first two buttons toggle the X axis and Y axis between linear and log scale. Try clicking on these and see what happens. Notice that the markings on the button change from linear to log and back again. Of course, if you choose a log scale, the scale ranges must be positive numbers. Color Menu: The third button, the solid color button, takes you to the color menu. There are 16 possible color choices for each individual waveform. Numeric Values: The fourth button controls the table option. When pressed, a table of numeric values is printed. These are each described below. Now looking at the remaining columns, we see that you must enter information as follows: P: When several variables are plotted, we have a choice of superimposing them on the same set of axes, or having them appear on separate non-overlapping graphs. The numeric entry in the P column is a number from 1 to 9. This indicates to which group the particular waveform is assigned. If you use the same number for several rows, these waveforms are plotted on the same set of axes. If the ranges are not the same, the plot uses the union of the individual ranges. The example of Figure 48 shows two curves plotted on two different sets of axes. Figure 48 Expression fields: The remaining 5 columns relate to the expressions to be plotted. X expression: This field specifies the expressions for the X-axis variable. Typical expressions Micro-Cap 7, Student Edition: Page 74 are a voltage, say V(V1) or a current, I(V1), where we assume V1 is the specified Input 1 source. You can see a list of the various possible choices by selecting a table cell, then right clicking the mouse. Y expression: This field specifies the expressions for the Y-axis variables. This is typically a voltage or a current. Note that for the second curve, we specify a Y expression as a derivative showing the rate of change of the voltage at Outb with respect to the voltage at in. This derivative is the slope of the first curve, and represents the gain of the circuit. X range: This sets the scale ranges for the X waveforms. The format is High[,Low]. In our example, we run the simulation from -0.005 to +0.005 volts for input V(In), so the entry reads, 0.005, -0.005 for the X range. The default for Low is zero. You can type "auto" for this field and Micro-Cap 7 automatically sets the range. In such cases, Micro-Cap 7 must run a complete simulation before it can determine a suitable scale range. You can enter "auto" by placing the cursor on the appropriate field and typing "auto". A faster way is to click the “Auto Scale Ranges” box on the DC Analysis Limits menu. Y range: Same as X range, except for the Y variable. You can use "auto" for this entry, and Micro-Cap 7 adjusts the range to fill the screen after running the simulation. RUNNING THE ANALYSIS Once you are satisfied with the analysis limits, you are ready to run the analysis. Run the analysis by clicking Run. Alternatively, you can press the F2 function key. The DC analysis is produced, as shown in Figure 48. To produce this plot, we have turned off the stepping feature by pulling down the DC menu, selecting Stepping, and clicking on (Step it) NO. DC Pull-Down MENU Stepping: Component parameters may be stepped from one value to another, producing multiple runs with multiple output waveforms. You activate this feature in the same way we did in transient and ac analysis. PROBE The Probe mode is similar to that used in Transient or AC analysis. The major difference is a greatly simplified list of choices for the variables. As an example, we will show the use of the Probe mode for the DIFFAMP.CIR example. If you don't already have that circuit loaded, do so at this time. Then pull down the Analysis menu and click Probe DC Analysis. Then click on OUTA and on OUTB. Your screen should look like Figure 49. Micro-Cap 7, Student Edition: Page 75 Figure 49 If you pull down the Vertical menu in the AC Analysis window, you will find only two choices, Voltage or Current. You can also choose whether you wish the plot to be linear or log. The same choices exist for the Horizontal axis. If we select Voltage for both of these, we will be plotting the voltage at the selected points as a function of the input voltage. Then click the cursor on the point(s) you desire to plot. As an example, we clicked on OutA and OutB to produce the curves of Figure 50. We also used the Scope pull-down menu to select Tokens for V(OUTB) so that the two curves could be distinguished from each other when a print copy is made (they are in different colors on the monitor). MONTE CARLO ANALYSIS The operation of Monte Carlo Analysis is identical whether you are performing a transient, AC, or DC analysis. We therefore do not repeat the detailed discussion of Chapter 3. Micro-Cap 7, Student Edition: Page 76 INDEX AC Analysis Limits, 14,62 AC Analysis, 14,62 AC Menu, 65 Add Histogram, 52 Add Page, 22,37 Add Curve, 48 Analog Primitives, 24,32 Analysis Menu, 6 Analysis Window, 45,67 Attribute Text, 23 Auto Frequency, 62 Auto Scale Ranges, 12,42 Battery, 31 Border, 24 Box, 22,37 Bring to Front, 22,37 Calculator, 23 carlo.cir, 50 Cascade, 22 Change Attribute Display, 22,37 Clear, 22,37 Close, 21 Color Menu, 40,63 Color, 22 Command Text, 23 Component Editor, 23 Component Mode, 22 Component Palettes 1-9, 24 Component, 22 Connector, 36 Copy, 22,37 Cross-hair Cursor, 24 Cut, 22,37 DC Analysis Limits, 72 DC Analysis, 17,71 DC Pull-Down Menu, 75 decoder.cir, 56 Delete All Curves, 48,64 Delete Page, 22,37 Delete Curves, 48,69 Dependent Source, 35 DEV Statement, 54 Differential Amplifier, 38 Digital Analysis, 56 DNMOS, 30 DPMOS, 30 DSP Parameters, 46 Edit Menu, 22,37 Engineering Notation, 25 Exit, 22 Features, 4 File menu, 5,20 Find, 22,37 Fixed Linear Step, 62 Fixed Log Step, 62 Flag, 23 Flip X, 22 Flip Y, 22 Floating point, 25 Font, 22 Frequency Range, 62 Function Source, 32 GaAsFET, 31 Gaussian Distribution, 55 Global Settings, 24 Grid Text, 23 Grid, 24 Ground, 36 Ground, Need for, 36 Help, 9 High, 46 Histograms, 52 Horizontal Pull-Down Menu, 48 Inflection, 46 Info, 23 Input 1 Range, 73 Input 1, 73 Input 2 Range, 72 Input 2, 72 Installation, 4 Isource, 31 Jumper, 36 Laplace Source, 33 Limits, 44,66 Line, Rectangle, Diamond, Ellipse, Arc, Pie, 23 Linear distribution, 55 Linear/Log, 40,63,74 LOT statement, 53 Low, 46 Many Curves, 48,69 Maximize, 23 Maximum Change %, 63,73 Maximum Time Step, 7,39 Mirror Box, 22 Miscellaneous, 36 Mode, 23 Micro-Cap 7, Student Edition: Page 77 Model Program, 23 Monte Carlo Analysis, 49,70 New Run, 47 New, 21 NJFET, 30 NMOS, 30 Node Numbers, 10,23 Node Voltages/States, 24 Noise Input, 63 Noise Output, 63 Normal Distribution, 55 NPN, 29 NPN4, 31 Number Formats, 25 Number of Points, 7,40,62,73 Numeric Limit Fields, 39 Numeric Output, 45 Numeric Values, 40,63,74 Objectives, 4 One Curve, 48,69 Op-Amps, 31 Open Files, 23 Open, 5,21 Operating Point Only, 42 Operating Point, 42 Options Menu, 23 Options Pull-down menu, 10 Overlap, 23 P, 40,63,74 Paste, 22,37 Peak, 46 Pin Connections, 24 PJFET, 30 PMOS, 30 PNP, 29 PNP4, 31 Point to End Paths, 23 Point to Point Paths, 23 Preferences, 24 Print Preview, 21 Print Setup, 21 Print, 21 Prior Files, 21 Probability Distributions, 55 Probe DC Analysis, 75 Probe Pull-Down Menu, 47 Probe Transient analysis, 47 Probe, 68 Pulse Source, 26,31 Real numbers, 25 Reduce Data Points, 46 Refresh Models, 22 Remove Splits, 23 Repeat Last find, 22 Replace, 22,37 Micro-Cap 7, Student Edition: Page 78 Resistor, 24 Revert, 21 Rotate, 22 Run, 44 Save All, 48,70 Save As, 21 Save V&I Only, 48,70 Save, 21 Schematics, editing, 37 Scope Menu, 46,67 Select All, 22,37 Select, 23 Send to Back, 22,37 Shape Editor, 23 Show All paths, 24 Signal Processing Functions, 41 Sine Source, 32 Split Text/Drawing Areas, 23 State Variables Editor, 67 Step Box, 22 Stepping Dialog Box, 13 Stepping, 8,13,44,66 Switches, 36 Temperature, 7,40,63,73 Text, 23 Tie, 36 Tile Horizontal, 23 Tile Vertical, 23 Time Range, 6,39 Title, 24 Tokens, 16 Tolerances, 53 Translate, 21 Transformer, 28 Transient Analysis Limits, 39 Transient Analysis Menu, 43 Transient Analysis, 6,38 Undo, 22,37 User Source, 31 V and I Source, 32 Valley, 46 Vertical Pull-Down Menu, 48 View Menu, 23 Toggle Text/Drawing, 36 View, 10 Waveform Options Fields, 40 Waveform Source, 31 Windows Menu, 22 Wire Mode, 21 Wire, 23 WireD, 23 Worst Case Distribution, 55 X Expression, 7,41,64,75 X Range, 15,42,75 Y Expression, 7,41,64,75 Y Range, 15,42,64,75 Z Transform Source, 35 Zoom Out, 23 Zoom In, 23 Micro-Cap 7, Student Edition: Page 79