0% found this document useful (0 votes)
64 views18 pages

Daq Exercises Sample

fdgdfg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views18 pages

Daq Exercises Sample

fdgdfg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Data Acquisition and Signal Conditioning

le
Exercises

mp
Course Software Version 2011
February 2012 Edition
Part Number 325832P-01

Data Acquisition and Signal Conditioning Exercises

Copyright
© 1995–2012 National Instruments Corporation. All rights reserved.
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or
Sa
translating, in whole or in part, without the prior written consent of National Instruments Corporation.
National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by copyright and other intellectual property laws. Where NI software may
be used to reproduce software or other materials belonging to others, you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license
or other legal restriction.

Trademarks
LabVIEW, National Instruments, NI, ni.com, the National Instruments corporate logo, and the Eagle logo are trademarks of National Instruments Corporation. Refer to the Trademark Information at
ni.com/trademarks for other National Instruments trademarks.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.

Patents
For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your media, or the National Instruments
Patent Notice at ni.com/patents.
Sa
mp
le
le
mp
Sa
Worldwide Technical Support and Product Information
ni.com

Worldwide Offices
Visit ni.com/niglobal to access the branch office Web sites, which provide up-to-date contact information, support phone numbers, email addresses, and current events.

National Instruments Corporate Headquarters


11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100

To comment on National Instruments documentation, refer to the National Instruments Web site at ni.com/info and enter the Info Code feedback.
Sa
mp
le
Contents

Student Guide
A. NI Certification........................................................................................................................................................................................vii

le
B. Course Description ..................................................................................................................................................................................viii
C. What You Need to Get Started ................................................................................................................................................................viii
D. Course Goals ...........................................................................................................................................................................................ix
E. Course Conventions.................................................................................................................................................................................xi

Lesson 2
Data Acquisition Hardware and Software

mp
Exercise 2-1 Range, Resolution, Code Width, and Accuracy ........................................................................................................2-3
Exercise 2-2 Using Measurement & Automation Explorer ............................................................................................................2-9
Exercise 2-3 DAQ Assistant ...........................................................................................................................................................2-17

Lesson 3
Analog Input
Exercise 3-1 Differential, RSE, and NRSE ....................................................................................................................................3-3
Exercise 3-2 Sampling Rate and Aliasing ......................................................................................................................................3-7
Exercise 3-3 Voltmeter VI ..............................................................................................................................................................3-11
Exercise 3-4 Finite Acquisition with Analysis ...............................................................................................................................3-15
Exercise 3-5 Continuous Buffered Acquisition and Logging.........................................................................................................3-21
Exercise 3-6 Triggered Continuous Buffered Acquisition .............................................................................................................3-29
Sa
Lesson 4
Analog Output
Exercise 4-1 Continuous Single-Point Generation .........................................................................................................................4-3
Exercise 4-2 Finite Buffered Generation ........................................................................................................................................4-7
Exercise 4-3 Triggered Continuous Buffered Generation ..............................................................................................................4-11

Data Acquisition and Signal Conditioning Exercises © National Instruments Corporation | v


Contents ni.com | vi

Lesson 5
Digital I/O
Exercise 5-1 Digital Read ...............................................................................................................................................................5-3
Exercise 5-2 Digital Write ..............................................................................................................................................................5-5

le
Exercise 5-3 Correlated Digital Output ..........................................................................................................................................5-9

Lesson 6
Counters
Exercise 6-1 Advanced Edge Counting ..........................................................................................................................................6-3
Exercise 6-2 Pulse Train Generation ..............................................................................................................................................6-9
Exercise 6-3 Retriggerable Pulse Train Generation........................................................................................................................6-13
Exercise 6-4 Pulse Width and Period Measurement.......................................................................................................................6-17

mp
Exercise 6-5 Frequency Measurement............................................................................................................................................6-21

Lesson 7
Signal Conditioning
Exercise 7-1 Thermocouple Measurement .....................................................................................................................................7-3
Exercise 7-2 Strain Measurement ...................................................................................................................................................7-7

