It is important to read " Introduction to Data Acquisition Systems and Labview " before you proceed to read the following.
To design a virtual instrument (vi) in Labview software which will allow you to measure DC characteristics of 741 op amp
To measure output characteristics of a device/circuit
one needs to measure the output voltage from a device/circuit as the input
to it is varied. The vi that you are going to design, controls the installed
data acquisition (daq) board which outputs DC voltages and simultaneously
measures the input DC voltage and then plots the measured voltages on a XY
graph. This is achieved by using the data acquisition (daq) board installed
in a PC and by using the Labview software that controls and interacts with
the board. The daq board is capable of measuring voltages at any one of its
8 input channels and it can output to any one of 2 output channels. The connections
to this board are made available through the
. Labview needs no text programming and all functionality and control is
achieved through various functional blocks. The execution and the logical
flow is achieved through wires that interconnect the blocks. These blocks
are called functions and subvis.
As you may already know a vi consists of a front panel and a diagram. Following is the example that you are going to design. The front panel is shown in Fig 1 and the diagram is shown in Fig 2 .
Figure 1. Front Panel
Figure 2. Diagram
This section will explain the basics of editing and designing a vi. Tools, Controls and Function palettes are explained. Launch Labview application from the desktop and choose "New VI".
Figure 3. Launching Labview
Figure 4. A new vi
The screen will show a blank front panel and diagram. You will also notice two floating palettes, the Tools and the Controls palette. Tools palette has different tools that are used in the editing of different components of vis.
It is always a good practice to design the vi just as
you would design an instrument. Observe the front panel in Figure 1. The
front panel consists of controls and indicators. In the example shown in
Fig 1, we need to have inputs for the vi to get correct information on the
daq board (device), input and output channels to measure input and output
data ("Analog Channel in" and "Analog Channel out" respectively), a control
to set the start output voltage (Start voltage) and the delay of each increment
(delay) of output and input measurement. In addition to this, we need to
have Numeric Display of "Input : voltage into op-amp " and "Output : voltage
from the output from the op-amp ".
Explore the Controls palette and choose Numeric subpalette. Remember to label each of the controls or indicators as soon as you place it on the front panel. This will help you to identify the terminal in the diagram. Also goto Help menu and check Show Help. This will enable a help window when you select a function or a subvi.
For displaying the input and the output voltages you will need two Numeric Indicators, one each for "Input : voltage into Opamp" and "Output : voltage from the output of the op-amp ". The Numeric Indicator is in Numeric subpalette of Controls palette.
The channel control in Labview is always a string control. A string control is similar to a numeric control except that it allows text information to be used in addition to the numbers. You will need two string controls, one each for "Analog Channel in" and "Analog Channel out". The string controls are in the String subpalette of the Controls palette.
The plot is a XY graph that plots a value from X axis and Y axis data points. Choose XY plot from Graph subpalette in Controls palette.
Figure 7. Graphs.
Click on the diagram part of the vi. You will notice another floating palette titled Functions. This palette has a variety of functions and subvis that control all aspects of the daq board and signal measurement and processing. If you have labeled all the numeric controls and indicators, then you will find their terminals on the diagram labeled appropriately. In case you forgot to label the numerics and strings just as you brought them into front panel it can be confusing. Use the right click mouse while selecting the terminal and choose "Find Terminal" from the menu. Alternatively, you can double-click on the terminal in the diagram and it will point to the control in the front panel.
Figure 8. Functions palette with daq subpalette open
While designing a diagram remember the following rules :
For any Function or subvi the inputs to it are always to the left and the outputs are always to the right .
To look at all the connections, go to Help menu and choose "Show Help". With Help turned on, as you move your editing tool on a function/subvi the help screen will pop up. All the screen captures in this document are from the "Help" screen.
When the tool is placed over a function or a subvi, the terminals on the functions light up with the connections highlighted. This makes it easy to connect the wire to appropriate terminals.
If the connections between two functions/subvis are incompatible, then a ----- line will appear between the connections rather then a solid line. This means that the wire connection is carrying incompatible data (e.g. as array to a number or a cluster to a array). Check the connections again with the "Help" screen or by looking at Fig 2.
Figure 9. Analog Input, waveform function and Analog Output subvis.
The daq subvi as shown above acquires or outputs the
voltage data only once when executed. By using a "For Loop", the AI One Pt
subvi and AO One Pt subvi generate the data until the loop
is executed. The For Loop has two terminals, the i terminal counts
the iterations and N terminal sets the limit of number of times the loop
can run (this is the "maximum number of points control").
The For Loop is equivalent to a pseudo code : for i = 0 to N-1, execute the subdiagram.
The i (iteration) terminal contains the current number of completed iterations starting with 0 in the first iteration. Within the For Loop, the "Start voltage" value gets incremented with a value from "i" for every iteration of the loop.
The voltage output from the daq board = [( (Start voltage) * 10 ) + i] / 10. This is achieved by various numeric functions.
Figure 10. Array subpalette
You need to build an array for saving the data in a spreadsheet file format. As explained before, the data available from daq subvis are samples in a series of numbers. These numbers are generated every time the loop is is executed. The Build Array function combines the input values so that the output array now contains both input and output voltage information. This output is a 2D (two dimensional) array where the data will be the form of two columns. This function is necessary to be used for graphing indicators (with the exception of XY plot graph) and for writing in a file. The Build array function is a single input function by default. Use the tool to resize for two inputs. Leave the output unconnected for now. Make connections with the wire tool as shown in Fig 2.
We also need to plot the voltage output from the op-amp against the voltage input to the op-amp. The Bundle Cluster function in the Cluster subpalette of the Functions palette assembles all the components at the input and the outputs an array of clusters. In this vi the output of the Bundle function is connected to the XY plot. The XY plot function then generates a XY axis coordinate. A cluster is a storage element that can store variety of data types. A cluster element is used in Labview environment liberally because of it advanced memory management advantages. Clusters are used to pass data from one function to another and it can contain a combination of numbers and arrays.
Figure 11. Cluster subpalette
Bring into the diagram the addition, division and multiplication functions and make connection so that the diagram looks like as shown in Fig 2. The Write to Spreadsheet vi is in the File I/O subpalette. You only need to connect the 2D data input to the vi. Leave the rest disconnected. 2D (two dimensional) data is generated from the Build Array function and each dimension is a column of data points. In this case the first column is the voltage into the circuit (Vin) and the second column is the voltage measured from the circuit.
Figure 12. Write to Spreadsheet File.vi
Use the For Loop function in Loop and Structures subpalette and drag it over all the terminals except "maximum number of points", "XY plot" and "Write to spreadsheet vi" numeric controls. If one of the terminals happens to be inside the loop, you can drag the terminal out by using the tool. Make connections to N and i terminals of the For Loop. Wire the outputs of the Build Array and the Bundle function to the "Write to Spreadsheet " and "XY plot" functions respectively. It is a good practice to label various function with the tool. This will make it easier to follow the logical structure of the vi. You will be using this vi for other circuits in coming labs. Take your time to explore various subpalettes. If you get stuck, try using "Help" from the Help menu before calling on instructors.
On completion and if the wiring is appropriate, the diagram should look like the one shown in Fig. 2. The front panel will be gray scale by default. Choose the paint tool to make the graph and front panel white.
On the front panel and right-click on the XY plot. A menu will pop up with various formatting options. Choose > X Scale > deselect AutoScale. Do the same for Y axis.
In the front panel, the tool bar can be used to set the font size and Start/Stop the vi.
Figure 13. Front Panel toolbar
In the diagram, the tool bar is used for debugging the execution or single stepping the program.
Figure 14. Diagram toolbar
Front Panel of the VI
Use -5 V as the Start Voltage value. (The maximum limits are +5 to -5 volts). Depending upon the breakout box connections enter the correct channel number in Analog Channel In and Analog Channel Out fields.
Enter an appropriate delay number. The delay function is in ms (millisecond). Start with number 30. This will give 30 ms delay between every measurement that is displayed on the front panel.
Click on to
start the vi.
The data is plotted and a file is saved AFTER the readings are taken. Therefore at the end of the VI execution the graph is plotted and a "Save File" dialog box will appear. Enter a file name and observe the graph. The graph should show a 45 degree line (input voltage=output voltage).
If you do not see any graph plots;
-Check your connections and make sure that the channel numbers in VI correspond to connections on the breakout box.
-If you see partial graph plot, right-click on the graph > X Scale > deselect AutoScale. Do the same for Y axis.
Save your files on the Desktop with a extension .txt. This file will be a "tab delimited " text file, which can be opened in Notepad. To use the file for graphing you can use any spreadsheet application.
The graph is an input/output characteristic of the circuit/device under test. Y axis is Vout (the voltage measured by the DAQ board) and X axis is Vin (the voltage generated from the daq board).
You may change the delay to speed up the execution.
If the test is successful, proceed to connect the op-amp circuit. Show your vi to the lab instructor. Make a print out of the panel and the diagram.
For EE206 users, click here for inserting opamp files. For others, insert the circuit between Analog Out and Analog In to measure the characteristics of the op-amp.
Created by Siddharth Deliwala, Jan 26, 1998
Updated by Siddharth Deliwala, Jan. 23, 2004
Back to the EE Undergraduate Lab
Back to the EE206 Home Page
Back to the EE Home Page