Vous êtes sur la page 1sur 5

Lesson 3

Analog Input Exercises

Finite Acquisition with Analysis

Exercise 3-4
Objective

To acquire an array of data using finite buffered configuration and to analyze


this data for maximum and minimum values.

BNC-2120 Configuration
1. Connect the Sine/Triangle BNC connector in the Function Generator
section to the BNC connector of channell in the Analog Inputs section.
2. Verify that the Sine/Triangle switch is in the sine position.
3. Verify that the BNCffhermocouple

switch is in the BNC position.

4. Verify that the FS/GS switch underneath the BNC connector of


channel 1 is in the GS position.

Finite Buffered Acquisition


1. Open a blank VI.
2. Save the VI as <Exercises>\DAQ
Analog

Input\Finite

and Signal Conditioning\


Buffered Acquisition.vi.

3. Create the block diagram to perform a buffered acquisition of a finite


number of samples, as shown in Figure 3-7, using the following items:

samples per channel

Figure 3-7. Finite Buffered Acquisition VI Block Diagram

DAQmx Create Virtual Channel VI


Select the Analog Input-Voltage
menu.

instance from the pull-down

Right-click the physical channels terminal and select Create


Control.

National Instruments Corporation

3-11

Data Acquisition and Signal Conditioning Exercises

Lesson 3

Analog Input Exercises

DAQrnx Timing VI-This

VI configures the number of samples to

acquire or generate and creates a buffer when needed.


-

Select the Sample Clock instance from the pull-down menu.

Right-click the samples per channel and rate inputs and select

Create-Control.
-

Right -click sample mode and select Create-Constant. Set the


constant to Finite Samples.

DAQmx Start Task VI

DAQmx Read VI
-

Select the AnalogSingle ChannelMultiple Samples


Waveform instance from the pull-down menu.

Right-click the data output and select CreateIndicator.


Rename the indicator as Acquired Data.

DAQmx Clear Task VI

Simple Error Handler VI

4. Arrange the items on the front panel similar to Figure 3-8. Do not alter
the x- and y-axis scales.

Figure 3-8. Finite Buffered Acquisition VI Front Panel

Right -click the Acquired Data indicator and select Replace


Graph Waveform Graph.

5. Save the VI.

Data Acquisition and Signal Conditioning Exercises

3-12

ni.com

Lesson 3

Analog Input Exercises

Test
1. Output a sine wave with a frequency of 100 Hz from the function
generator on the BNC-2120.

On the BNC-2120, set the Frequency Selection switch in the


Function Generator section to the leftmost position.

Turn the Frequency

Adjust dial on the BNC-2120 to LO.

2. Set the front panel controls of the Finite Buffered Acquisition VI to the
following values:

Physical Channels: Devl /ail

Samples Per Channel: 1000

Rate: 10000

3. Run the VI.


~

Note If your data does not appear, troubleshoot the VI. If that doesn't reveal the
problem, then try to build a task in MAX. If you still have trouble, ask for additional
assistance.

Waveform Analysis
1. Save an additional copy of this VI.

National Instruments Corporation

Select FileSave As.

Select the CopySubstitute


click Continue.

Save the VI as <Exercises> \DAQ and Signal


Conditioning\Analog
Input\Finite Buffered
Acquisition with Analysis.vi.

3-13

copy for original option and

Data Acquisition and Signal Conditioning Exercises

Lesson 3

Analog Input Exercises

2. Add waveform analysis to the finite acquisition by analyzing the data


after it has been acquired. Modify the block diagram, as shown in
Figure 3-9.

samples per channel

Figure 3-9. Finite Buffered Acquisition with Analysis VI Block Diagram

Amplitude and Level Measurements Express VI-In this exercise,


the Amplitude and Level Measurements Express VI determines the
maximum and minimum values in a signal.
In the Configure Amplitude and Level Measurements dialog
box, place checkmarks in the Maximum peak and Minimum
peak checkboxes.
Click OK to apply the changes and close the dialog box.
Create numeric indicators for the Negative Peak and Positive
Peak terminals.

Move the Simple Error Handler VI so that the error clusters run
through all the VIs and enforce dataflow.

3. Save the VI.

Data Acquisition and Signal Conditioning Exercises

3-14

ni.com

Lesson 3

Analog Input Exercises

Test
1. From the front panel, run the VI and observe the resulting values.
2. Adjust the amplitude of the sine wave by turning the Amplitude Adjust
dial on the BNC-2120, and observe how it affects the results of the VI
the next time you run it.
3. Experiment with other amplitude and level measurements.

Double-click the Amplitude and Level Measurements Express VI


and select different measurements to output. Click OK.

Create indicators for these values.

Run the VI to experiment with different amplitude and level


measurements.

4. Save and close the VI.

End of Exercise 3-4

National Instruments Corporation

3-15

Data Acquisition and Signal Conditioning Exercises

Vous aimerez peut-être aussi