# Digital circuits simulation using PSpice: tutorial 10

In this tutorial I will explain you the working of a Digital systems which is used or information processing in digital forms i.e. while working with computer. At the start a brief and concise introduction of digital systems specifically the exclusive OR and exclusive NOR gates along with their circuit diagram is provided with the explanation of the output they will show. After that the circuits is simulated using PSPICE and the result are compared with the theoretical discussion provided (which should be same). At the end of the tutorial you are provided with an exercise to do it by yourself, and in the next tutorials I will assume that you have done those exercises and I will not explain the concept regarding them

### Introduction to digital circuits

Digital systems are simply referred as the systems which are designed to store, process and communicate information in digital form. As we have discussed previously a computer can only manipulate digital or binary information i.e. zeros and ones and in this tutorial we will work with the logical gates. One of the circuit of digital systems is exclusive OR circuit. An exclusive OR circuit gives a true output if the number of true instances is odd and gives false otherwise. A simple circuit diagram of an exclusive OR gate is shown in the figure below,

Figure 1: Exclusive OR

And the truth table of an exclusive OR and exclusive NOR gate for two inputs is given in the table below,

 A B XOR XNOR 0 0 0 1 0 1 1 0 1 0 1 0 1 1 0 1

### Examples of simulating digital circuits using PSpice

• Lets’ design a simple digital circuit i.e. an Exclusive OR circuit as we have discussed in the introduction part, and a few details of exclusive NOR is also provided and left as an exercise for the reader. Open the PSPICE design manager on your PC by typing design manager in the search bar. From the design manager click on the run schematic button to open a new blank schematic as shown in the figure below,

Figure 2: Opening new schematic

• After opening the new schematic before jumping into designing first save the schematic by clicking on the file button at the top left corner and then selecting save as so that we can access it anytime in the future. Refer to the figure below,

Figure 3: Saving schematic

• Click on the get new part icon at the top bar of the schematic window in order to search for the components that are needed for circuit designing.

Figure 4: Getting new part

• In the get new part window, type ‘7404’ it will display a NOT gate available in PSPICE. From that list select a simple NOT gate as shown in the figure below,

Figure 5: Placing NOT gate

• Again open the get new part window and in the part name block type 7408, select the AND gate from the list given and then click on place & close as shown in the figure below

Figure 6: Placing AND gate

• Again open the get new part window and in the part name block type 7432, select the OR gate from the list given and then click on place & close as shown in the figure below

Figure 7: Placing OR gate

• Next step is to place a ground, do the same again and in the part name type Dstm and select the digital source and then click on place & close as shown in the figure below,

Figure 8: Placing digital source

• The placed components in the schematic window are shown in the figure below,

Figure 9: Placed components

• Click on the draw wire icon at the top bar of the schematic window in order to connect the already placed components for circuit designing, as shown in the figure below,

Figure 10: Drawing wire

• Connect all the components to complete the circuit diagram as shown in the figure below,

Figure 11: Complete block diagram

• On the top of the schematic window, click on the Voltage/Level Marker button as shown in the figure below,

Figure 12: Voltage marker

• Place it at the output capacitor and at the input node as shown in the figure below,

Figure 13: Placed voltage marker

• If we are interested in checking the voltage on a specific wire in spite of checking it at a node, double click on the wire and inn the window that appear as a result, type the name of the wire you want to label it with, as shown in the figure below,

Figure 14: Labeling a wire

• Next step is to set the attributes of the input digital supply. Double click on the dstm1 supply you connected in the circuit previously and set the input commands of the digital input system as shown in the figure below,

Figure 15: Input 1 attributes

• The commands in the attributes window represents the value of the input at the corresponding time in the command before the space. The COMMAND1 = 0s 0 shows that at time 0s the value of the input dstm is 0 and the COMMAND2 = 1ms 1 shows that the value will update to 1 at time 1 millisecond. Similar is the case with COMMAND5 = 4ms 0 that at 4 milliseconds the value of the input will be 0.
• Next step is to set the attributes of the input digital supply. Double click on the dstm2 supply you connected in the circuit previously and set the input commands of the digital input system but these commands will not be same to the commands of input 1 as shown in the figure below,

Figure 16: Attributes of input 2

• These commands will update after one complete cycle of the input 1 signal. After the input value of the input 1 source changes from zero to one and then back to zero the input value of input source 2 only changes from zero to 1. These command are adjusted so in order to complete all the binary input combinations for two variable inputs as shown in the table below,
 A B 0 0 0 1 1 0 1 1
• Next step is to adjust the properties of the simulations in order to produce the graph of the voltage at the marker. Click on analysis and then click on Setup as shown in the figure below

Figure 17: Simulation setup

• A widow will appear, click on the transient block on the window and adjust the properties of the window according to your requirement, refer to the figure below

Figure 18: Transient response

• The final time of the response is 4ms because we have set the commands for only up to 4ms. Now comes the simulation part, click on the analysis at the top bar of the schematic window and then click on simulate as shown in the figure below,

Figure 19: Simulation

• A schematic window will appear showing the voltage at the output wire and the input source as shown in the figure below,

Figure 20: Output of simulation

• If we construct a table of the input values corresponding to the output values, the results will be similar to that of the results discussed in the. As is obvious from the figure above the top most wave is of the output and the lower two wave forms represents the inputs.

Exercise:

• Implement the XNOR gate using PSPICE and display the output along with input.

(Hint: It is similar to the XOR gate with a not gate at the output)

<<Previous tutorial                                          Next tutorial>>