labview handout 4 chapter 4: data acquisition...

20
LABVIEW HANDOUT 4 CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT In this exercise, you will be introduced to the data acquisition capabilities of LabVIEW. Using hardware connected to the PC and the Measurement & Automation Explorer (MAX) within the LabVIEW programming environment, you will be able to acquire voltage data from an external source. The DAQ Assistant function will be shown to be an efficient way of quickly acquiring data, although it is fairly limited in its capabilities. The importance of sampling frequency and the aliasing effect will be demonstrated. Control of external devices will be shown by use of analog output terminals on the data acquisition board. The following concepts will explained: Dynamic Data, Error Outputs as Diagnostic Tools, the Use of Previously Saved VI’s and Controls in new VI’s.

Upload: others

Post on 27-Jan-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

  • LABVIEW HANDOUT 4

    CHAPTER 4: DATA ACQUISITION USING DAQ ASSISTANT

    In this exercise, you will be introduced to the data acquisition capabilities of LabVIEW. Using

    hardware connected to the PC and the Measurement & Automation Explorer (MAX) within the

    LabVIEW programming environment, you will be able to acquire voltage data from an external

    source. The DAQ Assistant function will be shown to be an efficient way of quickly acquiring

    data, although it is fairly limited in its capabilities. The importance of sampling frequency and

    the aliasing effect will be demonstrated. Control of external devices will be shown by use of

    analog output terminals on the data acquisition board. The following concepts will explained:

    Dynamic Data, Error Outputs as Diagnostic Tools, the Use of Previously Saved VI’s and

    Controls in new VI’s.

  • 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.

  • Press Stop to turn off the data acquisition. Switch to the block diagram. Place a DAQ Assistant

    Icon on the Block Diagram:

    Functions>>Express>>Input>>DAQ Assistant

  • 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

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

  • 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.

  • 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:

  • 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.

  • 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

  • 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

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

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

  • Place an Unbundle By Name icon onto the Block Diagram:

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

  • 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:

  • 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

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

    Place another set of breadboard wires onto connector 11 and connector 12 on the SCC-68 DAQ

    Board. Obtain another black double-wire set for the function generator and connect it to the

    Output>>Sync connector. 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?

    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:

  • 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.

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

    Waveform Simulator VI onto the Block Diagram:

  • 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

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

    Channel ao0.