Você está na página 1de 6

Physics 3100 Electronics, Fall 2008, Digital Circuits

LabView Exercises: Part II


The working VIs should be handed in to the TA at the end of the lab.

Using LabView for Calculations and Simulations


LabView provides a convenient means of performing calculations and displaying the results in graphical form. This part of the lab involves building two VIs.

Exercise 1:
Starting from a blank VI, build an application which calculates the I-V characteristic of the diode starting from the exponential model for the diode. ID = IS (eVD /nVT 1) The VI should graph ID vs VD on the front panel. There are several ways to accomplish this, I suggest using a formula node on the block diagram. To use this you will need to look at the help window in order to learn the syntax which must be used in a formula node. The graphing tool you need to use is an XY Graph(dont use the Express VI for this as you will need to modify things). I suggest a front panel layout similar to that shown below:

Physics 3100 Electronics, Fall 2008, Digital Circuits

Now add a second formula node which calculates the load line describing the voltage drop across the resistor in the circuit

In order to graph both of these on the same graph you need to build an array as in this example from XY Graph.vi

Exercise 2:
We frequently do Monte Carlo simulations to compare experimental measurements to what might have been predicted from calculation. This is a particularly useful method for evaluating the uncertainty in measurements for systems which are very complex (for example, those having many variables). The reason this approach is called Monte Carlo is because it relies on the generation of random numbers (as a way of simulating the random uncertainties associated with experimental measurements). The rst task in building a Monte Carlo simulation is to nd a reliable random number generator. This is not as easy as it may sound since computers have a nasty habit of doing the same calculation the same way every time (thus always getting the same answer). This can introduce correlations into the random number generation process. Using LabView, build a simple VI which calculates two random numbers (between 0 and 1) and plots them against each other (using the XY Graph tool) on the front panel. See if you can tell whether there are any correlations between the two random numbers generated. (For example, you can calculate

Physics 3100 Electronics, Fall 2008, Digital Circuits

very many pairs of random numbers, plot them, and look for any patterns which might appear. If the numbers are truly random, there will be no correlation.)

Using LabView to Turn your Computer into a Scientic Instrument


The computer sound card provides a convenient means of converting a time dependent analog voltage into a stream of digital numbers which can be analyzed by the computer. One important limitations is that we need to use the MIC or microphone input (pink coloured jack on computer) which only accepts voltages less than about 0.7 volts (presumably they are protected by a pair of crossed diodes acting as limiters. In order to use our spectrum analyzer we need to provide a source of signal for our input. The designer boards which you have in the lab have a basic function generator. Attach the output of the function generator to the potentiometer on your designer board, then put a pair of crossed diodes (as limiters) between the centre tap and the ground. Finally, connect the output to a BNC connector on the designer. This provides a protected voltage variable output which we can safely use with the MIC input on the computer. Starting from a blank VI create a front panel which resembles the example below:

The upper graph displays the time domain signal which is input into the spectrum analyzer via the MIC input and the computer sound card. Next, place the following Express VIs on the block diagram.

Physics 3100 Electronics, Fall 2008, Digital Circuits

Physics 3100 Electronics, Fall 2008, Digital Circuits

The output of the Acquire Sound VI is to be wired to the input of the Filter. The output of the Filter is to be connected to the Spectral Measurements module. The Acquire Sound Express VI module should be congured to acquire 1 seconds worth of data, using a single channel, with a sampling rate of 44,100 Hz (if possible) and 16 bits of resolution. You can later changes these settings to see how they aect the signal you observe. The Filter module can be congured in a number of ways: Low-Pass High-Pass Band-Pass Band-Stop Smoothing These choices have settings such as, for the Band-Pass Filter, the low cuto frequency and the high cuto frequency. To begin with, choose the Band-Pass Filter option and place two Numeric Controls on the front panel (as shown above) to allow you to changes these settings while the spectrum analyzer is running. There are also several dierent types of lter algorithms which you can use to generate any one of these lters (remember, these are digital lters since they operate on numerical data obtained from the digitized output of the sound

Physics 3100 Electronics, Fall 2008, Digital Circuits

card. The theory behind these lter algorithms is beyond the scope of this class but they are based on the analog lters having the same names. These analog lters are discussed in Chapter 12 of our textbook. The choices available are: Butterworth Chebyshev Inverse Chebyshev Elliptic Bessel The Order of the lter denes the number of poles (see Chapter 12). A single time constant lter, such as we have discussed, is a single pole lter. Two such elements in series would constitute a two pole lter, etc. As you will see by changing the number of poles, the higher order the lter is, the sharper the cut-o range is. Digital lters of very high order are easy to build whereas it is tricky to build an analog lter of higher than 6th order. When the spectrum analyzer is working, change the type of lter, the cut-o frequencies, the lter algorithm used and the number of poles to see how these changes aect the spectrum. After you have nished building the Spectrum Analyzer VI, hook up the protected function generator output from your designer board (see above) to the MIC input using the BNC to miniature phono plug cable provided. Vary the frequency of a sine wave to see whether the lter characteristics are reected in the response. Vary the type of lter used as well. Next, look at the spectrum of the square wave. You should see the fundamental (frequency of the square wave) and a large number of odd harmonics (1,3,5,7...) occurring at multiples of the fundamental frequency. An ideal square wave has an innite number of odd harmonics whose amplitudes decrease with harmonic order. As a nal exercise, reconstruct the noisy signal which you created in Lab. 2, adding the protective circuitry described above.

Modify the lter as needed to completely eliminate the 60 Hz signal from the spectrum. You should also be able to eliminate everything except the 60 Hz signal.

Você também pode gostar