cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · web viewlabview handout 4 chapter...

21
LABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement & Automation Explorer: Tools>> Measurement & Automation Explorer In the Configuration box, double-click on Devices and Interfaces tab. Double-click on NI-DAQmx Devices. Click on NI PCI-6221: “Dev1”. Then click on Self-Test. If the device passes the self- test, click OK. Attach wires to the AI0 (Analog Input Channel Zero) and AI8 connectors on the SCC-68 board. Attach the red wire from the Output>>Main Connector on the function generator to AI0 and the black wire to AI8. Set the range to 10 Hz and the Function to a Sine Wave. Turn the Frequency knob counterclockwise as far as it will go. Turn on the function generator. Press the Test Panels

Upload: trancong

Post on 23-Mar-2018

229 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

LABVIEW HANDOUT 4

CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT

Open a Blank VI. Open the Measurement & Automation Explorer:

Tools>> Measurement & Automation Explorer

In the Configuration box, double-click on Devices and Interfaces tab. Double-click on NI-

DAQmx Devices. Click on NI PCI-6221: “Dev1”. Then click on Self-Test. If the device passes

the self-test, click OK.

Attach wires to the AI0 (Analog Input Channel Zero) and AI8 connectors on the SCC-68 board.

Attach the red wire from the Output>>Main Connector on the function generator to AI0 and the

black wire to AI8. Set the range to 10 Hz and the Function to a Sine Wave. Turn the Frequency

knob counterclockwise as far as it will go. Turn on the function generator. Press the Test Panels

button. Select Analog Input>>Dev1/ai0 and press Start to see the acquired sine wave.

Page 2: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Switch to the block diagram. Place a DAQ Assistant Icon on the Block Diagram:

Functions>>Express>>Input>>DAQ Assistant

Page 3: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

When the DAQ Assistant is placed on the Block Diagram, a dialog window called Create New

Express Task will appear. Click the following:

Acquire Signals>>Analog Input>>Voltage

Page 4: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

On the next screen, left-click on ai0>>Finish:

Page 5: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Analog Input Channel 0 is now programmed to receive external voltage signals. On the DAQ

Assistant screen:

Configuration>>Acquisition Mode>>1 Sample (On Demand)

Select Display Type>>Chart, then click the Run button to see the sine wave.

Page 6: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Press Stop and then OK to exit out of the DAQ Assistant screen. Expand the DAQ Assistant

icon by pulling the bottom edge downward.

Wire indicators to the data output and the error output as shown below by:

Page 7: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Right-Click>>Create>>Indicator

The thick blue wire indicates that dynamic data comes from the DAQ Assistant. The dynamic

data type has the actual data, a time/date stamp, and also the name of the data stream. Notice the

Red Coercion Dot appears on the input of the data indicator. This can be eliminated by inserting

a conversion icon:

Functions>>Express>>Signal Manipulation>>Convert From Dynamic Data

When the Convert From Dynamic Data icon is placed on the Block Diagram, a window

appears that allows the user to determine what type of conversion takes place. Select Single

Scalar/Floating Point Numbers/Double Precision.

Page 8: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Surround the icons on the Block Diagram with a While Loop and place a Wait (ms) on the

Block Diagram as shown below. Run the VI to verify that the sine wave is output to the Front

Panel. Save this VI as DC Voltmeter (Express).

Save a copy of this VI to Digital Oscilloscope (Express). Delete the Convert From Dynamic

Data icon and the Numeric Indicator on the data output. Place a Waveform Graph on the

Front Panel and wire it to the data output of the DAQ Assistant. Notice that the Waveform

Page 9: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Graph automatically turns blue, indicating that it will graph the dynamic data from the DAQ

Assistant. Delete the Timing icon and its Numeric Constant.

Double-Click on the DAQ Assistant and change the setting to:

Configuration>>Acquisition Mode>>N Samples>>OK

Page 10: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Place the Digitizing Parameters Control onto the Front Panel as follows:

Controls>>Select a Control>>Browse>>Digitizing Parameters.ctl

Page 11: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Place an Unbundle By Name icon onto the Block Diagram:

Functions>>Programming>>Cluster, Class, & Variant>>Unbundle By Name

Page 12: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

When the Unbundle By Name icon is wired to the Digitizing Parameters Control, it will

automatically show one of the controls, as shown below:

Expand the Unbundle By Name icon by pulling down the bottom edge:

Change the terminal ordering by right-clicking on the top terminal and choosing:

Right-Click>>Select Input/Output>>Number of Samples

Wire the Stop button as shown below. Change the frequency of the sine wave signal coming

from the frequency generator to around 100 Hz, and run the VI with the following Digitizing

Parameters Control settings:

Page 13: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Notice that the signal travels across the screen. To eliminate this, double-click on the DAQ

Assistant. In the dialog window:

Triggering>>Trigger Type>>Digital Edge

Page 14: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Choose the Trigger Source as PFI0 (Programmable Function Interface Zero) and press OK.

Place wires on connector 11 and connector 12 on the SCC-68 DAQ Board. Connect the red wire

from the Output>>Sync connector on the function generator to connector 11 and the black wire

to connector 12. Run the VI. Now the trace is locked to the left-hand top of the sine wave. Vary

the function generator frequency until exactly three cycles appear on the Waveform Graph and

note the frequency. Change the function generator frequency to the 1K range. Increase the

frequency and note the frequency each time the graph shows exactly three cycles on the

Waveform Graph. How do these values compare to those predicted by the Aliasing Condition?

f alias=¿ f−N f s∨¿

Open a new VI and create the following Block Diagram. This VI will output a voltage from the

SCC-68.

When the DAQ Assistant icon is placed on the Block Diagram, the Create New Express Task

window appears. Input the following:

Generate Signals>>Analog Output>>Voltage>>ao0>>Finish

Make the following selections in the DAQ Assistant dialog window:

Page 15: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Run the VI. Use a voltmeter to measure the output from connectors 22 and 54 on the SCC-68.

The value should correspond to the voltage requested by the VI. Save this VI as DC Voltage

Source (Express). Modify the VI so that it will stop when an error occurs as shown below.

Verify that the VI operates correctly by inputting a desired value of voltage outside of the range

given in the DAQ Assistant dialog window.

Page 16: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Open a new VI. Save it as Waveform Generator (Express). Place the previously constructed

Waveform Simulator VI onto the Block Diagram:

Page 17: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Place the previously constructed controls Digitizing Parameters and Waveform Parameters

onto the Block Diagram by hovering the cursor over one of the inputs of the Waveform

Simulator VI and:

Right-Click>>Create>>Control

When placing the DAQ Assistant, select the following on the pop-up window:

Generate Signals>>Analog Output>>Voltage>>ao0>>Finish

Page 18: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &

Run the VI with the following parameters. The sine wave is now being output to Analog Output

Channel ao0.

Page 19: cecs.wright.educecs.wright.edu/~sthomas/labviewhandout04.docx · Web viewLABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT Open a Blank VI. Open the Measurement &