Lesson 8
Synchronization
Exercise 8-1 Simultaneously Started Analog Input and Output .....................................................................................................8-3
Exercise 8-2 Synchronous Analog Input and Output .....................................................................................................................8-9
Sa
Exercise 8-3 Self-Study: Retriggerable Analog Input for STC2-Based Devices ...........................................................................8-13
Digital I/O
5

le
Complete these exercises to practice what you have learned about digital I/O. You build VIs to input and output digital data and a VI that correlates digital I/O. For
more information about the topics covered in these exercises, refer to Lesson 5 of the Data Acquisition and Signal Conditioning Course Manual.

Exercises

mp
Exercise 5-1 Digital Read
Exercise 5-2 Digital Write
Exercise 5-3 Correlated Digital Output
Sa
Data Acquisition and Signal Conditioning Exercises © National Instruments Corporation | 5-1
Sa
mp
le
Exercise 5-1 Digital Read
Goal
Acquire digital data using the DAQ device, and display the digital data on the front panel of a LabVIEW VI.

le
BNC-2120 Configuration
1. Use a wire to connect the UP/DN screw terminal in the Timing I/O section to the screw terminal for line 7 in the Digital I/O section.

Implementation
1. Open the Digital Read.vi in the <Exercises>\DAQ and Signal Conditioning\Digital directory.

2. Examine the block diagram, which acquires and displays digital data, as shown in Figure 5-1.

mp
Figure 5-1. Digital Read VI Block Diagram

Sa
Data Acquisition and Signal Conditioning Exercises © National Instruments Corporation | 5-3
Lesson 5 Digital I/O ni.com | 5-4

3. Open the front panel and set the Lines value, as shown in Figure 5-2.

Figure 5-2. Digital Read VI Front Panel

le
mp
Test
1. Test the VI.

 Run the VI.

 Rotate the Quadrature Encoder knob clockwise. The data LED on the front panel should be lit.

 Rotate the Quadrature Encoder knob counterclockwise. The data LED on the front panel should turn off.

Note The UP/DN terminal on the BNC-2120 outputs a high or a low signal indicating the rotation direction of the Quadrature Encoder knob. When you
rotate the Quadrature Encoder knob clockwise, the UP/DN terminal outputs a high signal. When you rotate the Quadrature Encoder knob counterclockwise,
the UP/DN terminal outputs a low signal.

2. Stop and close the VI when finished.


Sa
End of Exercise 5-1
Exercise 5-2 Digital Write
Goal
Output digital data from the DAQ device and display updates on the LEDs of the BNC-2120.

le
BNC-2120 Configuration
1. Verify that all the screw terminals in the Digital I/O section of the BNC-2120 are not attached to any wires.

Note The Digital I/O screw terminals are internally connected to port 0, lines 0 through 7 on the DAQ device. When a digital I/O line is either pulled or
driven high, the corresponding digital I/O LED is lit. When a digital I/O line is either pulled or driven low, the corresponding digital I/O LED is not lit.

Implementation
1. Open and examine the block diagram of the Digital Write.vi in the <Exercises>\DAQ and Signal Conditioning\Digital directory. This VI

mp
generates digital data, shown in Figure 5-3.

Figure 5-3. Digital Write VI Block Diagram and Front Panel


Sa
Data Acquisition and Signal Conditioning Exercises © National Instruments Corporation | 5-5
Lesson 5 Digital I/O ni.com | 5-6

2. Set the front panel controls of the Digital Write VI as follows:

 Select Browse from the lines pull-down menu.

 Hold the <Shift> key and select lines 0 through 7, as shown in Figure 5-4.

le
Figure 5-4. DAQmx Digital Channel Browse Dialog

mp
Sa
 Click OK.

 On the front panel, click each Boolean button so that they are all lit.

Note The number of digital lines selected must match the number of Boolean elements sent by the Boolean array. Therefore, you must initialize eight
elements in the data Boolean array to match the eight digital lines that you have selected.
Test
1. Test the VI.

 Run the VI. All of the digital I/O LEDs on the BNC-2120 should be lit.

