Data Acquisition Basics Manual LabVIEW Data Acquisition Basics Manual January 1998 Edition Part Number 320997C-01
Internet Support E-mail: support@natinst.com FTP Site: ftp.natinst.com Web Address: http://www.natinst.
Important Information Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period.
Contents About This Manual Organization of This Manual ...........................................................................................xiii Conventions Used in This Manual...................................................................................xiv Related Documentation....................................................................................................xvii Customer Communication ..............................................................................................
Contents Error Handling................................................................................................................. 3-8 Channel, Port, and Counter Addressing .......................................................................... 3-9 Channel Name Addressing................................................................................ 3-10 Channel Number Addressing ............................................................................ 3-10 Limit Settings .....................
Contents Chapter 7 Buffering Your Way through Waveform Acquisition Can You Wait for Your Data? .........................................................................................7-1 Acquiring a Single Waveform...........................................................................7-2 Acquiring Multiple Waveforms ........................................................................7-3 Simple-Buffered Analog Input Examples........................................................................
Contents PART III Making Waves with Analog Output Chapter 10 Things You Should Know about Analog Output Single-Point Output ......................................................................................................... 10-1 Buffered Analog Output .................................................................................................. 10-1 Chapter 11 One-Stop Single-Point Generation Single-Immediate Updates ...............................................................................
Contents PART IV Getting Square with Digital I/O Chapter 15 Things You Should Know about Digital I/O Types of Digital Acquisition/Generation.........................................................................15-2 Chapter 16 When You Need It Now—Immediate Digital I/O Chapter 17 Shaking Hands with a Digital Partner Sending Out Multiple Digital Values ..............................................................................17-3 Non-Buffered Handshaking ..............................................
Contents Parallel Mode for Analog Input Modules ......................................................... 19-5 Parallel Mode for the SCXI-1200 (Windows).................................... 19-6 Parallel Mode for Digital Modules ................................................................... 19-6 SCXI Software Installation and Configuration ............................................................... 19-6 Chapter 20 Special Programming Considerations for SCXI SCXI Channel Addressing ................
Contents PART VI Counting Your Way to High-Precision Timing Chapter 23 Things You Should Know about Counters Knowing the Parts of Your Counter ................................................................................23-2 Knowing Your Counter Chip...........................................................................................23-3 DAQ-STC..........................................................................................................23-4 Am9513 .....................................
Contents Chapter 25 Measuring Pulse Width Measuring a Pulse Width................................................................................................. 25-1 Determining Pulse Width ................................................................................................ 25-2 DAQ-STC ......................................................................................................... 25-2 Am9513............................................................................................
Contents Counting Elapsed Time ...................................................................................................27-7 DAQ-STC..........................................................................................................27-7 Am9513 .............................................................................................................27-9 8253/54 ..............................................................................................................
Contents FIGURES AND TABLES Figures Figure 2-1. Figure 2-2. Figure 2-3. Figure 2-4. Figure 2-5. Figure 2-6. Figure 2-7. Installing and Configuring DAQ Devices............................................... 2-2 How NI-DAQ Relates to Your System and DAQ Devices .................... 2-3 NI-DAQ Device Window Listing ........................................................... 2-7 Accessing the Device Configuration Window in NI-DAQ ....................
Contents Figure 6-4. Figure 6-5. Figure 6-6. Figure 6-7. Figure 6-8. The AI Single Scan VI Help Diagram.....................................................6-4 Using the Intermediate VIs for a Basic Non-Buffered Application ........6-4 The Cont Acq&Chart (Immediate) VI Block Diagram...........................6-5 Software-Timed Analog I/O....................................................................6-7 Analog IO Control Loop (HW-Timed) VI Block Diagram ....................6-8 Figure 7-1. Figure 7-2.
Contents Figure 11-3. Figure 11-4. Single Immediate Update Using Intermediate VI................................... 11-2 Multiple Immediate Updates Using Intermediate VI.............................. 11-3 Figure 12-1. Figure 12-2. Figure 12-3. Figure 12-4. Figure 12-5. Figure 12-6. Waveform Generation Using the AO Generate Waveforms VI ............. 12-2 Waveform Generation Using the AO Waveform Gen VI....................... 12-2 Waveform Generation Using Intermediate VIs ...............................
Contents Figure 19-1. Figure 19-2. Figure 19-3. SCXI System ...........................................................................................19-1 Components of an SCXI System.............................................................19-2 SCXI Chassis...........................................................................................19-3 Figure 21-1. Figure 21-2. Figure 21-3. Figure 21-4. Figure 21-5. Continuous Transducer Measurement VI................................................
Contents Figure 24-16. Figure 24-17. Figure 24-18. Figure 24-19. Figure 24-20. Figure 24-21. Figure 24-22. Figure 24-23. Figure 24-24. Figure 24-25. Figure 24-26. Figure 24-27. Figure 24-28. Figure 24-29. Figure 25-1. Figure 25-2. Figure 25-3. Figure 25-4. Diagram of Cont Pulse Train (8253) VI ................................................. 24-13 Physical Connections for Generating a Finite Pulse Train ..................... 24-14 Diagram of Finite Pulse Train-Easy (DAQ-STC) VI ..........................
Contents Figure 27-1. Figure 27-2. Figure 27-3. Figure 27-5. Figure 27-6. Figure 27-7. Figure 27-8. Figure 27-9. Figure 27-10. Figure 27-11. Figure 27-12. Figure 27-13. Figure 27-14. External Connections for Counting Events .............................................27-1 External Connections for Counting Elapsed Time..................................27-1 External Connections to Cascade Counters for Counting Events..............................................................................
Contents Table 13-1. External Update Clock Input Pins........................................................... 13-2 Table 18-1. Phenomena and Transducers................................................................... 18-1 Table 20-1. SCXI-1100 Channel Arrays, Input Limits Arrays, and Gains ................ 20-4 Table 25-1. Internal Counter Timebases and Their Corresponding Maximum Pulse Width Measurements ................................................ 25-9 Table 27-1.
About This Manual The LabVIEW Data Acquisition Basics Manual includes the information you need to get started with data acquisition and LabVIEW. You should have a basic knowledge of LabVIEW before you try to read this manual. If you have never worked with LabVIEW, please read through the LabVIEW QuickStart Guide or the LabVIEW Online Tutorial before you begin.
About This Manual • Part VI, Counting Your Way to High-Precision Timing, describes the different ways you can use counters with your data acquisition application, including generating a pulse or pulses; measuring pulse width, frequency, and period; counting events and time; and dividing frequencies for precision timing.
About This Manual bold Bold text denotes the names of menus, menu items, parameters, dialog boxes, dialog box buttons or options, icons, windows, Windows 95 tabs, or LEDs. bold italic Bold italic text denotes a note, caution, or warning. italic Italic text denotes variables, emphasis, a cross reference, or an introduction to a key concept. This font also denotes text from which you supply the appropriate word or value, as in Windows 3.x.
About This Manual LabVIEW Data Types Each VI description gives a data type picture for each input and output parameter, as illustrated in the following table: Control Indicator Data Type Signed 8-bit integer Signed 16-bit integer Signed 32-bit integer Unsigned 8-bit integer Unsigned 16-bit integer Unsigned 32-bit integer Single-precision floating-point number Double-precision floating-point number Extended-precision floating-point number String Boolean Array of signed 32-bit integers 2D Array of signed
About This Manual Related Documentation The following documents contain information you might find helpful as you read this manual: • LabVIEW User Manual • G Programming Reference Manual • LabVIEW Function and VI Reference Manual • LabVIEW QuickStart Guide • LabVIEW Online Reference, available online by selecting Help»Online Reference • LabVIEW Online Tutorial, which you launch from the LabVIEW dialog box • Application Note 025, Field Wiring and Noise Considerations for Analog Signals • The
Part I Before You Get Started This section contains all the information you should know before you start learning about data acquisition with LabVIEW. Part I, Before You Get Started, contains the following chapters: • Chapter 1, How To Use This Book, explains how this manual is organized. • Chapter 2, Installing and Configuring Your Data Acquisition Hardware, explains how to set up your system to use data acquisition with LabVIEW and your Data Acquisition hardware.
1 How To Use This Book This chapter explains how this manual is organized. The following outline shows you what information you can find in this manual.
Chapter 1 How To Use This Book Part V: SCXI—Getting Your Signals in Great Condition Things You Should Know about SCXI Hardware and Software Setup for Your SCXI System Special Programming Considerations for SCXI Common SCXI Applications SCXI Calibration—Increasing Signal Measurement Precision Part VI: Counting Your Way to High-Precision Timing Things You Should Know about Counters Generating a Square Pulse or Pulse Trains Measuring Pulse Width Measuring Frequency and Period Counting Signal Highs and Lows D
Chapter 1 How To Use This Book 1. Install and Configure Your Hardware—When you install LabVIEW, the program prompts you to have the data acquisition (DAQ) drivers installed. This manual guides you through setting up NI-DAQ software with your DAQ device and SCXI hardware. You should read any unique installation instructions for your platform in Chapter 2, Installing and Configuring Your Data Acquisition Hardware. 2.
Installing and Configuring Your Data Acquisition Hardware 2 This chapter explains how to set up your system to use data acquisition with LabVIEW and your data acquisition hardware. The chapter contains hardware installation and configuration and software configuration instructions and some general information and techniques. Note Get DAQ Device Information VI The LabVIEW installer prompts you to have the NI-DAQ driver software installed.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Install Plug-in Devices Use Your Configuration Utility to Configure Devices No Yes Using SCXI? Install and Configure SCXI Use the DAQ Channel Wizard to Configure Channels Read Chapter 3, Basic Data Acquisition Concepts, and Chapter 4, Where You Should Go Now Figure 2-1. Installing and Configuring DAQ Devices NI-DAQ driver software provides LabVIEW with a high-level interface to DAQ devices and signal conditioning hardware.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Figure 2-2 shows the relationship between LabVIEW, NI-DAQ, and DAQ hardware. LabVIEW VIs NI-DAQ Drivers Data Acquisition Devices Figure 2-2. How NI-DAQ Relates to Your System and DAQ Devices (NI-DAQ 4.8.x for Macintosh) NI-DAQ 4.8.x for the Macintosh device drivers are bundled in a single file that determines which drivers to load.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware LabVIEW Data Acquisition Hardware Support National Instruments periodically upgrades LabVIEW to add support for new DAQ hardware. To make sure this version of LabVIEW supports the hardware you use, refer to the following tables. Table 2-1. LabVIEW DAQ Hardware Support for Windows with NI-DAQ 5.x, 6.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Table 2-1. LabVIEW DAQ Hardware Support for Windows with NI-DAQ 5.x, 6.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware If you have any other questions regarding hardware support for LabVIEW, refer to Appendix B, Hardware Capabilities, in the LabVIEW Function and VI Reference Manual, or the LabVIEW Online Reference, by selecting Help»Online Reference.... Installing and Configuring Your National Instruments Device Some DAQ devices have jumpers to set analog input polarity, input mode, analog output reference, and so on.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Figure 2-3. NI-DAQ Device Window Listing Now show the Device Configuration window by selecting the Device Configuration option from the menu as shown in Figure 2-4. Figure 2-4.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Figure 2-5 shows the NI-DAQ Device Configuration window. When you are in the Device Configuration window of the utility, you can edit the default settings for parameters, such as analog input polarity and range on a per-device basis. If you are using AMUX-64T or signal conditioning devices with your DAQ device, select the appropriate device using the Accessories menu.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Installing and Configuring Your SCXI Chassis The following section describes the procedures for installing and configuring your SCXI chassis. Hardware Configuration Your SCXI hardware kit includes the Getting Started with SCXI manual, which contains detailed instructions for assembling your SCXI system, module jumper settings, cable assemblies, and terminal blocks.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware 6. 7. If you are using a DAQ device in your computer to control your SCXI chassis, connect the mounting bracket of the SCXI-134x (where x is a number) cable assembly to the back of one of the modules and screw it into the chassis frame. Connect the other end of the cable to the DAQ device in your computer. In multiplexed mode, you only need to cable one module to the DAQ device. In most cases, it does not matter which module you cable.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Figure 2-6. Accessing the NI-DAQ SCXI Configuration Window Figure 2-7 shows NI-DAQ with the SCXI Configuration window selected. Figure 2-7.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware 1. Leave the Chassis set to 1 if you have only one chassis. You will use this number to access the SCXI chassis from your application. If you have multiple chassis, advance the Chassis to configure the next chassis after you finish configuring the first chassis. 2. Select the appropriate chassis type for your chassis. This activates the remaining fields on the panel. 3.
Chapter 2 c. Installing and Configuring Your Data Acquisition Hardware Operating Mode—The system defaults to the multiplexed operating mode, which is recommended for almost all SCXI applications. The operating modes available for each SCXI module type are described in the SCXI Operating Modes section of Chapter 19, Hardware and Software Setup for Your SCXI System. If the module is an analog input module, enter the gain and filter settings for each channel in the bottom section of the window.
Chapter 2 Installing and Configuring Your Data Acquisition Hardware Refer to the Channel Name Addressing section of Chapter 3, Basic LabVIEW Data Acquisition Concepts, for information about how to use your named channels in LabVIEW. Now that you have successfully installed and configured your DAQ hardware for LabVIEW, read Chapter 3, Basic LabVIEW Data Acquisition Concepts, for more information about data acquisition with LabVIEW.
3 Basic LabVIEW Data Acquisition Concepts This chapter explains key concepts in understanding how data acquisition works with LabVIEW.
Chapter 3 Basic LabVIEW Data Acquisition Concepts VI libraries (designated by the .llb file extension) and directories located in the daq directory. anlogin Folder containing the anlogin.llb VIs that perform analog input and the strmdsk.llb VIs that can write or stream the acquired data to disk. anlogout Folder containing the anlogout.llb VIs that generate single values or multiple values (waveforms) to output through analog channels. anlog_io Folder containing the anlog_io.
Chapter 3 Basic LabVIEW Data Acquisition Concepts Locating the Data Acquisition VIs in LabVIEW You can find the Data Acquisition VIs in the Functions palette from your block diagram in LabVIEW. When you put your cursor over each of the icons in the Functions palette, LabVIEW displays the palette name you are about to access at the top of the Functions palette. You can find the Data Acquisition icon near the bottom of the Functions palette, as shown in Figure 3-1.
Chapter 3 Basic LabVIEW Data Acquisition Concepts DAQ VI Organization In most of the DAQ VI subpalettes, the VIs are arranged in different levels according to their functionality. You can find some of the following four levels of DAQ VIs within the DAQ VI subpalettes. • Easy VIs • Intermediate VIs • Utility VIs • Advanced VIs A good example of a palette that contains all of the available levels of DAQ VIs is the Analog Input palette. Figure 3-3 shows this palette.
Chapter 3 Basic LabVIEW Data Acquisition Concepts Refer to your particular type of VI in the LabVIEW Function and VI Reference Manual for specific VI information, or refer to the LabVIEW Online Reference, by selecting Help»Online Reference.... Intermediate VIs The Intermediate VIs have more hardware functionality and efficiency in developing your application than the Easy VIs.
Chapter 3 Basic LabVIEW Data Acquisition Concepts VI Parameter Conventions In each LabVIEW DAQ VI front panel or Help window, the appearance of the control and indicator labels denote the importance of that parameter. Control and indicator names in bold typically must be wired to a node on the block diagram for your application to run. Controls and indicators not necessary for your program to operate appear in plain text. You rarely need to use the parameters with labels in square brackets ([ ]).
Chapter 3 Basic LabVIEW Data Acquisition Concepts Default and Current Value Conventions To use the DAQ VIs, you should know the difference between a default input, a default setting, and a current setting. A default input is the default value of a front panel control. When you do not wire an input to a terminal of a VI, the default input for the control associated with that terminal passes to the driver. In the Help window, default inputs appear in parentheses to the right of the parameter names.
Chapter 3 Basic LabVIEW Data Acquisition Concepts Typically, you should wire the iteration input to an iteration terminal in a loop as shown in the following illustration. Wiring the iteration input this way means the device is only configured on the first I/O operation. Subsequent I/O operations use the existing configuration. Error Handling Each Easy VI contains an error handling VI. A dialog box appears immediately if an error occurs in an Easy VI.
Chapter 3 Basic LabVIEW Data Acquisition Concepts Figure 3-5. LabVIEW Error In Input and Error Out Output Error Clusters For more information on error handling, refer to Part VII, Debugging Your Data Acquisition Application, in this manual. Channel, Port, and Counter Addressing The Analog Input and Analog Output VIs have a channel list parameter where you can specify the channels from which the VIs read or to which they write.
Chapter 3 Basic LabVIEW Data Acquisition Concepts Channel Name Addressing If you use the DAQ Channel Wizard to configure your analog and digital channels, you can address your channels by name in the channel list parameter in LabVIEW. channel list can be an array of strings or, as with the Easy VIs, a scalar string control, as shown in Figure 3-6.
Chapter 3 Basic LabVIEW Data Acquisition Concepts are your channels, you can specify a list of channels in a single element by separating the individual channels by commas—for example, 0, 1, 2. Or, because 0 refers to the first channel in a consecutive channel range and 2 refers to the last channel, you can specify the range by separating the first and last channels with a colon—for example, 0:2. Some Easy and Advanced Digital VIs and Intermediate Counter VIs only need one port or counter to be specified.
Chapter 3 Note Basic LabVIEW Data Acquisition Concepts Refer to Appendix B, Hardware Capabilities, in the LabVIEW Function and VI Reference Manual for the number of channels your device can acquire data from at one time, or refer to the LabVIEW Online Reference, by selecting Help»Online Reference.... Limit Settings Limit settings are the maximum and minimum values of the analog signal(s) you are measuring or generating.
Chapter 3 Basic LabVIEW Data Acquisition Concepts array element the same settings in the corresponding limit settings cluster array element. Figure 3-8 illustrates one case of this. Figure 3-8. Limit Settings, Case 1 In this example, channels 0:3 (or 0, 1, 2, and 3) are assigned limits of 10.00 to –10.00. Channel 4 has limits of 5.00 to –5.00. Channels 5, 6, and 7 have limit settings of 1.00 to 0.00.
Chapter 3 Basic LabVIEW Data Acquisition Concepts Function and VI Reference Manual for more information on how to assign limit settings to a particular analog channel using the Advanced VIs, the Group Config VI and the Hardware Config VI, or refer to the LabVIEW Online Reference, by selecting Help»Online Reference.... In analog applications, you not only specify the range of the signal, you must also specify the range and the polarity of the device.
Chapter 3 Basic LabVIEW Data Acquisition Concepts iteration of the outer loop. If you were to label your index selectors for a row major 2D array, the array might look like Figure 3-11. Figure 3-11. 2D Array in Row Major Order You also can organize 2D array data by columns. The Analog Input VIs in LabVIEW organize their data in this way. Each column holds data from one channel, so selecting a column selects a channel. Selecting a row selects a scan of data.
Chapter 3 Basic LabVIEW Data Acquisition Concepts bottom rectangle, the Index Array function produces the entire column of data as a 1D array, as shown in Figure 3-13. Figure 3-13. Extracting a Single Channel from a Column Major 2D Array Analog output buffers that contain data for more than one channel are also column major 2D arrays. To create such an array, first make the data from each output channel a 1D array. Then select the Build Array function from Functions»Array & Cluster.
Where You Should Go Next 4 This chapter directs you to the chapter in the manual best suited to answer questions about your data acquisition application. You answer a series of questions that help determine the purpose of your application. The questions start very broad and narrow in scope until you are referred to a specific section in the manual dealing with your type of application. Note This manual is divided into parts.
Chapter 4 Where You Should Go Next Plug-in DAQ Device Only Analyzing Analog or Digital Signals? Analog Digital Read about the DAQ Channel Wizard in Chapters 2 and 3, and Section 5, SCXI–Getting Your Signals in Great Condition. Digital Latched Counter Digital or Counter Interfacing? Latched or Non-Latched Digital I/O? Read Chapter 17, Shaking Hands with a Digital Partner. Acquisition SCXI Type of Measuring Device? Non-Latched Read Chapter 24, Generating a Square Pulse or Pulse Train.
Chapter 4 Where You Should Go Next Questions You Should Answer 1. Measuring Device: DAQ Device or SCXI Module? Are you working in a noisy environment? If you are, then you may have Signal Conditioning eXtensions for Instrumentation (SCXI) modules connected to your DAQ device or the parallel port of your computer. SCXI modules can filter and isolate noise from signals. They can also amplify low signals. SCXI modules expand the number of channels to acquire or generate data.
Chapter 4 Where You Should Go Next 4. Single-Point or Multiple-Point Acquisition? Do you want to acquire a signal value(s) at one time or over a period of time at a certain rate? If you measure a signal at a given instant of time, you are performing single-point acquisition. If you measure signals over a period of time at a certain rate, then you are performing multiple-point or waveform acquisition. If you want single-point acquisition, refer to Chapter 6, One-Stop Single-Point Acquisition.
Chapter 4 Where You Should Go Next 7. Non-Latched or Latched Digital I/O? If you want your program to read the latest digital input or immediately write a new digital output value, you should use non-latched (immediate) digital I/O. When a DAQ device accepts or transfers data after a digital pulse has been received, it is called latched (handshaked) digital I/O. With latched digital I/O, you can store the values you want to transfer in a buffer.
Part II Catching the Wave with Analog Input This section contains basic information about acquiring data with LabVIEW, including acquiring a single point or multiple points, triggering your acquisition, and using outside sources to control acquisition rates. Part II, Catching the Wave with Analog Input, contains the following chapters: • Chapter 5, Things You Should Know about Analog Input, explains basic concepts on using analog input with LabVIEW.
5 Things You Should Know about Analog Input Hunting has been a part of survival from the beginning of time. People used to hunt for the things they needed to survive, like food and water. Today, engineers and scientists use data acquisition to “hunt down” the information they need to survive in the information age. This chapter focuses on defining the tools you need to be a successful hunter in the world of data acquisition. Defining Your Signal You and your friends plan a hunting trip for this weekend.
Chapter 5 Things You Should Know about Analog Input You might be saying to yourself, “I know that I have a thermocouple and that the primary information (temperature) is contained in the level of the analog voltage. Now I am ready to go hunting!” Well, you are almost ready to hunt, but you first must figure out a few more signal characteristics before you can begin.
Chapter 5 Things You Should Know about Analog Input Floating Signal Sources Floating signal sources contain a signal, such as a voltage, that is not connected to an absolute reference, such as earth or a building ground. Some common examples of floating signals are batteries, battery-powered sources, thermocouples, transformers, isolation amplifiers, and any instrument that explicitly floats its output signal.
Chapter 5 Things You Should Know about Analog Input Choosing Your Measurement System Now that you have defined your signal, you must choose a measurement system. You have an analog signal, so you must convert the signal with an ADC measurement system, which converts your signal into information the computer can understand. Some of the issues you must resolve before choosing a measurement system are your ADC bit resolution, device range, and signal range.
Chapter 5 Things You Should Know about Analog Input Device Range Range refers to the minimum and maximum analog signal levels that the ADC can digitize. Many DAQ devices feature selectable ranges, so you can match the ADC range to that of the signal to take best advantage of the available resolution. For example, in Figure 5-5, the 3-bit ADC, as shown in the left chart, has eight digital divisions in the range from 0 to 10 volts. If you select a range of –10.00 to 10.
Chapter 5 Things You Should Know about Analog Input Signal Limit Settings Limit settings are the maximum and minimum values of the signal you are measuring. A more precise limit setting allows the ADC to use more digital divisions to represent the signal. Figure 5-6 shows an example of this theory. Using a 3-bit ADC and a device range setting of 0.00 to 10.00 volts, Figure 5-6 shows the effects of a limit setting between 0 and 5 volts and 0 and 10 volts.
Chapter 5 Things You Should Know about Analog Input Considerations for Selecting Analog Input Settings The resolution and device range of a DAQ device determine the smallest detectable change in the input signal. You can calculate the smallest detectable change, called the code width, using the following formula. device range codewidth = --------------------------------resolution 2 For example, a 12-bit DAQ device with a 0 to 10 V input range detects a 2.
Chapter 5 Things You Should Know about Analog Input Table 5-1. Measurement Precision for Various Device Ranges and Limit Settings Device Voltage Range Limit Settings Precision1 0 to 10V 0 to 10 V 0 to 5 V 0 to 2.5 V 0 to 1.25 V 0 to 1 V 0 to 0.1 V 0mV to 20 mV 2.44mV 1.22 mV 610 µV 305 µV 244 µV 24.4 µV 4.88 µV –5 to 5V –5 to 5V –2.5 to 2.5 V –1.25 to 1.25 V –0.625 to 0.625 V –0.5 to 0.5 V –50mV to 50 mV –10mV to 10 mV 2.44 mV 1.22 mV 610 µV 305 µV 244 µV 24.4 µV 4.
Chapter 5 Things You Should Know about Analog Input Differential Measurement System In a differential measurement system, you do not need to connect either input to a fixed reference, such as earth or a building ground. DAQ devices with instrumentation amplifiers can be configured as differential measurement systems. Figure 5-7 depicts the 8-channel differential measurement system used in the MIO series devices.
Chapter 5 Things You Should Know about Analog Input In general, a differential measurement system is preferable because it rejects not only ground loop-induced errors, but also the noise picked up in the environment to a certain degree. Use differential measurement systems when all input signals meet the following criteria: • Low-level signals (i.e.
Chapter 5 Things You Should Know about Analog Input Referenced Single-Ended Measurement System A referenced single-ended (RSE) measurement system, is used to measure a floating signal, because it grounds the signal with respect to building ground. Figure 5-9 depicts a 16-channel RSE measurement system. You only should use this measurement system when you need a single-end system and your device does not work with nonreferenced single-ended measurement.
Chapter 5 Things You Should Know about Analog Input Figure 5-10 depicts an NRSE measurement system where AISENSE is the common reference for taking measurements and AIGND is the system ground. All signals must share a common reference at AISENSE. MUX CH0+ CH1+ Instrumentation Amplifier CH2+ + + – CH15+ Vm – AISENSE AIGND Figure 5-10.
Chapter 5 Things You Should Know about Analog Input Channel Addressing with the AMUX-64T An AMUX-64T external multiplexer device expands the number of analog input signals a plug-in DAQ device can measure. You can address AMUX-64T channels when you attach one, two, or four AMUX-64T devices to a plug-in DAQ device. With this device, you can multiplex four, eight, or 16 AMUX-64T channels into one device channel. The scanning order of these AMUX-64T channels is fixed.
Chapter 5 Things You Should Know about Analog Input The AMUX-64T Scanning Order This section explains how LabVIEW scans channels from the AMUX-64T. You must know this scanning order so that you can determine which analog input channel LabVIEW scanned during a data acquisition operation. The scanning counters on the AMUX-64T and on the DAQ device perform automatic scanning of the AMUX-64T analog input channels.
Chapter 5 Things You Should Know about Analog Input Table 5-3 shows the order in which LabVIEW scans the AMUX-64T channels for every DAQ device input channel when you use one or two AMUX-64T devices. Table 5-3 shows the order in which LabVIEW scans the AMUX-64T channels for every DAQ device input channel when you use four AMUX-64T devices. If you want to scan more than one AMUX-64T channel, you must enter the device channels in your scan list. Table 5-3.
Chapter 5 Things You Should Know about Analog Input Table 5-4.
Chapter 5 Channel List Parameter Things You Should Know about Analog Input Channel Specified AMy!x Channel x on AMUX-64T device y. AM4!8 Channel 8 on AMUX-64T device 4. You refer to AMUX-64T channels only when a single AMUX-64T channel comprises the entire list. Otherwise, you refer to them indirectly through the device channels that you use to scan the AMUX-64T channels.
6 One-Stop Single-Point Acquisition This chapter shows you how to acquire one data point from a single channel and then one data point from each of several channels using LabVIEW. Single-Channel, Single-Point Analog Input A single-channel, single-point analog input is an immediate, non-buffered operation. In other words, the software reads one value from an input channel and immediately returns the value to you. This operation does not require any buffering or timing.
Chapter 6 One-Stop Single-Point Acquisition Figure 6-2 shows how you program the Acquire 1 Point from 1 Channel VI, located in labview\examples\daq\anlogin\anlogin.llb, using the AI Sample Channel VI to acquire data. Figure 6-2. Acquiring Data Using the Acquire 1 Point from 1 Channel VI The Acquire 1 Point from 1 Channel VI initiates an A/D conversion on the DAQ device and returns the scaled value as an output. The high limit is the highest expected level of the signals you want to measure.
Chapter 6 One-Stop Single-Point Acquisition Multiple-Channel Single-Point Analog Input With a multiple-channel, single-point read (or scan), LabVIEW returns the value on several channels at once. Use this type of operation when you have multiple transducers to monitor and you want to retrieve data from each transducer at the same time. Your DAQ device executes a scan across each of the specified channels and returns the values when finished.
Chapter 6 One-Stop Single-Point Acquisition also offer more error handling control, more hardware functionality, and efficiency in developing your application than the Easy VIs. You typically use the Intermediate VIs to perform buffered acquisitions. You can read more about buffered acquisitions in Chapter 7, Buffering Your Way through Waveform Acquisition. The Intermediate Analog Input VI, AI Single Scan VI, does multiple-channel, single-point acquisitions, as shown in Figure 6-4. Figure 6-4.
Chapter 6 One-Stop Single-Point Acquisition The advantage to using the intermediate-level VIs is that you do not have to configure the channels every time you want to acquire data as you do when using the Easy VIs. To call the AI Config VI only once, put it outside of the While Loop in your program. The AI Config VI configures channels, selects a high/low limit, and generates a taskID.
Chapter 6 One-Stop Single-Point Acquisition Using Analog Input/Output Control Loops When you want to output analog data after receiving some analog input data, use analog input/output (I/O) control loops. With control loops, this process is repeated over and over again. The single-point analog input and output VIs support several analog I/O control loops at once because you can acquire analog inputs from several different channels in one scan, and write all the analog output values with one update.
Chapter 6 One-Stop Single-Point Acquisition The following diagram shows how to perform software-timed analog I/O using the AI Read One Scan and AO Write One Update VIs. Figure 6-7. Software-Timed Analog I/O The AI Read One Scan VI configures your DAQ device to acquire data from analog input channels 0 and 1. Once your program acquires a data point from channels 0 and 1, it performs calculations on the data and outputs the results through analog output channels 0 and 1.
Chapter 6 One-Stop Single-Point Acquisition With hardware-timed control loops, your acquisition is not interrupted by user interaction. Hardware-timed analog input automatically places the data in your DAQ device FIFO buffer at an interval determined by the analog input scan rate. You can synchronize your control loop diagram to this precise analog input scan rate by repeatedly calling the AI Single Scan VI to read the oldest data in the FIFO.
Chapter 6 One-Stop Single-Point Acquisition acquisition at the loop rate (scan rate) parameter. On the first iteration of the loop, the AI Single Scan VI reads the newest data in the FIFO. Some data may have been acquired between the execution of the AI Start and the AI Single Scan VIs. On the first iteration of the loop, the application reads the latest data acquired between the AI Start and the AI Single Scan VIs.
Chapter 6 One-Stop Single-Point Acquisition your analog input by using a Wait (ms) or Wait Until Next ms Multiple function together with the AI Single Scan VI in a while loop within your control loop diagram. Set the wait time smaller than your control loop interval (at least half as small). If the scaled data output array is not empty, exit the polling loop passing out the scaled data array and execute the rest of your control loop diagram.
Buffering Your Way through Waveform Acquisition 7 If you want to take more than one reading on one or more channels, there are two techniques you can use depending on what you want to do with the data after you acquire it. This chapter reviews these different methods and explains how LabVIEW stores the acquired data with each method. You will discover which method you should use by answering the following questions.
Chapter 7 Buffering Your Way through Waveform Acquisition you can use a data buffer in computer memory as your shopping bag with which you acquire data. With buffered I/O, LabVIEW transfers data taken at timed intervals from a DAQ device to a data buffer in memory. Figure 7-1 illustrates how the data fills up the buffer only once, however the overall size of the buffer is specified in your VI.
Chapter 7 Note Buffering Your Way through Waveform Acquisition If you set up your channel in the DAQ Channel Wizard, you do not need to enter the device or input limits. Instead, enter a channel name in the channel input, and the value returned is relative to the physical units you specify for that channel in the DAQ Channel Wizard. If input limits are specified, they also are treated as relative to the physical units of the channel. LabVIEW ignores the device input when channel names are used.
Chapter 7 Buffering Your Way through Waveform Acquisition You also can acquire multiple waveforms using the Intermediate VIs. The Intermediate VIs provide more control over your data acquisition processes, like being able to read any part of the buffer. An example similar to Figure 7-4 is the Acquire N Scans VI, located in labview\examples\ daq\anlogin\anlogin.llb.
Chapter 7 Buffering Your Way through Waveform Acquisition For many DAQ devices, the same ADC samples many channels instead of only one. The maximum sampling rate per channel is maximum sampling rate ----------------------------------------------------------------number of channels The scan rate input in all the VIs described above is the same as the sampling rate per channel. To figure out your maximum scan rate, you must divide the maximum sampling rate by the number of channels.
Chapter 7 Buffering Your Way through Waveform Acquisition Figure 7-5. Simple Buffered Analog Input Example If you want to display the data on the same graph, look again at the Acquire N Scans example VI, found in labview\examples\daq\anlogin\ anlogin.llb. Figure 7-6 shows a simple buffered input application that uses graphing. Figure 7-6. Simple Buffered Analog Input with Graphing For a 2D array to be displayed on a waveform graph, each row of data must represent a single plot.
Chapter 7 Buffering Your Way through Waveform Acquisition Simple-Buffered Analog Input with Multiple Starts In some cases, you might not want to acquire contiguous data, like in an oscilloscope application. In this case, you would only want to take a specified number of samples as a snapshot of what the input looks like periodically. For an example using the Intermediate VIs, open the Acquire N-Multi-Start VI found in labview\examples\daq\anlogin\ anlogin.llb.
Chapter 7 Buffering Your Way through Waveform Acquisition your program, read the Do You Need To Access Your Data during Acquisition? section in this chapter to see how to control acquisition start-up times. Simple-Buffered Analog Input with a Write to Spreadsheet File If you want to write the acquired data to a file, there are many file formats in which you can store the data.
Chapter 7 Buffering Your Way through Waveform Acquisition (your acquired data) as possible, so that you only have to make one trip to the store. In this case, imagine that you must prepare a meal and you are unable to go shopping—yet periodically you need things from the store for your recipe. If you send someone else to the store for you, you can continue to prepare dinner while someone else retrieves the other items you need.
Chapter 7 Buffering Your Way through Waveform Acquisition Because of the buffer maintenance, you can only use the Intermediate or Advanced VIs with this type of data acquisition.
Chapter 7 Buffering Your Way through Waveform Acquisition Figure 7-10. Continuously Acquiring Data with the Intermediate VIs Because this uses Intermediate VIs, you also can control parameters such as triggering, coupling, and additional hardware. Asynchronous Continuous Acquisition Using DAQ Occurrences The main advantage of the last section is that you are free to manipulate your data between calls to AI Read.vi. One limitation, however, is that the acquisition is synchronous.
Chapter 7 Buffering Your Way through Waveform Acquisition where general value A is the number of scans to read at a time. Inside the while loop, the Wait on Occurrence function sleeps in the background until the chosen DAQ Event takes place. Notice that the timed out output from the Wait on Occurrence function is wired to the selection terminal of the case structure that encloses the AI Read VI. This means that AI Read will not be called until the number of scans to read at a time have been acquired.
Chapter 7 Buffering Your Way through Waveform Acquisition AI Read VI repeatedly to retrieve your data. These changes can be applied to many of the examples in the previous section on simple buffered analog input, however we will review the basic circular-buffered analog input VI here, and describe some other example VIs that are included with LabVIEW.
Chapter 7 Buffering Your Way through Waveform Acquisition daq\anlogin\anlogin.llb and the rest of the example VIs in labview\examples\daq\anlogin\strmdsk.llb. For information on how these examples work and how to modify them, open Windows»Show VI Information or open the Help window by choosing Help»Show Help. Cont Acq&Chart (buffered).vi The Cont Acq&Chart (buffered).vi demonstrates circular-buffered analog input similarly to the previous example, but this VI includes other front panel inputs.
Controlling Your Acquisition with Triggers 8 The single-point and waveform acquisitions described in the previous sections start at random times relative to the data. But, there are times that you may need to be able to set your analog acquisition to start at a certain time. An example of this would be if you wanted to measure the temperature of an object after applying heat to it. An electrical thermometer sends a step voltage to your data acquisition (DAQ) device after the heating process completes.
Chapter 8 Controlling Your Acquisition with Triggers Digital Triggering A digital trigger is usually a transistor-transistor logic (TTL) level signal having two discrete levels—a high and a low level. When moving from high to low or low to high, a digital edge is created. There are two types of edges: rising and falling. You can set your analog acquisition to start as a result of the rising or falling edge of your digital trigger signal.
Chapter 8 Controlling Your Acquisition with Triggers Figure 8-2 shows a timeline of how digital triggering works for post-triggered data acquisition. In this example, an external device sends a trigger, or TTL signal, to your DAQ device. As soon as your DAQ device receives the signal, and your trigger conditions are met, your device begins acquiring data. External Device Digital Trigger Signal DAQ Device DAQ Device waits for digital trigger conditions.
Chapter 8 Controlling Your Acquisition with Triggers Digital Triggering Examples A common example of digital triggering in LabVIEW is the Acquire N Scans Digital Trig VI, found in labview\examples\daq\anlogin\ anlogin.llb. This VI, as shown Figure 8-3, uses the Intermediate VIs to perform a buffered acquisition, where LabVIEW stores data in a memory buffer during acquisition. After the acquisition completes, the VI retrieves all the data from the memory buffer and displays it.
Chapter 8 Controlling Your Acquisition with Triggers to the LabVIEW Online Reference, available by selecting Help»Online Reference…. In LabVIEW, you can acquire data both before and after a digital trigger signal. If the pretrigger scans is greater than 0, your device acquires data before the triggering conditions are met and subtract the pretrigger scans value from the number of scans to acquire value to determine the number of scans to collect after the triggering conditions are met.
Chapter 8 Controlling Your Acquisition with Triggers In Figure 8-4, the analog trigger is set to start the data acquisition on the rising slope of the signal, when the signal reaches 3.2. 3.2 ———————— ————————————— Level and Slope of Signal Initiates Data Capture 0 Figure 8-4. Diagram of an Analog Trigger Figure 8-5 explains analog triggering for post-triggered data acquisition using a timeline.
Chapter 8 Controlling Your Acquisition with Triggers Analog Triggering Examples A common example of analog triggering in LabVIEW is the Acquire N Scans Analog Hardware Trig VI, located in labview\examples\ daq\anlogin\anlogin.llb. This VI, as shown in Figure 8-6, uses the Intermediate VIs to perform buffered acquisition, where data is stored in a memory buffer during acquisition. After the acquisition completes, the VI retrieves all the data from the memory buffer and displays it. Figure 8-6.
Chapter 8 Controlling Your Acquisition with Triggers trigger channel where the analog triggering signal will be connected as well as the trigger level on the triggering signal needed to begin acquisition. In other words, once you specify the channel of the triggering signal, LabVIEW will wait until the slope and trigger level conditions are met before starting a buffered acquisition.
Chapter 8 Controlling Your Acquisition with Triggers Signal Checked for Trigger Conditions External Device DAQ Device Rest of Data When trigger conditions are met (at Scan 4) … When Offset = 0 read/search position Scan Scan Scan Scan Scan Scan Scan Scan 1 2 3 4 5 6 7 8 Start reading data When Offset < 0 read/search position Scan Scan Scan Scan Scan 5 1 2 3 4 Scan Scan Scan 6 7 8 Offset Start reading data When Offset > 0 Scan Scan 2 1 read/search position Scan Scan Scan Scan 5 6 3 4 Offset
Chapter 8 Controlling Your Acquisition with Triggers The conditional retrieval cluster of the AI Read VI specifies the analog signal conditions of retrieval, as shown in Figure 8-8. Figure 8-8. The AI Read VI Conditional Retrieval Cluster Note Remember that the actual data acquisition is started by running your VI and that the conditional retrieval just controls the returning of data already being acquired.
Chapter 8 Controlling Your Acquisition with Triggers If you are using channel names configured in the DAQ Channel Wizard, level and hysteresis are treated as being relative to the physical units specified for the channel. If you are not using channel names, these inputs are treated as volts.
9 Letting an Outside Source Control Your Acquisition Rate Typically, a data acquisition (DAQ) device uses internal counters to determine the rate to acquire data, but sometimes you might need to capture your data at the rate of particular signals in your system. For example, you can also read temperature channels every time a pulse occurs which represents pressure rising above a certain level. In this case, internal counters are inefficient for your needs.
Chapter 9 Letting an Outside Source Control Your Acquisition Rate Some DAQ devices do not have scan clocks, but rather use round-robin scanning. Figure 9-2 shows an example of round-robin scanning. 0 1 2 3 0 1 2 3 0 1 2 3 channel interval Figure 9-2.
Chapter 9 Letting an Outside Source Control Your Acquisition Rate You can set your channel clock rate with the interchannel delay input of the AI Config VI, which calls the Advanced AI Clock Config VI to actually configure the channel clock. The simplest method to select an interchannel delay is to gradually increase the delay, or clock period, until the data appears consistent with data from the previous delay setting. Refer to your hardware manuals for the required settling time for your channel clock.
Chapter 9 Letting an Outside Source Control Your Acquisition Rate Figure 9-4 shows you the Acquire N Scans-ExtChanClk VI, located in labview\examples\daq\anlogin\anlogin.llb. This example demonstrates how to set up your acquisition for an externally controlled channel clock. The VI includes the AI Clock Config VI and the clock source was connected to the I/O connector. Figure 9-4.
Chapter 9 Letting an Outside Source Control Your Acquisition Rate On most devices, external conversions occur on the falling edge of the EXTCONV* line. Consult your hardware reference manual for timing diagrams. On devices with PFI lines (e.g., E-series devices), you can set the Clock Source Code input of AI Clock Config VI to the PFI pin with either falling or rising edge or use the default PFI2/Convert* pin where the conversions occur on the falling edge, as shown in Figure 9-5. Figure 9-5.
Chapter 9 Letting an Outside Source Control Your Acquisition Rate Externally Controlling Your Scan Clock External scan clock control may be more useful than external channel clock control if you are sampling multiple channels, but may not be as obvious to find because it does not have the input on the I/O connector labeled ExtScanClock, the way the EXTCONV* pin does. Note Some MIO devices have an output on the I/O connector labeled SCANCLK. This cannot be used as an input.
Chapter 9 Letting an Outside Source Control Your Acquisition Rate Figure 9-6. Externally Controlling Your Scan Clock with the Getting Started Analog Input Example VI The NB-MIO-16X cannot support external scan clocks as the other devices can. The device layout does not allow you to directly provide an external scan clock. Instead, you can offer a timebase to the internal counter, counter 5, that generates the scan clock.
Chapter 9 Letting an Outside Source Control Your Acquisition Rate Externally Controlling the Scan and Channel Clocks You can control the scan and channel clocks simultaneously by combining the two previous sections. However, make sure that you follow the proper timing. Figure 9-7 demonstrates how you can set up your application to control both clocks. Figure 9-7.
Part III Making Waves with Analog Output This section contains basic information about generating data with LabVIEW, including generating a single point or multiple points. Part III, Making Waves with Analog Output, contains the following chapters: • Chapter 10, Things You Should Know about Analog Output, explains how to use LabVIEW to produce all of the different types of analog output signals.
Things You Should Know about Analog Output 10 Some measuring systems require that analog signals be generated by a data acquisition (DAQ) device. Each of these analog signals can be a steady or slowly changing signal, or a continuously changing waveform. The next few sections show you how to use LabVIEW to produce all of these different types of signals. First, you should learn about the various situations in which you might need to produce an analog signal.
Chapter 10 Things You Should Know about Analog Output generate a continually changing waveform? For example, you might have a large file stored on disk that contains data you want to output. Because LabVIEW cannot store the entire waveform in a single buffer, you must continually load new data into the buffer during the generation. This process requires the use of circular-buffered analog output in LabVIEW.
One-Stop Single-Point Generation 11 In the preceding chapter, you learned the appropriate time to use single-point updates. This chapter shows you which VIs to use in LabVIEW to perform these updates. Single-Immediate Updates The most basic way to program single-point updates in LabVIEW is by using the Easy Analog Output VI, AO Update Channels. Figure 11-1 shows a diagram of a VI that writes values to one or more output Channels on the output data acquisition (DAQ) Device. Figure 11-1.
Chapter 11 One-Stop Single-Point Generation While Figure 11-1 shows how to write values for multiple channels, Figure 11-2 shows the diagram of the Generate 1 Point on 1 Channel VI located in labview\examples\daq\anlogout\anlogout.llb, which generates one value for one channel. Figure 11-2.
Chapter 11 One-Stop Single-Point Generation Multiple-Immediate Updates Figure 11-4 shows the block diagram of a VI that performs multiple updates. The Write N Updates example VI, located in labview\examples\daq\anlogout\anlogout.llb, is similar to Figure 11-4. The diagram shown in Figure 11-4 resembles the one shown in Figure 11-3, except that the While Loop executes the subVI repeatedly until either the error status or the stop Boolean is TRUE.
Buffering Your Way through Waveform Generation 12 In Chapter 10, Things You Should Know about Analog Output, you learned when to use buffered analog updates. This chapter shows you which VIs to use in LabVIEW to perform these updates. Buffered Analog Output You can program single-buffered analog output in LabVIEW using an Easy Analog Output VI, AO Generate Waveforms VI, as shown in Figure 12-1. This VI writes an array of output values to the analog output channels at a rate specified by update rate.
Chapter 12 Buffering Your Way through Waveform Generation Figure 12-1. Waveform Generation Using the AO Generate Waveforms VI As with single-point analog output, you can use the Analog Output Utility VI, AO Waveform Gen VI, for most of your programming needs. This VI has several inputs and outputs that the Easy I/O VI does not have. You have the option of having the data array generated once, several times, or continuously through the generation count input.
Chapter 12 Buffering Your Way through Waveform Generation information on limit settings, refer to Chapter 3, Basic LabVIEW Data Acquisition Concepts. If you want even more control over your analog output application, use the set of Intermediate DAQ VIs, as shown in Figure 12-3. Figure 12-3. Waveform Generation Using Intermediate VIs With these VIs, you can set up an alternate update clock source (such as an external clock or a clock signal coming from another device) or return the update rate.
Chapter 12 Buffering Your Way through Waveform Generation Changing the Waveform during Generation: Circular-Buffered Output When the waveform data is too large to fit in a memory buffer or is constantly changing, use a circular buffer to output the data.
Chapter 12 Buffering Your Way through Waveform Generation To gain more control over your analog output application, use the Intermediate VIs shown in Figure 12-5. With these VIs, you can set up an alternate update clock source and you can monitor the update rate the VI actually uses. The AO Config VI sets up the channels you specify for analog output. The AO Write VI places the data in a buffer. The AO Start VI begins the actual generation at the update rate.
Chapter 12 Buffering Your Way through Waveform Generation Eliminating Errors from Your Circular-Buffered Application If you get error number –10843 underFlowErr, while performing circular-buffered output, it means your program can not write data fast enough to the buffer to output the data at the update rate. To solve this problem, decrease the speed of the update rate. If adjusting the update rate does not get rid of the error in your application, increase the buffer size.
Chapter 12 Buffering Your Way through Waveform Generation You can use this VI in conjunction with the Cont Acq to File (scaled) VI, located in labview\examples\daq\anlogin\anolgin.llb. The Display and Output Acq’d File (scaled) VI also is described in Chapter 7, Buffering Your Way through Waveform Generation. After running the Cont Acq to File (scaled) VI and saving your acquired data to disk, you can run the Display and Output Acq’d File (scaled) VI to generate your data from the file you created.
13 Letting an Outside Source Control Your Update Rate Data acquisition (DAQ) devices use internal counters and timers to determine the rate of data generation. However, you might encounter times when you need to generate data in synch with other signals in your system. For example, you might need to output data to a test circuit every time that test circuit emits a pulse. In this case, internal counter/timers are inefficient for your needs.
Chapter 13 Letting an Outside Source Control Your Update Rate Figure 13-1. Generate N Updates-ExtUpdateClk VI To use an external update clock, you must set the clock source of the AO Start VI to I/O connector. When you connect your external clock, you find that different DAQ devices use different pins for this input. However, if you select Show VI Info… in the Windows menu of the example VI, you find that all the I/O connections are explained for you. These input pins also are described in Table 13-1.
Chapter 13 Letting an Outside Source Control Your Update Rate Supplying an External Test Clock from Your DAQ Device Suppose you want to use this external update clock approach, but you do not have your external clock available. You can create an external test clock using outputs from a counter/timer on your DAQ device, and then wire the output to your external update clock source.
Simultaneous Buffered Waveform Acquisition and Generation 14 In Chapter 7, Buffering Your Way through Waveform Acquisition, you learned how to acquire multiple data points via an intermediate software buffer. In Chapter 12, Buffering Your Way through Waveform Generation, you learned how to generate multiple points of data by first writing them to a software buffer. This chapter describes how to perform buffered waveform acquisition and generation simultaneously on the same DAQ device.
Chapter 14 Simultaneous Buffered Waveform Acquisition and Generation Software Triggered Figure 14-1 shows the diagram of the Simul AI/AO Buffered (E-series MIO) VI located in labview\examples\daq\anlog_io\ anlog_io.llb. Figure 14-1. Simultaneous Input/Output Using the Simul AI/AO Buffered (E-series MIO) VI This example VI uses familiar Intermediate DAQ VIs. This example VI uses the same VIs you used for analog input in Chapter 7—AI Config, AI Start, AI Read, and AI Clear—for waveform acquisition here.
Chapter 14 Simultaneous Buffered Waveform Acquisition and Generation Once you call the AO Start and AI Start VIs, the While Loop executes. Inside the While Loop, the AI Read VI returns acquired data from the analog input buffer. There is not a call to the AO Write VI inside the While Loop because it is not needed if the same data from the first AO Write VI is regenerated continuously. If you want to generate new data each time the While Loop iterates, you could add an AO Write VI inside the While Loop.
Chapter 14 Simultaneous Buffered Waveform Acquisition and Generation Although this VI is similar to the example in Figure 14-1, it is more advanced because it uses a hardware trigger. The waveform acquisition trigger is set up with the trigger type input to the AI Start VI set to digital A (start), and by default this trigger is expected on the PFI0 pin. Hardware triggering for waveform generation requires an additional VI.
Chapter 14 Simultaneous Buffered Waveform Acquisition and Generation Figure 14-3. Simultaneous Input/Output Using the Simul AI/AO Buffered (Legacy MIO) VI Because legacy MIO-type boards have only one clock available for signal acquisition (scan timing) and generation (update timing), the same clock is used for both. The acquisition uses counter 2 by default. The generation is set up to use the I/O connector at the clock source input to the AO Start VI.
Chapter 14 Simultaneous Buffered Waveform Acquisition and Generation Hardware Triggered Figure 14-4 shows the diagram of the Simul AI/AO Buffered Trigger (legacy MIO) VI located in labview\examples\daq\anlog_io\ anlog_io.llb. Figure 14-4. Simultaneous Input/Output Using the Simul AI/AO Buffered Trigger (Legacy MIO) VI The only difference between this example VI and the example in Figure 14-3 is the trigger type input to the AI Start VI is set to digital A (start) trigger.
Chapter 14 Simultaneous Buffered Waveform Acquisition and Generation Using Lab/1200 Boards Lab/1200 boards, such as the Lab-PC-1200 or the DAQCard-1200, also can perform simultaneous waveform acquisition and generation. The approach is very similar to the previous descriptions. Refer to the examples Simul AI/AO Buffered (Lab/1200) VI and Simul AI/AO Buffered Trigger (Lab/1200) VI located in labview\examples\daq\anlog_io\ anlog_io.llb to see how this acquisition and generation is performed.
Part IV Getting Square with Digital I/O This section describes basic concepts about how to use digital signals with data acquisition in LabVIEW, including immediate and handshaked digital I/O. Part IV, Getting Square with Digital I/O, contains the following chapters: • Chapter 15, Things You Should Know about Digital I/O, explains basic concepts on digital I/O. • Chapter 16, When You Need It Now— Immediate Digital I/O, explains how to use digital lines to acquire and generate data immediately.
15 Things You Should Know about Digital I/O Digital I/O interfaces are often used to control processes, generate patterns for testing, and communicate with peripheral equipment like heaters, motors, and lights. Digital I/O components on DAQ devices and SCXI modules consist of hardware parts that generate or accept binary on/off signals. As shown in the diagram below, all digital lines are grouped into ports on DAQ devices and banks on SCXI modules.
Chapter 15 Things You Should Know about Digital I/O Types of Digital Acquisition/Generation There are two types of digital acquisition/generation—nonlatched (or immediate) and latched (or handshaked). With nonlatched or immediate digital I/O, your system updates the digital lines immediately. Latched or handshaked digital I/O is when a device or module accepts or transfers data after a digital pulse has been received. There are two types of latched (handshaked) digital I/O: non-buffered and buffered.
When You Need It Now— Immediate Digital I/O 16 This chapter focuses on transferring data across a single port. The most common way to use digital lines is with nonlatched (immediate) digital I/O. All DAQ devices and SCXI modules with digital components support this mode. When your program calls a function in nonlatched digital I/O mode, LabVIEW immediately updates the digital line or port output state or returns the current digital value of an input line, depending on the digital line direction.
Chapter 16 When You Need It Now— Immediate Digital I/O You can use the Easy Digital VIs for nonlatched digital I/O. Figure 16-1 shows the Easy VIs and their various inputs and outputs. The four Easy VIs can read data from or write data to a single digital line or to an entire port immediately. For an example of how to use the Easy Digital VIs, refer to the Read 1 Point from Digital Line and Write 1 Point to Digital Line VIs in labview\examples\daq\digital\digio.llb.
Chapter 16 When You Need It Now— Immediate Digital I/O As an alternative, digital channel can consist of a port number. The port number specifies the port of digital lines that you will use during your digital operation. In this case, you must also specify device, line, and port width where applicable to further define your digital operation. The device input identifies the DAQ device you are using. The line input is an individual port bit or line in the port specified by digital channel.
17 Shaking Hands with a Digital Partner You have just learned that in LabVIEW using non-latched (immediate) digital I/O, you can use digital lines to acquire and generate data. But what if you want to pass a digital pattern after receiving a digital pulse? In this case, you should use latched digital I/O, also called handshaking. For example, you may want to acquire an image from a scanner. The scanner sends a pulse to your DAQ device after the image has been scanned and it is ready to transfer the data.
Chapter 17 Shaking Hands with a Digital Partner Another example of when you can use handshaking is if you wanted to test the durability of a product prototype. Each durability test would be performed with a different piece of machinery for the same amount of time. For each test, you can turn the machinery on and off with a specific variation of handshaked digital I/O, known as pattern generation. Internal counters would serve to generate the handshaking signal that initiates a digital transfer.
Chapter 17 Shaking Hands with a Digital Partner Sending Out Multiple Digital Values You can group multiple ports together so you can send more digital values out at a time. The order of grouped ports affects which handshaking lines you use. If you want to group ports 0 and 1 and you list the ports in the order of 0:1, then you should use the handshaking lines associated with port 1. In other words, always use the handshaking lines associated with the last port in the list.
Chapter 17 Shaking Hands with a Digital Partner If you use more than one port or grouping ports for digital output on DAQ devices other than DIO-32 Series devices, connect only the handshaking signals of the last port in the port list, as shown in Figure 17-2. ACK* Port x 1 OBF* ACK* Port x 2 OBF* ACK* Port x n External Device OBF* (last port in portList) Figure 17-2. Connecting Digital Signal Lines for Digital Output There are two types of digital handshaking: non-buffered and buffered.
Chapter 17 Shaking Hands with a Digital Partner You can use only Intermediate or Advanced Digital VIs for digital handshaking in LabVIEW. The Intermediate VIs work for most all non-buffered and buffered digital handshaking applications. However, for some DAQ devices, you may need to use a combination of Intermediate and Advanced VIs. Non-Buffered Handshaking Non-buffered handshaking takes place when your program transfers one digital value after receiving a digital pulse on the handshaking lines.
Chapter 17 Shaking Hands with a Digital Partner equal to 1 (default), all the ports listed in port list are treated as inputs. The number of elements in the data read input will be the same as the product of the number of ports in the group and the number to read input. Figure 17-4 shows how you can use non-buffered handshaking to write data. The programming flow resembles the read operation above.
Chapter 17 Shaking Hands with a Digital Partner Simple Buffered Examples The block diagram in Figure 17-5 uses the Intermediate VIs to perform pattern generation using the DIO-32 Series devices. An example VI included with LabVIEW similar to the diagram below is the Digital Buffered Handshaking VI, found in labview\examples\daq\ digital\digio.llb. Notice the port list contains more than one port number, which means the ports are grouped together. Figure 17-5.
Chapter 17 Shaking Hands with a Digital Partner For DAQ devices other than the DIO-32 Series devices, you can use a VI similar to the one above to output digital data. The main difference is that you use an Advanced Digital VI, DIO Buffer Control, instead of the DIO Start VI, as shown in Figure 17-6. You should use the DIO Buffer Control VI because the DIO Start VI contains Digital Clock Config and Digital Mode Config VIs that work only with the DIO-32 Series devices.
Chapter 17 Shaking Hands with a Digital Partner For the other devices that support digital handshaking, the example would be the same as above except the handshaking mode input would be deleted from the DIO Config VI and the DIO Start VI would be replaced with the DIO Buffer Control VI. Also, you do not need the handshake source and clock frequency inputs for most devices, because of the external handshaking signal source. Figure 17-8 shows the VI used for all DAQ devices other than the DIO-32 Series.
Chapter 17 Shaking Hands with a Digital Partner Figure 17-9 shows an example of a circular-buffered application. In this example, you are reading or writing digital values continually until you stop the VI or an error occurs. In order to create a circular buffer, you must create a buffer that is at least twice as large as the number of scans/updates you want to read at a time. You can have an internal or external handshake source.
Part V SCXI—Getting Your Signals in Great Condition This section contains basic information about setting up and using SCXI modules with your data acquisition application, special programming considerations, common SCXI applications, and calibration information. Part V, SCXI—Getting Your Signals in Great Condition, contains the following chapters: • Chapter 18, Things You Should Know about SCXI, includes basic concepts on how to use SCXI modules with LabVIEW for data acquisition.
Things You Should Know about SCXI 18 Signal Conditioning eXtensions for Instrumentation (SCXI) is a highly-expandable signal conditioning system. The next few chapters describe the basic concepts of signal conditioning, the setup procedure for SCXI hardware, the hardware operating modes, the procedure for software installation and configuration, the special programming considerations for SCXI in LabVIEW, and some common SCXI applications.
Chapter 18 Things You Should Know about SCXI Table 18-1. Phenomena and Transducers (Continued) Phenomena Transducer Position (displacement) Potentiometers Linear voltage differential transformer (LVDT) Optical encoder Fluid flow Head meters Rotational flowmeters Ultrasonic flowmeters pH pH electrodes To measure signals from transducers, you must convert them into a form that a data acquisition (DAQ) device can accept.
Chapter 18 Things You Should Know about SCXI Transducers/Signals Signal Conditioning Thermocouples Amplification, Linearization, and Cold-Junction Compensation RTDs Current Excitation, Four Wire and Three Wire Configuration, Linearization Strain Gauges Voltage Excitation Bridge Configuration, and Linearization Common Mode or High Voltages Isolation Amplifiers (Optical Isolation) Loads Requiring AC Switching or Large Current Flow Electromechanical Relays or Solid-State Relays Signals with High
Chapter 18 Things You Should Know about SCXI Note You can minimize noise that lead wires pick up by using shielded cables or a twisted pair of cables, and by minimizing wire length. Also, keeping signal wires away from AC power cables and monitors will help reduce 50 Hz or 60 Hz noise. If you amplify the signal at the DAQ device, the signal is measured and digitized with noise that may have entered the lead wires.
Chapter 18 Things You Should Know about SCXI Transducer Excitation Signal conditioning systems can generate excitation for some transducers. Strain gauges and RTDs require external voltage and currents, respectively, to excite their circuitry into measuring physical phenomena. This type of excitation is similar to a radio which needs power to receive and decode audio signals.
Hardware and Software Setup for Your SCXI System 19 SCXI hardware provides signal conditioning close to the signal source and increases the number of analog and digital signals that can be analyzed by a data acquisition (DAQ) device. With PC compatible computers, SCXI can be configured in two ways—a front-end signal conditioning system for plug-in DAQ devices, or an external data acquisition and control system.
Chapter 19 Hardware and Software Setup for Your SCXI System Figure 19-2 shows the components of an SCXI system. An SCXI system consists of an SCXI chassis that houses signal conditioning modules, terminal blocks that plug directly into the front of the modules, and a cable assembly that connects the SCXI system to a plug-in DAQ device or the parallel or serial port of a computer.
Chapter 19 Hardware and Software Setup for Your SCXI System Appendix B, Hardware Capabilities, in the LabVIEW Function and VI Reference Manual, or refer to the LabVIEW Online Reference, by selecting Help»Online Reference…. Conditioned Signals to DAQ Board or Parallel Port SC XI- 10 00 SC MA IN XI FR AM E Analog and Digital Bus Backplane Unconditioned Signals from Transducers Figure 19-3.
Chapter 19 Hardware and Software Setup for Your SCXI System SCXI Operating Modes The SCXI operating mode determines the way that DAQ devices access signals. There are two basic operating modes for SCXI modules, multiplexed and parallel. You designate the mode in the operating mode input in the configuration utility. Also, you may have to set up jumpers on the module for the correct operating mode. Check your SCXI module user manual for more information.
Chapter 19 Hardware and Software Setup for Your SCXI System Make sure that you change the jumper in the SCXI-1200 to the ground position to connect the SCXI-1200 and SCXIbus grounds together. Refer to the SCXI-1200 User Manual for more details. Multiplexed Mode for Analog Output Modules Because LabVIEW communicates with the multiplexed modules over the SCXIbus backplane, you must only cable one multiplexed module in each chassis to a DAQ device to communicate with any multiplexed modules in the chassis.
Chapter 19 Hardware and Software Setup for Your SCXI System When you use the analog input VIs, specify the correct onboard channel for each parallel SCXI channel. If you are using a range of SCXI channels, LabVIEW assumes the onboard channel numbers match the SCXI channel numbers. Refer to the SCXI Channel Addressing section in Chapter 20, Special Programming Considerations for SCXI, for the proper SCXI channel syntax.
Special Programming Considerations for SCXI 20 When you want LabVIEW to acquire data from SCXI analog input channels, you use the analog input VIs in the same way that you acquire data from onboard channels. You also read and write to your SCXI relays and digital channels using the digital VIs in the same way that you read and write to onboard digital channels. You can write voltages to your SCXI analog output channels using the analog output VIs.
Chapter 20 Special Programming Considerations for SCXI the data from the first cabled chassis. If you use VXI-SC submodules, LabVIEW ignores the onboard channel, since VXI-DAQ provides a special channel for retrieving data from submodules. Channel List Element Channel Specified OBz!SCx!MDy!a Channel a on the module in slot y of the chassis with ID x is multiplexed into onboard channel z.
Chapter 20 Special Programming Considerations for SCXI SCXI Gains SCXI modules provide higher analog input gains than those available on most DAQ plug-in devices. Note Before reading this section, you should have already read the Limit Settings section in Chapter 3, Basic LabVIEW Data Acquisition Concepts. Enter the gain jumper settings in the NI-DAQ Configuration utility for each channel on each module with jumpered gains. LabVIEW stores these gain settings and uses them to scale the input data.
Chapter 20 Special Programming Considerations for SCXI in Table 20-1 illustrate this method. The last example shows a channel list with two modules. Table 20-1. SCXI-1100 Channel Arrays, Input Limits Arrays, and Gains Array Index SCXI-1100 Channel List Array Input Limits Array LabVIEW Selected SCXI Gain LabVIEW Selected MIO/AI Gain 0 ob0!sc1!md1!0:7 –0.01 to 0.01 1000 1 0 ob0!sc1!md1!0:7 –0.001 to 0.001 2000 51 0 sc1!md1!0:7 –0.001 to 0.
Chapter 20 Special Programming Considerations for SCXI SCXI Settling Time The filter and gain settings of your SCXI modules affect the settling time of the SCXI amplifiers and multiplexers. You should always enter your jumpered filter settings and your jumpered gain settings (if applicable) in the configuration utility.
Common SCXI Applications 21 Now that you have your SCXI system set up and you are aware of the special SCXI programming considerations, you should learn about some common SCXI applications. This section will cover example VIs for analog input, analog output, and digital modules. For analog input, you will learn how to measure temperature (with thermocouples and RTDs) and strain (with strain gauges) using the SCXI-1100, SCXI-1102, SCXI-1121, SCXI-1122, and SCXI-1141 modules.
Chapter 21 Common SCXI Applications Analog Input Applications for Measuring Temperature and Pressure Two common transducers for measuring temperature are thermocouples and RTDs. A common transducer for measuring pressure is strain gauges. Read the following sections on special measuring considerations needed for each transducer. If you use the DAQ Channel Wizard to configure your analog input channels, you can simplify the programming needed to measure your channels.
Chapter 21 Common SCXI Applications In addition, the SCXI-1100, SCXI-1141, and SCXI-1122 offer a way for you to ground the module amplifier inputs so you can read the amplifier offset. You can subtract the amplifier offset value to determine the actual voltages. For more information on temperature sensors and amplifier offsets, continue on to the following two sections.
Chapter 21 Common SCXI Applications If you want to read the cold-junction temperature sensor in dtemp mode, you can read the following onboard channels for these modules. Modules Channel SCXI-1100 1 SCXI-1120/SCXI-1120 15 (use referenced single-ended mode) SCXI-1121 4 SCXI-1122 1 For example, you can run the Getting Started Analog Input VI, found in labview\examples\daq\run_me.
Chapter 21 Common SCXI Applications Amplifier Offset The SCXI-1100, SCXI-1122, and SCXI-1141 have a special calibration feature that enables LabVIEW to ground the module amplifier inputs so that you can read the amplifier offset. For the other SCXI analog input modules, you must physically wire your terminals to ground. The measured amplifier offset is for the entire signal path including the SCXI module and the DAQ device.
Chapter 21 Common SCXI Applications VI Examples If you use the DAQ Channel Wizard to configure your channels, you can simplify the programming needed to measure your signal. LabVIEW configures the hardware with the appropriate input limits and gain, and performs cold-junction compensation, amplifier offsets, and scaling for you. To measure a channel using a channel name, you can use the Easy VIs or the Continuous Transducer VI located in labview\examples\daq\ solution\transduc.
Chapter 21 Common SCXI Applications diagram below shows how you can program the Acquire and Average VI to measure the amplifier offset. You can find this VI in vi.lib\daq\ zdaqutil.llb. This VI acquires 100 measurements from the amplifier offset, designated in the offset channel input by calgnd, and then averages the measurements. When you determine the amplifier offset, you must always use the same input limits and clock rates that you will be using in the acquisition.
Chapter 21 Common SCXI Applications Figure 21-3. Measuring Temperature Sensors Using the Acquire and Average VI After determining the average amplifier offset and cold-junction compensation, you can acquire data using the Intermediate VIs as shown in Figure 21-4. This example continually acquires data until an error occurs or the user stops the execution of the VI. In order to perform continuous, hardware-timed acquisition, you need to set up a buffer.
Chapter 21 Common SCXI Applications Figure 21-4. Continuously Acquiring Data Using Intermediate VIs Another temperature acquisition example using the SCXI-1100 module is SCXI Temperature Monitor VI located in labview\examples\daq\ scxi\scxi_ai.llb. This VI continually acquires thermocouple readings and sets an alarm if the temperature readings go above a user-defined limit. You can use the SCXI-1100 examples with the SCXI-1122 module.
Chapter 21 Common SCXI Applications If you are measuring temperature with the SCXI-1120 and SCXI-1121 modules, refer to the example VI, SCXI-1120/1121 Thermocouple, located in labview\examples\daq\scxi\scxi_ai.llb. This VI is similar to the VI used to measure temperature on the SCXI-1100. Both VIs average and linearize temperature data using the Intermediate analog input VIs.
Chapter 21 Common SCXI Applications and filter settings on the SCXI-1121 module with jumpers as well as in your system’s configuration utility. For information on how to connect and configure the RTD with the SCXI-1121 module, look at the Getting Started with SCXI manual or the RTD application note mentioned previously. The SC-2042 RTD is a signal conditioning device designed specifically for RTD measurement and can be used as an alternative to SCXI modules.
Chapter 21 Common SCXI Applications Figure 21-5 continually acquires data until an error occurs or you stop the VI from executing. To perform a continuous hardware-timed acquisition, you must set up a buffer. In this example, the buffer is 10 times the number of points acquired for each channel. For each acquisition, your device averages the temperature data. After completing the acquisition, always clear the acquisition by using the AI Clear VI.
Chapter 21 Common SCXI Applications 10 times the number of points acquired for each channel. After your device averages the voltage data from the AI Read VI, it converts the voltage values to temperature. After completing the acquisition, remember to always clear the acquisition by using the AI Clear VI. Measuring Pressure with Strain Gauges Strain gauges give varying voltages in response to stress or vibrations in materials. Strain gauges are thin conductors attached to the material to be stressed.
Chapter 21 Common SCXI Applications The SCXI-1121 and the SCXI-1122 modules are commonly used with strain gauges because they include voltage or current excitation and internal Wheatstone bridge completion circuits. You can also use the signal conditioning device SC-2043SG as an alternative to SCXI modules. The device is designed specifically for strain gauge measurements. For more information on this device, refer to your National Instruments catalog.
Chapter 21 Common SCXI Applications Figure 21-8. Measuring Pressure Using Information from the DAQ Channel Wizard Figure 21-8 continually acquires data until an error occurs or you stop the VI from executing. In order to perform continuous acquisition, you need to set up a buffer. In this example, the buffer is 10 times the number of points acquired for each channel. After your device averages the voltage data from the AI Read VI, it converts the voltage values to strain values.
Chapter 21 Common SCXI Applications strain is applied (always measure at the beginning of the VI); Bridge Configuration; Vex, the excitation voltage; Rl, the lead resistance; and Rg, the resistance of the strain gauge before strain is applied. You can usually ignore the lead resistance, Rl, for strain gauges unless the leads are several feet.
Chapter 21 Common SCXI Applications Figure 21-10. SCXI-1124 Update Channels VI Digital Input Application Example To input digital signals through an SCXI chassis, you can use the SCXI-1162 and SCXI-1162HV modules and the Easy Digital VI, Read from Digital Port, as shown in Figure 21-11. Figure 21-11. Inputting Digital Signals through an SCXI Chassis Using Easy Digital VIs If you configure channels using the DAQ Channel Wizard, digital channel can consist of a digital channel name.
Chapter 21 Common SCXI Applications lines on your DAQ device. The DIO-32F device can access all 32 lines of the SCXI modules at once by using the SCXI-1348 cable assembly. The DIO-24 and the DIO-96 devices can only access the first 24 lines of these modules when configured in parallel mode. For the fastest performance in parallel mode, you can use the appropriate onboard port numbers instead of the SCXI channel string syntax. Use the iteration input to optimize your digital operation.
58ch21.fm Page 19 Thursday, December 11, 1997 2:43 PM Chapter 21 Common SCXI Applications Digital Output Application Example To output digital signals through an SCXI chassis, you can use the SCXI-1160, SCXI-1161, SCXI-1163, and SCXI-1163R modules and the digital Easy Digital VI, Write to Digital Port, as shown in Figure 21-12. Figure 21-12.
Chapter 21 Common SCXI Applications Use the iteration input to optimize your digital operation. When iteration is 0 (default), LabVIEW calls the DIO Port Config VI (an Advanced VI) to configure the port. If iteration is greater than zero, LabVIEW bypasses reconfiguration and remembers the last configuration, which improves performance. You can wire this input to an iteration terminal of a loop. Every time you call the DIO Port Config VI the digital line values are reset to default values.
Chapter 21 Common SCXI Applications If you are not using the DAQ Channel Wizard, there are special considerations for addressing the channels. When you daisy-chain multiple chasses to a single DAQ device (non-Remote SCXI), each chassis multiplexes all of its analog input channels into a separate onboard analog input channel. The first chassis in the chain uses onboard channel 0, the second chassis in the chain uses onboard channel 1, and so on.
SCXI Calibration—Increasing Signal Measurement Precision 22 Your SCXI module ships to you pre-calibrated for the specified accuracy at the factory. You only need to recalibrate the module if the precision of your signal measurement is not acceptable because of shifts in environmental conditions. Before learning about how to calibrate, you should understand where LabVIEW stores your calibration constants. Note This chapter does not apply to the SCXI-1200.
Chapter 22 SCXI Calibration—Increasing Signal Measurement Precision Electronically Erasable Programmable Read-Only Memory (EEPROM) Factory Area Note User Area • The factory area has a set of factory calibration constants already stored in it when you receive your SCXI module. You cannot write into the factory area, but you can read from it, so you can always access and use these factory constants if they are appropriate for your application.
Chapter 22 SCXI Calibration—Increasing Signal Measurement Precision The following sections explain how to calibrate your SCXI modules to achieve the levels of accuracy that you desire. Calibrating SCXI Modules The SCXI Cal Constants VI in LabVIEW automatically calculates the calibration constants for your module with the precision you need for your particular application. You can find this VI in Functions»DAQ» Calibration and Configuration.
Chapter 22 SCXI Calibration—Increasing Signal Measurement Precision SCXI Calibration Methods for Signal Acquisition There are two ways you can calibrate your SCXI module—through one-point calibration or two-point calibration. The following illustration explains why you may need to calibrate your SCXI module.
Chapter 22 SCXI Calibration—Increasing Signal Measurement Precision One-Point Calibration These steps show you how to perform a one-point calibration calculation in LabVIEW. You should use one-point calibration when you only need to adjust the binary offset in your module. If you need to adjust both the binary offset and the gain error of your module, read the Two-Point Calibration section later in this chapter.
Chapter 22 SCXI Calibration—Increasing Signal Measurement Precision 4. Use the AI Single Scan VI to take several readings and average them for greater accuracy. Set the DAQ device gain settings to match the settings you plan to use in your application. If you are using an AT-MIO-16F-5, AT-MIO-64F-5, or AT-MIO-16X, use the MIO Configure VI to enable dithering, which makes your averaged data more accurate. The dither mode is always enabled on E-series devices.
Chapter 22 Note SCXI Calibration—Increasing Signal Measurement Precision 7. Take another binary reading or average of readings. If your binary reading is the maximum binary reading for your DAQ device, try a smaller input voltage. This is your second volt/binary measurement. 8. Use the SCXI Cal Constants VI with the first volt/binary measurement from step 4 as Volt/Amp 1 and Binary 1 inputs, and the second measurement from step 7 as Volt/Amp 2 and Binary 2 inputs of the VI.
Chapter 22 SCXI Calibration—Increasing Signal Measurement Precision Calibrating SCXI Modules for Signal Generation When you output a voltage or current value to your SCXI analog output module, LabVIEW uses the calibration constants loaded for the given module, channel, and output range to scale the voltage or current value to the appropriate binary value to write to the output channel. By default, calibration constants for the SCXI-1124 are loaded into the memory from the EEPROM default load area.
Part VI Counting Your Way to High-Precision Timing This section describes the different ways you can use counters with your data acquisition application, including generating a pulse or pulses; measuring pulse width, frequency, and period; counting events and time; and dividing frequencies for precision timing.
23 Things You Should Know about Counters Counters add counting or high-precision timing to your data acquisition (DAQ) system. Counters respond to and output Transistor-Transistor Logic (TTL) signals—square-pulse signals that are 0V (low) or 5V (high) in value. The following diagram shows a TTL signal. +5 V Signal Transitions or Edges 0V Even though counters just count the signal transitions (edges) of a TTL source signal, you can use this counting capability in many ways.
Chapter 23 Things You Should Know about Counters Knowing the Parts of Your Counter The following illustration shows a basic model of a counter. GATE OUT Count Register SOURCE (CLK) A counter consists of a SOURCE or CLK input pin, a GATE input pin, an OUT output pin, and a count register. In plug-in device diagrams and in the LabVIEW Function Reference and VI Reference Manual, these counter parts are called SOURCEn (or CLKn), GATEn, and OUTn, where n is the number of the counter.
Chapter 23 Things You Should Know about Counters outputs, then you should use a toggled output. Refer to Chapter 24, Generating a Square Pulse or Pulse Trains, for more information. Multiple counters can be concatenated for a greater counting range on most devices. For more information on how to concatenate counters, refer to Chapter 27, Counting Signal Highs and Lows.
Chapter 23 Things You Should Know about Counters DAQ-STC You can configure the DAQ-STC to count either low-to-high or high-to-low transitions of the SOURCE input. The counter has a 24-bit count register with a counting range of 0 to 224-1. It can be configured to increment or decrement for each counted edge. Furthermore, whether the count register increments or decrements can be controlled with an external digital line which is useful for encoder applications.
Chapter 23 Things You Should Know about Counters For specific information about the Counter VIs in LabVIEW, refer to Chapter 14, Introduction to the LabVIEW Data Acquisition VIs, in the LabVIEW Function and VI Reference Manual, or the LabVIEW Online Reference, available by selecting Help»Online Reference….
24 Generating a Square Pulse or Pulse Trains This chapter describes the ways you can generate a square pulse or multiple pulses (called pulse trains) using the counters available on your data acquisition (DAQ) device with the example VIs in LabVIEW. Generating a Square Pulse There are many applications where you may need to generate TTL pulses. TTL pulses can be used as clock signals, gates, and triggers. You can use a pulse train of known frequency to determine an unknown TTL pulse width.
Chapter 24 Generating a Square Pulse or Pulse Trains Examples of various duty cycles are shown in Figure 24-1. The first line shows a duty cycle of 0.5, where, phase 1 and phase 2 are the same duration. A signal with a 0.5 duty cycle acts as a SOURCE for counter operations. The second line shows a duty cycle of 0.1, where phase 1 has increased and phase 2 has decreased. The final line shows a large duty cycle of 0.9 where phase 1 is very short and the phase 2 duration is longer.
Chapter 24 Generating a Square Pulse or Pulse Trains Each counter-generated pulse consists of two parts—phase 1 and phase 2. If the counter is configured to output a signal with positive polarity and toggled output, as shown in the following diagram, the period of time from when the counter starts counting to the first rising edge is called phase 1. The time between the rising and the following falling edge is called phase 2.
Chapter 24 Generating a Square Pulse or Pulse Trains number. If you load the count register with an odd number, phase 1 will be longer than phase 2 by one cycle of the counter’s CLK signal. Now that you know the terms involving generating a single square pulse or a pulse train, you can learn about the LabVIEW VIs, and the physical connections needed to implement your application.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-6 shows the diagram of the Delayed Pulse-Easy (DAQ-STC) VI located in labview\examples\daq\counter\DAQ-STC.llb. You could also use the example Delayed Pulse-Easy (9513) VI located in labview\examples\daq\counter\Am9513.llb. These examples use the Easy level Generate Delayed Pulse VI. The Generate Delayed Pulse VI, found in Functions»Data Acquisition» Counter, tells your device to generate a single delayed pulse.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-7. Diagram of Delayed Pulse-Int (DAQ-STC) VI You must stop the counter if you want to use it for other purposes. For more information on stopping counters, refer to the Stopping Counter Generations section at the end of this chapter. 8253/54 The example Delayed Pulse (8253) VI located in labview\examples\ daq\counter\8253.llb shows how to generate a negative polarity pulse.
Chapter 24 Generating a Square Pulse or Pulse Trains This example uses a sequence structure to divide the basic tasks involved. Figure 24-9 shows frame 0 of the sequence where all of the counters are reset. Notice that counters 1 and 2 are reset so their output states start out high. Figure 24-9.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-10 shows frame 1 of the sequence where the counters are set up for different counting modes. Counter 0 is set up to generate a timebase using the ICTR Timebase Generator subVI. Counter 1 is set up to toggle its output (low-to-high) when it reaches terminal count (TC). This toggled output is used to gate Counter 2. Counter 2 is set up to output a low pulse when its gate goes high. Figure 24-10.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-11. Frame 2 of Delayed Pulse (8253) VI While this example works well for most pulses, it does have limitations when your pulse delay gets very short (in the microsecond range), or when the ratio of pulse delay to pulse width gets very large. For a complete description of this example, refer to the information found in Windows»Show VI Info…. Generating a Pulse Train There are two types of pulse trains: continuous and finite.
Chapter 24 Generating a Square Pulse or Pulse Trains DAQ-STC, Am9513 Figure 24-12 shows how to connect your counter and device to generate a continuous pulse train. The edges of the internal source signal are counted to generate the output signal. You obtain the continuous pulse train for your external device from the counter’s OUT pin. You can optionally gate the operation with a signal connected to the GATE input pin.
Chapter 24 Generating a Square Pulse or Pulse Trains examples\daq\counter\DAQ-STC.llb. You could also use the example Cont Pulse Train-Int (9513) VI located in labview\examples\ daq\counter\Am9513.llb. These examples show how to generate a simple pulse train using Intermediate VIs. Figure 24-14. Diagram of Cont Pulse Train-Int (DAQ-STC) VI With this VI you can specify the frequency, duty cycle, and pulse polarity of your pulse train. If the duty cycle is set to 0.0 or 1.
Chapter 24 Generating a Square Pulse or Pulse Trains 8253/54 Figure 24-15 shows how to connect your counter and device to generate a continuous pulse train. If you use counter 0, an internal source is counted to generate the output signal. If you use counter 1 or 2, you will need to connect your own source to the CLK pin. You obtain the continuous pulse train for your external device from the counter's OUT pin. Figure 24-15.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-16. Diagram of Cont Pulse Train (8253) VI Generating a Finite Pulse Train How you generate a finite pulse varies depending upon which counter chip your DAQ hardware has. Most National Instruments DAQ devices contain one of three different counter chips: the DAQ-STC, the Am9513, or the 8253/54 chip. If you are not sure which chip your device uses, refer to your hardware manual.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-17 shows the physical connections to produce a finite pulse train on the OUT pin of a counter. counter generates the finite pulse train with high-level gating. counter-1 provides counter with a long enough gate pulse to output the number of desired pulses. You must externally connect the OUT pin of the counter-1 to the GATE pin of counter. You also can gate counter-1. Figure 24-17.
Chapter 24 Generating a Square Pulse or Pulse Trains You can also create a finite pulse train using Intermediate VIs. Figure 24-19 shows the diagram of the Finite Pulse Train-Int (DAQ-STC) VI located in labview\examples\daq\counter\DAQ-STC.llb. You could also use the example Finite Pulse Train-Int (9513) VI located in labview\examples\daq\counter\Am9513.llb. These examples show how to use the Intermediate VIs Continuous Pulse Generator Config and Delayed Pulse Generator Config. Figure 24-19.
Chapter 24 Generating a Square Pulse or Pulse Trains DAQ-STC With the DAQ-STC chip, you have the ability to internally route the OUT of one counter to the GATE of the next higher order counter, as shown in Figure 24-20. You can optionally GATE counter-1. Notice that while you still use two counters, you do not need to externally wire between the OUT of counter-1 and the GATE of counter. Figure 24-20.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-21. Diagram of Finite Pulse Train-Adv (DAQ-STC) VI 8253/54 Generating a finite pulse train with the 8253/54 chip uses all three counters. Figure 24-22 shows how to externally connect your counters. Since counter 0 is internally connected to a clock source, it is used to generate the timebase used by counter 1 and counter 2. counter 1 generates a single low pulse used to gate counter 2.
Chapter 24 Generating a Square Pulse or Pulse Trains The example Finite Pulse Train (8253) VI located in labview\ examples\daq\counter\8253.llb shows how to generate a finite pulse train. This example uses a sequence structure to divide the basic tasks involved. Figure 24-23 shows frame 0 of the sequence where all of the counters are reset. Notice counter 1 is reset so its output state starts high. Figure 24-23.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-24 shows frame 1 of the sequence where the counters are set up for different counting modes. Counter 0 is set up to generate a timebase using the ICTR Timebase Generator VI. Counter 1 is set up to output a single low pulse using the ICTR Control VI. Counter 2 is set up to output a pulse train using the ICTR Timebase Generator VI. Figure 24-24.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-25 shows frame 2 of the sequence where a delay occurs so that the finite pulse train has time to complete before the example can be run again. This is useful if the example is used as a subVI where it may get called over and over. For a complete description of this example, refer to the information found in Windows»Show VI Info…. Figure 24-25.
Chapter 24 Generating a Square Pulse or Pulse Trains Figure 24-26. CTR Control VI Front Panel and Block Diagram You can also refer to the Generate Pulse Train on FREQ_OUT VI located in examples\daq\counter\DAQ-STC.llb, or the Generate Pulse Train on FOUT VI located in examples\daq\counter\Am9513.llb. These examples generate a pulse train on these outputs.
Chapter 24 Generating a Square Pulse or Pulse Trains Knowing the Accuracy of Your Counters When you generate a waveform, there can be an uncertainty of up to one timebase period between the start signal and the first counted edge of the timebase. This is due to the uncertainty in the exact relation of the start signal, which the software calls or the gate signal supplies to the first edge of the timebase, as shown in Figures 24-27.
Chapter 24 Generating a Square Pulse or Pulse Trains Stopping Counter Generations You can stop a counting operation in several ways. You can restart a counter for the same operation it just completed, you can reconfigure it to do something else, or you can call a specific VI to stop it. All of these methods allow you to use counters for different operations without resetting the entire board. DAQ-STC, Am9513 Figure 24-28 shows how to stop a counter using the Intermediate VI, Counter Stop.
25 Measuring Pulse Width This chapter describes how you can use a counter to measure pulse width. There are several reasons you may need to determine pulse width. For example, if you need to determine the duration of an event, you would want your application to measure the width of a pulse that occurs during that event. Another example is determining the interval between two events. In this case, you would measure the pulse width between the two events.
Chapter 25 Measuring Pulse Width An internal signal is based upon the type of counter chip on your DAQ device. With DAQ-STC devices, you have a choice between internal timebases of 20 MHz and 100 kHz. With Am9513 devices, you can choose internal timebases of 1 MHz, 100 kHz, 10 kHz, 1 kHz, and 100 Hz. With 8253/54 devices, the internal timebase is either 2 MHz or 1 MHz, depending on which board you have. Figure 25-2 shows how to physically connect the counter on your device to measure pulse width.
Chapter 25 Measuring Pulse Width The Measure Pulse Width or Period VI counts the number of cycles of the specified timebase, depending on your choice from the type of measurement menu located on the front panel of the VI. The type of measurement menu choices for this VI are shown in Figure 25-4. Figure 25-4. Menu Choices for Type of Measurement for the Measure Pulse Width or Period(DAQ-STC) VI Use the first two menu choices when you want to measure the width of a single pulse.
Chapter 25 Measuring Pulse Width Am9513 Figure 25-5 shows the diagram of the Measure Pulse-Easy (9513) VI located in labview\examples\daq\counter\Am9513.llb, which uses the Easy VI, Measure Pulse Width or Period. Figure 25-5. Diagram of Measure Pulse Width (9513) VI The Measure Pulse Width or Period VI counts the number of cycles of the specified timebase, depending on your choice from the type of measurement menu located on the front panel of the VI.
Chapter 25 Measuring Pulse Width The valid? output of the example VI indicates whether the counter measured the pulse without overflowing (reaching TC). However, valid? does not tell you whether a whole pulse was measured when measuring a pulse within a pulse train. For a complete description of this example, refer to the information found in Windows»Show VI Info…. 8253/54 Figure 25-7 shows the diagram of the Measure Short Pulse Width (8253) VI located in labview\examples\daq\counter\8253.llb.
Chapter 25 Measuring Pulse Width On the example diagram, the first call to ICTR Control VI sets up counting mode 4, which tells the counter to count down while the gate input is high. The Get Timebase (8253) VI is used to get the timebase of your DAQ device. A DAQ device with an 8253/54 counter has an internal timebase of either 1 MHz or 2 MHz, depending on the device. Inside the while loop, ICTR Control VI is called to continually read the count register until one of four conditions are met: 1.
Chapter 25 Measuring Pulse Width Figure 25-8. Measuring Pulse Width with Intermediate VIs Buffered Pulse and Period Measurement With the DAQ-STC chip, LabVIEW provides a buffer for counter operations. You would typically use buffered counter operations when you have a gate signal to trigger a counter several times. Figure 25-9 shows the diagram of the Meas Buffered Pulse-Period (DAQ-STC) VI located in labview\examples\daq\DAQ-STC.llb. Figure 25-9. Diagram of Meas Buffered Pulse-Period (DAQ-STC).
Chapter 25 Measuring Pulse Width With this example, you can perform four types of buffered measurements: 1. Buffered period measurement, which measures a number of periods in a pulse train. 2. Buffered semi-period measurement, which measures a number of high and low pulse in a pulse train. 3. Buffered pulse width measurement, which measures a number of high or low pulses in a pulse train. 4. Buffered counting, where each rising edge loads the current count into a finite buffer.
Chapter 25 Measuring Pulse Width Table 25-1. Internal Counter Timebases and Their Corresponding Maximum Pulse Width Measurements Counter Type DAQ-STC Am9513 8253/54 Internal Timebases Maximum Pulse Width Measurement 20 MHz 838 ms 100 kHz 167 s 1 MHz 65 ms 100 kHz 655 ms 10 kHz 6.5 s 1 kHz 65 s 100 Hz 655 s 2 MHz* 32 ms 1 MHz* 65 ms *A DAQ device with an 8253/54 counter will have one of these internal timebases available on counter 0, but not both.
26 Measuring Frequency and Period This chapter describes the various ways you can measure frequencies and periods of TTL signals using the counters on your data acquisition (DAQ) device. One cycle of a signal, known as the period, is measured in units of time — usually seconds. The inverse of period is frequency, which is measured in cycles per second or hertz (Hz). The rate of your signal and the type of counter on your DAQ device determine whether you use frequency or period measurement.
Chapter 26 Measuring Frequency and Period DAQ-STC, Am9513 For period measurement, you count the number of pulses of a known frequency (fs) during one period of the signal to be measured. As shown in Figure 26-2, the signal of a known frequency is connected to the SOURCE, and the signal to be measured is connected to the GATE. The period is the count divided by the known frequency (TG = count/fs). GATE OUT TG Count Register SOURCE input of known frequency, fs Figure 26-2.
Chapter 26 Measuring Frequency and Period Connecting Counters to Measure Frequency and Period Figure 26-3 shows typical external connections for measuring frequency. In the figure, your device provides the signal with the frequency to be measured to the SOURCE (CLK) of counter. It can optionally control the GATE of counter-1. The OUT of counter-1 supplies a known pulse to the GATE of counter. Finally, counter counts the number of cycles of the unknown pulse during the known GATE pulse. Figure 26-3.
Chapter 26 Measuring Frequency and Period Measuring the Frequency and Period of High Frequency Signals How you measure the frequencty and period of high frequency signals depends on the counter chip on your DAQ device. If you are unsure of which chip your DAQ device has, refer to your hardware documentation. DAQ-STC Figure 26-5 shows the Measure Frequency-Easy (DAQ-STC) VI located in labview\examples\daq\DAQ-STC.llb.
Chapter 26 Measuring Frequency and Period Am9513 Figure 26-6 shows the Measure Frequency-Easy (9513) VI located in labview\examples\daq\Am9513.llb. This example uses the Easy VI, Measure Frequency which can be found in Functions» Data Acquisition»Counter. Figure 26-6. Diagram of Measure Frequency-Easy (9513) VI This VI initiates the counter to count the number of rising edges of a TTL signal at the SOURCE of counter during a known pulse at the GATE of counter.
Chapter 26 Measuring Frequency and Period DAQ-STC, Am9513 If you need more control over when your frequency measurement begins and ends, use the Intermediate VIs instead of the Easy VIs. Figure 26-7 shows one approach for this that uses the Event or Time Counter Config, Adjacent Counters, Delayed Pulse Generator Config, Counter Start, CTR Control, Counter Read, and Counter Stop VIs. The Delayed Pulse Generator Config VI configures counter to count the number of pulses while its GATE is high.
Chapter 26 Measuring Frequency and Period 8253/54 Figure 26-8 shows the Measure Frequency > 1kHz (8253) VI located in labview\examples\daq\8253.llb. Figure 26-8. Diagram of Measure Frequency > 1 kHz (8253) VI This VI initiates the counter to count the number of rising edges of a TTL signal at the CLK of counter during a known pulse at the GATE of counter. The known pulse is created by counter 0, and its width is determined by gate width.
Chapter 26 Measuring Frequency and Period frequencies, use the Measure Frequency < 1 kHz (8253) VI located in labview\examples\daq\8253.llb. This VI uses three counters. The other limitation is that there is a small software dependency, which causes counter 0 to output a pulse slightly longer than the count it is given. This is the nature of the 8253 chip, and it can increase the readings of high frequencies.
Chapter 26 Measuring Frequency and Period or terminal count (TC). With a timebase of 20 MHz, the DAQ-STC can measure a period up to 838 ms. With a timebase of 100 kHz, you can measure a period up to 167 seconds. Am9513 Figure 26-10 shows the example Measure Period-Easy (9513) VI located in labview\examples\daq\Am9513.llb. This example uses the Easy VI, Measure Pulse Width or Period located in Functions» Data Acquisition»Counter. Figure 26-10.
Chapter 26 Measuring Frequency and Period DAQ-STC, Am9513 If you need more control over when period measurement begins and ends, use the Intermediate VIs instead of the Easy VIs. Figure 26-11 shows how to measure period and frequency. Figure 26-11. Measuring Period Using Intermediate Counter VIs The Intermediate VIs used in Figure 26-11 include Pulse Width or Period Meas Config, Counter Start, Counter Read, and Counter Stop.
27 Counting Signal Highs and Lows This chapter describes the various ways you can count TTL signals using the counters on your data acquisition (DAQ) device. Counters can count external events such as rising and falling edges on the SOURCE (CLK) input pin. They can also count elapsed time using the rising and falling edges of an internal timebase. A useful example of counting events would be if you wanted to calculate the output of a production line.
Chapter 27 Counting Signal Highs and Lows Am9513 With the Am9513, you can extend the counting range of a counter by connecting the OUT of one counter to the SOURCE of the next higher order counter (counter+1). This is called cascading counters. By cascading counters you can increase your counting range from a 16-bit counting range of 65,535 to a 32-bit counting range of 4,294,967,295. The Am9513 chip has a set of 5 counters where higher order counters can be cascaded.
Chapter 27 Counting Signal Highs and Lows Figure 27-4 shows typical external connections for cascading counters when counting elapsed time. Notice that the OUT of counter is connected to the SOURCE of counter+1. Figure 27-4. External Connections to Cascade Counters for Counting Elapsed Time Counting Events How you count events depends upon which counter chip is on your DAQ device. If you are uncertain which counter your DAQ device has, refer to your hardware documentation.
Chapter 27 Counting Signal Highs and Lows If you need more control over when your event counting begins and ends, use the Intermediate VIs instead of the Easy VIs. Figure 27-6 shows the Count Events-Int (DAQ-STC) VI located in labview\examples\ daq\DAQ-STC.llb. Figure 27-6. Diagram of Count Events-Int (DAQ-STC) VI This example uses the following Intermediate VIs: Event or Time Counter Config, Counter Start, Counter Read, and Counter Stop.
Chapter 27 Counting Signal Highs and Lows Figure 27-7. Diagram of Count Events-Easy (9513) VI This VI initiates the counter to count the number of rising edges of a TTL signal at the SOURCE of counter. The counter continues counting until the STOP button is pressed. Remember that you must externally wire your signal to be counted to the SOURCE of counter. Additionally, you can cascade two counters by choosing two counters (32-bits) in the number of counters to use menu.
Chapter 27 Counting Signal Highs and Lows This example uses the following Intermediate VIs: Event or Time Counter Config, Counter Start, Counter Read, and Counter Stop. The Event or Time Counter Config VI configures counter to count the number of rising edges of a TTL signal at its SOURCE input pin. The Counter Start VI begins the counting operation for counter. The Counter Read VI returns the count until the STOP button is pressed or an error occurs.
Chapter 27 Counting Signal Highs and Lows This VI initiates the counter to count the number of rising edges of a TTL signal at the CLK of counter. Looking at the diagram, the first call to ICTR Control loads the count register and sets up counter to count down. The second call to ICTR Control reads the count register. Inside the first while loop, the count is read until it changes.
Chapter 27 Counting Signal Highs and Lows pressed. You do not need to make any external connections. The length of time that can be counted depends on the maximum count of the counter and the chosen timebase. For example, the 16,777,216 (24-bit) count of the DAQ-STC and a timebase of 20 MHz can count time for 838 ms. Using the 100 kHz timebase, you can count time for 167 seconds. For a complete description of this example, refer to the information found in Windows»Show VI Info….
Chapter 27 Counting Signal Highs and Lows Am9513 Figure 27-12 shows the Count Time-Easy (9513) VI located in labview\examples\daq\Am9513.llb. This example uses the Count Events or Time-Easy VI, which can be found in Functions»Data Acquisition»Counter. Figure 27-12. Diagram of Count Time-Easy (9315) VI This VI initiates the counter to count the number of rising edges of a known internal timebase at the SOURCE of counter.
Chapter 27 Counting Signal Highs and Lows If you need more control over when your elapsed timing begins and ends, use the Intermediate VIs instead of the Easy VIs. Figure 27-13 shows the Count Time-Int (9513) VI located in labview\examples\ daq\Am9513.llb. Figure 27-13. Diagram of Count Time-Int (9513) VI This example uses the following Intermediate VIs: Event or Time Counter Config, Counter Start, Counter Read, and Counter Stop.
Chapter 27 Counting Signal Highs and Lows 8253/54 Figure 27-14 shows the Count Time (8253) VI located in labview\examples\daq\8253.llb. This example uses the ICTR Control-Int VI, which can be found in Functions» Data Acquisition»Counter»Intermediate Counter. Figure 27-14. Diagram of Count Time (8253) VI This VI initiates the counter to count the number of rising edges of a TTL timebase at the CLK of counter. Counter 0 creates the timebase.
28 Dividing Frequencies Dividing TTL frequencies is useful if you want to use an internal timebase and the frequency you need does not exist. You can divide an existing internal frequency to get what you need. You can also divide the frequency of an external TTL signal. Frequency division results in a pulse or pulse train from a counter for every N cycles of an internal or external source. Counters can only decrease (divide down) the frequency of the source signal.
Chapter 28 Dividing Frequencies DAQ-STC, Am9513 Figure 28-2 shows an example of a signal divider. It uses the Intermediate counter VIs Down Counter or Divide, Counter Start, and Counter Stop. Figure 28-2. Programming a Single Divider for Frequency Division The Down Counter or Divide Config VI configures the specified counter to divide the SOURCE signal by the timebase divisor value and output a signal when the counter reaches its terminal count (TC).
Chapter 28 Dividing Frequencies Instead of triggering frequency division for signal dividers and down counters by software, as previously described, you can trigger using the GATE signal. You can trigger while the GATE signal is high, low, or on the rising or falling edge.
Part VII Debugging Your Data Acquisition Application This section contains an explanation of ways you can debug your data acquisition application to make sure your application is accurate and runs smoothly. Part VII, Debugging Your Data Acquisition Application, contains the following chapter: • Chapter 29, Debugging Techniques, shows you some tips to help figure out why your VI is not working.
Debugging Techniques 29 Is your VI not working as you expected? This chapter shows you some tips to help figure out why your VI is not working. First, find your LabVIEW User Manual because this manual is referenced in this section. With LabVIEW data acquisition (DAQ) applications, you might find errors in hardware connections, software configuration, or VI construction. The goal of this chapter is to help you narrow down where the problem is in your program flow.
Chapter 29 Debugging Techniques Software Configuration Errors As you check hardware connections, it is a good idea to verify that the NI-DAQ software configuration reflects your hardware setup. For possible difficulties with software configuration, read Chapter 2, Installing and Configuring Your Data Acquisition Hardware, the chapter of this manual that describes your specific application, or the NI-DAQ User Manual.
Chapter 29 Debugging Techniques Figure 29-1. Error Checking Using the General Error Handler VI Figure 29-2. Error Checking Using the Simple Error Handler VI The following figure shows an example of the dialog box the Error Handler VIs display if an error occurs. Please refer to the LabVIEW Function and VI Reference Manual or the LabVIEW Online Reference, available by selecting Help»Online Reference…, for more information on the error handler VIs.
Chapter 29 Debugging Techniques Execution Highlighting Execution highlighting (the light bulb button on the diagram) shows you how data passes from one node to another in your program. When you turn execution highlighting on, data movement is marked by bubbles moving along the wires. Refer to Chapter 2, Creating VIs, in the LabVIEW User Manual, and Chapter 4, Executing and Debugging VIs and SubVIs, in the G Programming Reference Manual for more information about execution highlighting.
A LabVIEW Data Acquisition Common Questions This appendix lists answers to questions frequently asked by LabVIEW users. Where is the best place to get up to speed quickly with data acquisition and LabVIEW? Read the LabVIEW Data Acquisition Basics Manual and look at the run_me.llb examples, in labview\examples\daq\run_me.llb, included with the package. In Windows, run the DAQ Channel Wizard and the DAQ Solution Wizard.
Appendix A LabVIEW Data Acquisition Common Questions How can I tell when a continuous data acquisition operation does not have enough buffer capacity? The scan backlog rises with time, either steadily or in jumps, or takes a long time to drop to normal after an interrupting activity like mouse movement. If you can open another VI during the operation without receiving an overrun error you should have adequate buffer capacity.
Appendix A LabVIEW Data Acquisition Common Questions I want to use a TTL digital trigger pulse to start data acquisition on my DAQ device. I noticed there are two types of triggers: Digital Trigger A, and Digital Trigger A&B. Which digital trigger setting should I use and where should I connect the signal? You should use Digital Trigger A, which stands for “first trigger,” to start a data acquisition.
Appendix A LabVIEW Data Acquisition Common Questions If not, you need to obtain the latest version of the DAQ driver from the NI BBS, World Wide Web, or FTP site. We have also seen cases where the video driver conflicts with both the NI-DAQ Configuration Utility and LabVIEW. You can obtain the Error Messages and Crashes Common Questions document from the NI Fax-on-Demand system. (Windows) I bought LabVIEW for Windows and also have a slightly older DAQ device from National Instruments.
Customer Communication B For your convenience, this appendix contains forms to help you gather the information necessary to help us solve your technical problems and a form you can use to comment on the product documentation. When you contact us, we need the information on the Technical Support Form and the configuration form, if your manual contains one, about your system configuration to answer your questions as quickly as possible.
Bulletin Board Support National Instruments has BBS and FTP sites dedicated for 24-hour support with a collection of files and documents to answer most common customer questions. From these sites, you can also download the latest instrument drivers, updates, and example programs. For recorded instructions on how to use the bulletin board and FTP services and for BBS automated information, call 512 795 6990.
Technical Support Form Photocopy this form and update it each time you make changes to your software or hardware, and use the completed copy of this form as a reference for your current configuration. Completing this form accurately before contacting National Instruments for technical support helps our applications engineers answer your questions more efficiently.
LabVIEW Hardware and Software Configuration Form Record the settings and revisions of your hardware and software on the line to the right of each item. Complete a new copy of this form each time you revise your software or hardware configuration, and use this form as a reference for your current configuration. Completing this form accurately before contacting National Instruments for technical support helps our applications engineers answer your questions more efficiently.
Documentation Comment Form National Instruments encourages you to comment on the documentation supplied with our products. This information helps us provide quality products to meet your needs. Title: LabVIEW™ Data Acquisition Basics Manual Edition Date: January 1998 Part Number: 320997C-01 Please comment on the completeness, clarity, and organization of the manual.
Glossary Prefix Meaning Value k- kilo- 103 M- mega- 106 m- milli- 10 –3 µ- micro- 10 –6 n- nano- 10 –9 Numbers/Symbols 1D One-dimensional. 2D Two-dimensional. A A Amperes. AC Alternating current. A/D Analog-to-digital. ADC Analog-to-digital converter. An electronic device, often an integrated circuit, that converts an analog voltage to a digital number. ADC resolution The resolution of the ADC, which is measured in bits.
Glossary amplification A type of signal conditioning that improves accuracy in the resulting digitized signal and to reduce noise. Am9513-based devices These MIO devices do not have an E- in their names. These devices include the NB-MIO-16, NB-MIO-16X, NB-A2000, NB-TIO-10, and NB-DMA2800 on the Macintosh; and the AT-MIO-16, AT-MIO-16F-5, AT-MIO-16X, AT-MIO-16D, and AT-MIO-64F-5 in Windows. AMUX devices See analog multiplexers. anlogin.
Glossary B BCD Binary-coded decimal. bipolar A signal range that includes both positive and negative values (for example, –5 to 5 V). buffer Temporary storage for acquired or generated data. C cascading Process of extending the counting range of a counter chip by connecting to the next higher counter. channel Pin or wire lead to which you apply or from which you read the analog or digital signal. Analog signals can be single-ended or differential.
Glossary conditional retrieval configuration utility A method of triggering in which you to simulate an analog trigger using software. Also called software triggering. Refers to NI-DAQ on the Macintosh, nicfg16.exe on Windows 3.1, and nidaqcfg.exe on Windows 95/NT. conversion device Device that transforms a signal from one form to another.
Glossary default setting A default parameter value recorded in the driver. In many cases, the default input of a control is a certain value (often 0) that means use the current default setting. For example, the default input for a parameter may be do not change current setting, and the default setting may be no AMUX-64T boards. If you do change the value of such a parameter, the new value becomes the new setting. You can set default settings for some parameters in the configuration utility.
Glossary dithering The addition of Gaussian noise to an analog input signal. By applying dithering and then averaging the input data, you can effectively increase the resolution by another one-half bit. DLL Dynamic Link Library. DMA Direct Memory Access. A method by which data you can transfer data to computer memory from a device or memory on the bus (or from computer memory to a device) while the processor does something else.
Glossary floating signal sources Signal sources with voltage signals that are not connected to an absolute reference or system ground. Some common example of floating signal sources are batteries, transformers, or thermocouples. Also called nonreferenced signal sources. G gain The amplification or attenuation of a signal. GATE input pin A counter input pin that controls when counting in your application occurs. grounded measurement system See referenced single-ended measurement system.
Glossary hex Hexadecimal. Hz Hertz. The number of scans read or updates written per second. I IEEE Institute of Electrical and Electronic Engineers. immediate digital I/O A type of digital acquisition/generation where LabVIEW updates the digital lines or port states immediately or returns the digital value of an input line. Also called nonlatched digital I/O. input limits The upper and lower voltage inputs for a channel. You must use a pair of numbers to express the input limits.
Glossary isolation A type of signal conditioning in which you isolate the transducer signals from the computer for safety purposes. This protects you and your computer from large voltage spikes and makes sure the measurements from the DAQ device are not affected by differences in ground potentials. K Kwords 1,024 words of memory. L Lab/1200 boards Boards, such as the Lab-PC-1200 and the DAQCard-1200, which use the 8253 type counter/timer chip.
Glossary multibuffered I/O Input operation for which you allocate more than one memory buffer so you can read and process data from one buffer while the acquisition fills another. multiplexed mode An SCXI operating mode in which analog input channels are multiplexed into one module output so that your cabled DAQ device has access to the module’s multiplexed output as well as the outputs on all other multiplexed modules in the chassis through the SCXI bus. Also called serial mode.
Glossary NRSE Nonreferenced single-ended. O onboard channels Channels provided by the plug-in data acquisition board. OUT output pin A counter output pin where the counter can generate various TTL pulse waveforms. output limits The upper and lower voltage or current outputs for an analog output channel. The output limits determine the polarity and voltage reference settings for a board.
Glossary R read mark Points to the scan at which a read operation begins. Analogous to a file I/O pointer, the read mark moves every time you read data from an input buffer. After the read is finished, the read mark points to the next unread scan. Because multiple buffers are possible, you need both the buffer number and the scan number to express the position of the read mark. read mode Indicates one of the four reference marks within an input buffer that provides the reference point for the read.
Glossary scan One or more analog or digital input samples. Typically, the number of input samples in a scan is equal to the number of channels n the input group. For example, one pulse from the scan clock produces one scan which acquires one new sample from every analog input channel in the group. scan clock The clock controlling the time interval between scans. On boards with interval scanning support (for example, the AT-MIO-16F-5), this clock gates the channel clock on and off.
Glossary single-ended inputs Analog inputs that you measure with respect to a common ground. software trigger A programmed event that triggers an event such as data acquisition. software triggering A method of triggering in which you to simulate an analog trigger using software. Also called conditional retrieval. SOURCE input pin An counter input pin where the counter counts the signal transitions. STC System Timing Controller.
Glossary TC Terminal count. The highest value of a counter. toggled output A form of counter signal generation by which the output changes the state of the output signal from high to low, or low to high when the counter reaches a certain value. top-level VI VI at the top of the VI hierarchy. This term is used to distinguish the VI from its subVIs. track-and-hold A circuit that tracks an analog voltage and holds the value on command.
Glossary W waveform Multiple voltage readings taken at a specific sampling rate. wire Data path between nodes. write mark Points to the update at which a write operation begins. Analogous to a file I/O pointer, the write mark moves every time you write data into an output buffer. After the write is finished, the write mark points to the next update to be written. Because multiple buffers are possible, you need both the buffer number and the update number to express the position of the write mark.
Index Numbers Acquire N Scans Analog Hardware Trig example VI, 8-7 to 8-8 Acquire N Scans Analog Software Trig example VI, 8-11 Acquire N Scans Digital Trig example VI, 8-4 to 8-5 Acquire N Scans example VI, 7-4, 7-6 Acquire N Scans-ExtChanClk example VI, 9-4, 9-6 acquisition rate. See external control.
Index one-point calibration, 22-6 SCXI temperature measurement, 21-8 simple-buffered analog input with multiple starts, 7-7 simultaneous buffered waveform acquisition and generation, 14-2 to 14-3 software triggering, 8-10 AI Sample Channel VI, 6-1 to 6-2 AI Sample Channels VI, 6-3 AI Single Scan VI basic non-buffered application, 6-4 hardware-timed analog I/O control loops, 6-8 to 6-9 improving control loop performance, 6-9 to 6-10 multiple-channel single-point analog input, 6-4 one-point calibration, 22-6
Index channel clock control, 9-3 to 9-5, 9-8 circular-buffered analog input examples, 7-12 to 7-14 continuous acquisition from multiple channels, 7-10 to 7-11 defining signals, 5-1 to 5-2 digital triggering, 8-2 to 8-5 external control of acquisition rate, 9-1 to 9-3 hardware triggering, 8-1 to 8-8 measurement systems, 5-4 to 5-6 multiple-channel single point analog input, 6-3 to 6-5 multiple waveform acquisition, 7-3 to 7-5 scan clock control, 9-6 to 9-7, 9-8 SCXI applications for measuring temperature (e
Index single-immediate updates, 11-1 to 11-2 single-point output choosing between single-point or multiple-point generation, 4-4 overview, 10-1 analog output SCXI modules application example, 21-16 to 21-17 multiplexed mode, 19-5 analog-to-digital converter (ADC). See ADC. analog triggering description, 8-5 to 8-6 diagram, 8-6 examples, 8-7 to 8-8 timeline for post-triggered data acquisition (figure), 8-6 anlogin DAQ example file, 3-2 anlog_io.llb DAQ example file, 3-2 anlogout.
Index buffered waveform acquisition, 7-1 to 7-14 circular-buffered analog input, 7-12 to 7-14 asynchronous continuous acquisition using DAQ occurrences, 7-11 to 7-12 continuous acquisition from multiple channels, 7-10 to 7-11 determining adequate buffer capacity, A-2 examples, 7-12 to 7-14 overview, 7-8 to 7-10 how buffers work, 7-2 simple-buffered analog input data buffer overview, 7-1 to 7-2 displaying waveforms on graphs (example), 7-5 to 7-6 multiple-waveform acquisition, 7-3 to 7-5 sampling with multi
Index circular-buffered analog input asynchronous continuous acquisition using DAQ occurrences, 7-11 to 7-12 continuous acquisition from multiple channels, 7-10 to 7-11 examples basic circular-buffered analog input, 7-13 Cont Acq to File (binary).vi, 7-14 Cont Acq to File (scaled).vi, 7-14 Cont Acq to Spreadsheet File.vi, 7-14 Cont Acq&Chart (buffered).vi, 7-14 Cont Acq&Graph (buffered).
Index Count Time (8253) VI, 27-11 Count Time-Easy (9513) VI, 27-9 Count Time-Easy (DAQ-STC) VI, 27-7 to 27-8 Count Time-Int (9513) VI, 27-10 Count Time-Int (DAQ-STC) VI, 27-8 counter addressing for VIs, 3-9 to 3-12 counter chips used in National Instruments devices, 23-3 to 23-5. See also 8253/54 counter; AM9513 counter; DAQ-STC counter.
Index pulse train generation, 24-9 to 24-20 continuous pulse train, 24-9 to 24-13 finite pulse train, 24-13 to 24-20 pulse width measurement, 25-1 to 25-9 controlling pulse width measurement, 25-6 to 25-7 determining pulse width, 25-2 to 25-6 increasing measurable width range, 25-8 to 25-9 square pulse generation, 24-1 to 24-4 single square pulse generation, 24-4 to 24-9 stopping counter generations, 24-23 timebase uncertainty, 24-22 CTR Buffer Config VI, 25-8 CTR Buffer Read VI, 25-8 CTR Control VI buffer
Index data acquisition. See also analog input; VIs. analog input/output control loops, 6-6 to 6-10 basic LabVIEW data acquisition concepts, 3-1 to 3-16 data organization for analog applications, 3-14 to 3-16 limit settings, 3-12 to 3-14 location of common DAQ examples, 3-1 to 3-2 buffered. See buffered waveform acquisition. common questions about LabVIEW data acquisition, A-1 to A-4 important terms, 5-17 multiple-channel single-point, 6-3 to 6-5 single-channel single-point, 6-1 to 6-2 triggered.
Index non-buffered handshaking, 17-5 to 17-6 overview, 15-1 to 15-2 SCXI application examples digital input, 21-17 to 21-18 digital output, 21-19 to 21-20 sending out multiple digital values, 17-3 to 17-5 Digital Mode Config VI, 17-8 digital ports and lines, 15-1 digital SCXI application examples digital input, 21-17 to 21-18 digital output, 21-19 to 21-20 digital SCXI modules multiplexed mode for digital and relay modules, 19-5 parallel mode, 19-6 digital triggering defined, 8-2 description, 8-2 to 8-3 di
Index multiple-immediate updates, 11-3 multiple-waveform acquisition, 7-3 overview, 3-4 to 3-5 single-channel single-point analog input, 6-1 single-immediate updates, 11-1 to 11-2 single square pulse generation, 24-5 single-waveform acquisition, 7-2 to 7-3 strain gauge application, 21-14 waveform generation, 12-1 to 12-2 edges of signals, 23-2 EEPROM, for storing calibration constants, 22-1 to 22-3 default load area, 22-2 factory area, 22-2 user area, 22-2 elapsed time counting.
Index Finite Pulse Train-Easy (9513) VI, 24-14 Finite Pulse Train-Easy (DAQ-STC) VI, 24-14 finite pulse train generation, 24-13 to 24-20 8253/54, 24-17 to 24-20 DAQ-STC, 24-16 to 24-17 DAQ-STC and Am9513, 24-14 to 24-15 physical connections (figure), 24-14 Finite Pulse Train-Int (9513) VI, 24-15 Finite Pulse Train-Int (DAQ-STC) VI, 24-15 floating signal sources, 5-3 FOUT pin, 13-3, 24-20 FREQ_OUT pin, 13-3, 24-20 frequency and period measurement, 26-1 to 26-10 connecting counters for measuring, 26-3 equati
Index G H gain, defined, 3-14 gains (SCXI) default gain, 20-3 description, 20-3 to 20-5 SCXI-1100 channel arrays, input limits array, and gains (table), 20-4 GATE input, for counters, 23-2 General Error Handler VI debugging VIs, 29-2 to 29-3 pulse width measurement, 25-6 Generate Continuous Sinewave VI, 12-3, 12-6 Generate Delayed Pulse VI single square pulse generation, 24-5 stopping counter generations, 24-23 Generate N Updates example VI, 12-2, 12-6 Generate N Updates-ExtUpdateClk VI, 13-1 to 13-2 Gen
Index I asynchronous continuous acquisition using DAQ occurrences, 7-11 to 7-12 circular-buffered output, 12-5 continuous acquisition from multiple channels, 7-10 to 7-11 continuous pulse train generation, 24-10 to 24-11 controlling pulse width measurement, 25-6 to 25-7 counting elapsed time 8253/54, 27-11 Am9513, 27-10 DAQ-STC, 27-8 counting events 8253/54, 27-6 to 27-7 Am9513, 27-5 to 27-6 DAQ-STC, 27-4 dividing frequencies, 28-2 to 28-3 finite pulse train generation, 24-15 measuring frequency and perio
Index L M Lab/1200 boards, simultaneous buffered waveform acquisition and generation, 14-7 LabVIEW software basic LabVIEW data acquisition concepts, 3-1 to 3-16. See also VIs.
Index nonlatched digital I/O, 16-1 to 16-3 channel names, 16-2 to 16-3 defined, 15-2 resetting digital lines to default values, 16-3 using Easy Digital VIs, 16-2 nonreferenced single-ended (NRSE) measurement system, 5-11 to 5-12 18-channel NRSE system (figure), 5-12 when to use, 5-12 Nyquist frequency, 5-2 Nyquist Theorem, 5-2 Microsoft Windows. See Windows environment. MIO boards. See E-series MIO boards; legacy MIO boards.
Index Pulse Width or Period Meas Config VI controlling pulse width measurement, 25-6 to 25-7 measuring low frequency signals, 26-10 pulsed counter signal generation, 24-1 ports digital ports and lines, 15-1 grouping ports without handshaking, A-2 VI port addressing, 3-9 to 3-12 writing to digital port while reading digital data, A-2 pressure measurement with strain gauges (example), 21-13 to 21-16 Probe tool, 29-4 pulse generation, square. See square pulse generation.
Index SCXI-1122 Voltage example, 21-9 SCXI 1124 Update Channels VI, 21-16 to 21-17 SCXI-1162/1162HV Digital Input VI, 21-18 SCXI-1200 module multiplexed mode (Windows), 19-4 to 19-5 parallel mode (Windows), 19-6 SCXI application examples, 21-1 to 21-21 analog input application for measuring temperature, 21-2 to 21-13 analog output application, 21-16 to 21-17 DAQ example files, 3-2 digital input application, 21-17 to 21-18 digital output application, 21-19 to 21-20 multi-chassis applications, 21-20 to 21-21
Index SCXI programming considerations, 20-1 to 20-5 channel addressing, 20-1 to 20-2 gains, 20-3 to 20-5 SCXI-1100 channel arrays, input limits array, and gains (table), 20-4 settling time, 20-5 SCXI Temperature Monitor VI, 21-9 settling time (SCXI), 20-5 Show Help option, 3-2 Show VI Info option, 3-2 signal conditioning amplification, 18-3 to 18-4 common transducers (table), 18-1 to 18-2 common types of signal conditioning, 18-2 conditioning for common types of transducers/signals (figure), 18-3 defined,
Index software triggering conditional retrieval examples, 8-11 description, 8-8 to 8-11 timeline of conditional retrieval (figure), 8-9 solution DAQ example files, 3-2 SOURCE input, for counters, 23-2 spreadsheet files Cont Acq to Spreadsheet File.
Index U terminal count (TC), 23-2 thermocouples for measuring temperature (example), 21-2 to 21-3 timebase period uncertainty, 24-22 toggled counter signal generation, 24-1 transducers common transducers (table), 18-1 to 18-2 excitation, 18-5 linearization, 18-5 signal conditioning for common types of transducers/signals (figure), 18-3 Transpose 2D Array option (note), 3-15 transposing arrays, 3-15, 3-16, 7-6 triggered data acquisition, 8-1 to 8-11 analog hardware triggering description, 8-5 to 8-6 exampl
Index Wait Until Next ms Multiple VI improving control loop performance, 6-10 multiple-channel single-point analog input, 6-5 software-timed analog I/O control loops, 6-6 waveform acquisition. See buffered waveform acquisition. waveform acquisition and generation, simultaneous. See buffered waveform acquisition and generation, simultaneous. waveform generation. See buffered waveform generation.