DSAS Laboratory no 4 Laboratory 4 OrCAD editing and simulation 5.1 Laboratory work goals • • • Presentation of the OrCAD package of programs. Editing of a simple scheme. Simulation of the implemented scheme functioning. 5.2 Editing a logic scheme The OrCAD 9.1 programs package is used to edit and simulate schemes containing digital circuits and electronic components. The package contains a number of programs, among which: Capture Release 9 for editing schemes and stimuli; Simulate for schemes functioning simulation. The OrCAD package can be installed on Windows 9x, NT, 2000 and XP operating systems. The editing program can be started from the menu Programs→ OrCAD Release 9.1 → Capture CIS. The next step is to create a new project or open a previously created one, then edit the desired scheme as well as the necessary stimuli, and finally start the simulation itself. In the next paragraphs it will be presented one of the facilities offered by the package, editing a scheme. Capture CIS is started, and then it is created a new project like this File →New → Project (Fig. 5.1). 1 DSAS Laboratory no 4 Fig. 5.1 In the Name edit box a name must be chosen for the project, and then the option Analog or Mixed-Signal Circuit Wizard is to be selected (Fig. 5.2). In the Location field it is introduced (by using the Browse... button) the path to the file in which the project will be saved on the hard drive. Creation of the project itself is done after pressing the OK button. The next step is to select the libraries containing the modules to be used in the project. These can be selected from the left side window list (Fig. 5.3) by pressing the Add>> button to add them to the project. The libraries used in the project will appear in the list on the right-side of the window, along other predefined libraries such as: analog.olb, source.olb, sourcstm.olb, special.olb. To edit the necessary laboratory schemes one will select the following libraries: 7400.olb and 74ls.olb. At the end, the Finish button must be pressed. 2 DSAS Laboratory no 4 Fig. 5.2 Fig. 5.3 3 DSAS Laboratory no 4 Next, the work area appears, on which the desired scheme is edited. The work area is selected by clicking on it. Placing modules or gates on the area is easy; the desired component (Tool part) is selected from the Toolbar that is placed on the right side of the window (Fig. 5.4 ->1). The same action may be accomplished if pressing the key P or Shift+P meaning the option Place Part from the Place menu. As an example it will be edited the scheme implementing the following logic function: f(x, y, z) = (x + y) ⋅ (x + z) 1 2 3 Fig. 5.4 4 DSAS Laboratory no 4 For implementation there are needed two OR 2 gates and an AND 2 gate, that is a 74LS32 module out of which there will be used 2 gates and a 74LS08 module and use one gate. First an AND 2 gate is selected (Fig. 5.5). Place Part is pressed; in the Part field it is introduce the name of the module, 74LS32. From the underlying list the 74LS32 module is selected. In the Packaging section, the gate is chosen by means of the Part combo box. At the end the OK button must be pressed. Fig. 5.5 5 DSAS Laboratory no 4 The next step is to place the gate in the desired location in the work area by a click of the mouse. A second click is necessary to place the second gate as well. At the end the ESC key is pressed. Each gate has two indicators: name of the module (for instance 74LS32), appearing in the bottom of the gate and an identifier of the gate or a reference (for instance U1A), specifying that gate A is used (identifier of the gate in the module) pertaining to module U1 which is the first (representing an identifier of the module). On each pin of the gate, either input or an output pin, it is written the number of the pin, as described in the catalogue. In order to modify the identifier of the second gate, the identifier text must be selected (U2A), then right click with the mouse, then Edit Properties or directly a double click on the current indicator. The Value field must be edited, representing reference of the second gate in the first module 74LS32; it will be modified to U1B, and finally press the OK button (Fig. 5.6). Fig. 5.6 6 DSAS Laboratory no 4 In a similar manner one must place one gate from a 74LS08 module. This module has the reference U2A. Now all three gates belonging to the two specified modules are placed on the work area (Fig. 5.7). The next step is interconnecting all logic gates in the scheme (Fig. 5.8). This aspect is materialised by means of interconnecting wires. It is chosen Place Wire from Tool Part (Fig. 5.4 ->2) or the key W or Shift+W is pressed or from the Place menu the option Wire is chosen. Placing the links is done by clicking with the mouse in the starting point and then in the end point. The ESC key must be pressed to exit the Wire mode. Because on pin 4 input from gate U1B it is connected the same signal as on pin 1 input from gate U1A (the variable x), one must trace a wire from pin 1 input of U1A to input 4 from U1B. Automatically it will appear a junction or a wiring point. U1A 1 3 2 U2A 74LS32 1 3 2 U1B 74LS08 4 6 5 74LS32 Fig. 5.7 7 DSAS Laboratory no 4 U1A 1 3 2 U2A 74LS32 1 3 2 U1B 74LS08 4 6 5 74LS32 Fig. 5.8 The next step is to name the inputs and outputs from the scheme. This is done by placing Net Aliases (Fig. 5.9) or if pressing the key N or Shift+N or selecting the option Net Alias from the Place menu. Then some name must be written in the Alias field and finally the OK button is pressed. To position the alias on the desired wire (for an input or an output of a gate), it is used the mouse. Fig. 5.9 8 DSAS Laboratory no 4 For the scheme given as example, the input 1 of U1A will be denoted x, input 2 of U1A will be named y, z for input 5 of U1B and f for output 3 of U2A (Fig. 5.10). U1A x 1 y 2 3 U2A 74LS32 1 3 f 2 U1B 74LS08 4 6 z 5 74LS32 Fig. 5.10 5.3 Scheme functioning simulation In order to simulate the functioning of a scheme, it is necessary to connect stimuli on the inputs of the circuit, signals that can be configured to generate the desired input combinations. To place a stimulus, one must open Place part, select the SOURCSTM library and choose DigStim1, which is one line digital stimulus. One such stimulus must be placed on each input of the scheme. Next, right click with the mouse on the Implementation field and select Edit Properties or directly double click on the Implementation field and edit the Value field – put in the name of the input, x, y or z. The scheme must comply with Fig. 5.11. 9 DSAS Laboratory no 4 Fig. 5.11 The last step is to edit the stimuli. One of the scheme stimuli must be selected with a click on its symbol, then the Edit menu must be accessed and the PSpice Stimulus option has to be selected. As an example, in the next paragraphs the stimulus for the signal x is edited. The Signal option from the Digital section is to be selected. If 0 is to be chosen as initial value, then the Initial Value field must not be modified. In order to add the rest of the stimuli – for signals y and z, from the same application Stimulus Editor one must choose the New option, from the menu Stimulus or Alt+N or press the New Stimulus toolbar button (Fig. 5.13 –>1). The names of the stimuli are edited, y and then z. At the end, the file containing these stimuli must be saved, the file being named like the project and with the .stl extension. 10 DSAS Laboratory no 4 Fig. 5.12 To be able to apply all possible combinations on the inputs of the scheme, as shown by the truth table, the stimuli must be modelled, because initially they have the value 0 for the whole simulation period. This is done by accessing the Edit menu, the option Add or Alt+A or the toolbar button (Fig. 5.13 –>2). Then with the mouse, which changes cursor from regular shape to a pencil like shape, click on the stimulus wave form in the point where one wants to change value from 0 to 1 or from 1 to 0. 11 DSAS Laboratory no 4 1 2 Fig. 5.13 The x, y and z stimuli, with values according to the truth table, are depicted in Fig. 5.14. Fig. 5.14 The stimuli file, containing the new values, has to be saved, then closed and the attention focuses on the work area again. From the PSpice menu one must choose the New Simulation Profile option, in the window that appears (Fig. 5.15) the name of 12 DSAS Laboratory no 4 the simulation must be edited and in the end the Create button must be pressed. Fig. 5.15 A new window appears but for now nothing needs to be changed, so the OK button is pressed. Next, select Run from the PSpice menu, in order to enter the simulation mode. To visualise the scheme evolution in accordance to the stimuli applied on the inputs, from the Trace menu the Add Trace option has to be chosen. Then, from the next window (Fig. 5.16) one must select, one after the other, the inputs and outputs. At the end, press the OK button. The wave forms of the signals selected for visualisation are shown in Fig. 5.17; one can also notice the delays at the outputs with respect to the inputs (at this moment the delays are not a concern). The wave forms in Fig. 5.18 are identical to those from Fig. 5.17 and they are obtained selecting the option Print Preview from the File menu. This kind of representation is specific to printing the results and is recommended for capturing images when printing in black and white. 13 DSAS Laboratory no 4 Fig. 5.16 Fig. 5.17 Fig. 5.18 The simulation is to be executed again, but one must place aliases for gates U1A and U1B also, to be able to visualise them, in order to observe the delays induced by each gate. 14 DSAS Laboratory no 4 5.4 Lab activity progress Practice editing and simulation of a scheme in OrCAD through all steps described in the previous paragraph. It is considered the scheme from Fig 5.19 and it must be analysed in order to determine the truth table. The scheme is edited in OrCAD as presented in the previous paragraph. Stimuli are chosen so as to be taken into account all possible combinations of values for input variables. Between two successive commutations of a stimulus there must be at least 250ns. It is simulated the functioning of the scheme to determine the truth table of the functions performed by it. The simulation will be performed with minimum delays on an interval of 2000ns. It must be established the significance of the functions S and T. a b S Ti T Fig. 5.19 15 DSAS Laboratory no 4 It is considered one of the functions proposed in paragraph 5.5 and it is determined the truth table corresponding chosen expression. It is determined the scheme for the corresponding chosen expression. It is edited and simulated the scheme using the same stimuli like previous scheme. The results obtained by simulation must be analysed and compared with the truth table previously deducted. 5.5 Proposed problems 1. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = [(x ⊕ y) ↑ (x + z)] ↑ ( y ⋅ z) 2. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = (x ↓ y) ↑ (x + z ⋅ y) 3. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = [( x ⊕ y) + z ] ↑ (x ⋅ y) 4. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = [ x ⊕ ( y ⊕ z )] + (x ↓ y) 5. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = ( x + y ⋅ z ) ↓ (x ⋅ y) 6. Implement and simulate the scheme for the following function in OrCAD: 16 DSAS Laboratory no 4 f(x, y, z) = (x ⋅ y + z) ↑ ( x ⊕ y) 7. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = [(x ↓ y) ⋅ (y + z)] ↑ (x + y) 8. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = ( x ⋅ y + z) ⊕ (x + y) 9. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = (x ⋅ y ↑ z) ⋅ (x + y) 10. Implement and simulate the scheme for the following function in OrCAD: f(x, y, z) = (x ⋅ y ⋅ z) ↑ [(x ↓ y ) ↓ z)] Remark! At this stage the delays in signal propagation are of no concern, although these delays may sometimes dramatically alter the results. This is why the simulation result must be read from the middle of each interval between any two commutations. 17