le
 Experiment by clicking the buttons in the Boolean array control, and observe the results on the corresponding LEDs.

Is there anything peculiar about the order of the Boolean array control on the front panel versus the order of the actual LEDs on the BNC-2120? How could
you change the control to better reflect the actual orientation of the LEDs?

2. Stop and close the VI when finished.

Challenge
Modify the VI so that the Boolean array control will better reflect the actual orientation of the LEDs on the BNC-2120.

mp
End of Exercise 5-2
Sa
Data Acquisition and Signal Conditioning Exercises © National Instruments Corporation | 5-7
Sa
mp
le
Exercise 5-3 Correlated Digital Output
Goal
Output digital data from the DAQ device using the Analog Output Sample Clock as the sample clock and view the digital data on the LEDs of the BNC-2120.

le
BNC-2120 Configuration
1. Verify that all the screw terminals in the Digital I/O section of the BNC-2120 are not attached to any wires.

Note The digital I/O screw terminals are internally connected to port 0, lines 0 through 7 on the DAQ device. When a digital I/O line is either pulled or
driven high, the corresponding digital I/O LED is lit. When a digital I/O line is either pulled or driven low, the corresponding digital I/O LED is not lit.

Implementation
1. Open the Correlated Digital Output.vi in the <Exercises>\DAQ and Signal Conditioning\Digital directory.

mp
2. Modify the block diagram to generate digital data, as shown in Figure 5-5, using the following items:

Figure 5-5. Correlated Digital Output VI Block Diagram


Sa
1

1 Set the line grouping constant to one channel for all lines to combine all digital lines into a single virtual channel.

Data Acquisition and Signal Conditioning Exercises © National Instruments Corporation | 5-9
Lesson 5 Digital I/O ni.com | 5-10

3. Arrange the front panel and set the values, as shown in Figure 5-6.

Note Remember to set the values for each item in the array.

M Series DAQ devices do not have a dedicated sample clock for digital I/O tasks; therefore, to create a clocked digital I/O signal, the task requires a clock

le
from another source. In this case you will use the analog output circuitry’s clock.

Figure 5-6. Correlated Digital Output VI Front Panel

mp
1

Sa
2

1 Right-click the lines control and select I/O Name Filtering. Set Port/Line Filtering to Ports Only and click OK.
2 Resize the numeric array control to show eight elements.
3 Display the radix by right-clicking an element in the numeric array control and selecting Visible Items»Radix.
4 Display the numeric array in binary format by right-clicking an element in the numeric array and selecting Display Format and configure the settings shown in
Figure 5-7.

Note Select Default editing mode before you configure the other settings in the Numeric Display Format dialog box.
Figure 5-7. Numeric Display Format Dialog Box

le
mp
Sa
4. Save the VI.

Data Acquisition and Signal Conditioning Exercises © National Instruments Corporation | 5-11
Lesson 5 Digital I/O ni.com | 5-12

Test
1. Run the VI.

 Observe the LEDs on the BNC-2120.

le
Are the LEDs changing?

The digital output task in this VI must receive a clock signal from the specified clock source before it can output the next digital sample to the LEDs.

2. Generate clock signals on the specified clock source to test the VI.

 Open <Exercises>\DAQ and Signal Conditioning\Digital\Generate AO Sample Clock.vi.

 Set the front panel controls of the Generate AO Sample Clock VI with the following values:

mp
Physical Channels Output Clock Rate (Hz)

Dev1/ao0 2

3. Run the VI.

The Generate AO Sample Clock VI continuously generates voltage samples on the selected analog output channel. The Output Clock Rate (Hz) control
determines the frequency of the analog output sample clock.

 Observe the LEDs changing.

 Change the Output Clock Rate (Hz) to affect the frequency of the digital task.
Sa
Because the digital output is using the analog output sample clock as its clock source, the digital output is synchronized with the analog output generation.

4. Stop and close all VIs when finished.

End of Exercise 5-3

You might also like