University of Pennsylvania
Department of Electrical and Systems Engineering
Undergraduate Laboratory
  

How to do Data Acquisition in LabVIEW (ver 6.1 and lower)

"My first vi"

It is important to read the documents "Introduction to Data Acquisition Systems and LabVIEW" before you proceed to read the following. The terminology used in this write up will need the understanding of LabVIEW (LabVIEW is a trademark of National Instruments Corporation) software and data acquisition terminology explained in the above mentioned document.
With the help of this tutorial you will construct a data acquisition virtual instrument (vi) in LabVIEW. There are two parts to a vi; panel and the diagram . The panel resembles the front panel of the instrument and the diagram is where you make connections with various components.
This vi will acquire the data from a specified channel and display it on front panel . There is no text programming involved in LabVIEW. The vi when complete should look like the following:

 
 
Figure 1. Front Panel
 


Procedure:

Front Panel:
For data acquisition to work we need to provide controls, functions and indicators in the vi. Controls allow us to change the value of parameters, indictors allow us to graph and chart data, functions provide the processing, input/output control of the acquired data.

  1. Explore the Controls menu. Choose DIGITAL CONTROL from the sub menu as shown in Fig 2. A field will appear on the panel, label it as "Device".
Figure 2. Numeric Controls
  1. Repeat this twice and label them as "Sample Rate" and "Number of Samples".

  2. These controls will allow us to enter the numeric values for data acquisition.
  3. For using the channel control, LabVIEW reads from a set of strings. From the Controls menu, as shown in Fig 3, select String control and label it as Channel. Remember this is a channel of the data acquisition board installed in the PC and since data acquisition can be done from different channels, it is always a string.
Figure 3. String controls
  1. To plot the acquired data, go to GRAPH menu as shown in Fig 4, select WAVEFORM CHART and label it as Display.
Figure 4. Graphs and Charts
 

At this point, the front panel should look like as shown in Fig. 1.

Diagram
Next, Windows menu to go to the SHOW DIAGRAM. The diagram should look as shown in Fig. 5:

 
Figure 5. Diagram
  1. Choose, AI Multi Input from the Functions menu as shown in Fig 6
Figure 6. Easy I/O functions
 

Hint:
To turn on HELP, from Help menu, choose Show Help . When the mouse is kept on the any part of the diagram, a help window will show on the screen. The help for "AI Multi input" is shown in Fig 7.

 
Figure 7. Analog Input for Acquiring waveforms

At this point it is important to understand the tool bar. The tool bar is used for choosing different tools.

 
 
Figure 8. Tool bar description

Using the wire tool, connect the appropriate controls to the subvi. Connect the graphing indicator on towards the end of your construction. When your implementation is complete, the tool bar will show the status of the vi. If a connection is bad or is not appropriate, it will show on the diagram with a broken line. If the terminals are not connected appropriately, the tool bar will display the status as shown in Fig 9.

 
Figure 9. Tool bar status

On completion and if the wiring is appropriate, the diagram should look like one shown in Fig. 10.

 
Figure 10. Diagram of the data acquisition vi.

Proceed to the front panel and fill the appropriate information in the front panel as shown below.
Use Channel 0 for Channel control. Adjust your function generator to output 100 Hz, 2v p-p sine wave signal
Depending on the frequency of the input waveform, enter a appropriate sampling frequency number. The number that you enter should at least be twice as of the frequency of the input waveform.
In the Number of Samples, put the same number as the Sample rate.

After entering the appropriate information, click on the  to begin acquiring data.
If the information entered was correct a sine wave will appear on the front panel. As you may have noticed, the data acquisition is done only at the time of clicking 
To do a continuous data acquisition, follow these steps:
Click on  once and tool bar should now change to 

Click on  and the data acquisition will continue until STOP is pressed.

Show your first vi to the lab instructor. Make a print out of the panel and the diagram. 


Created by Siddharth Deliwala, Sep 25, 1997
Updated by Siddharth Deliwala, Sep 5, 1997.

Back to the ESE Undergraduate Lab Homepage.