Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Sep 6, 2006

Performing Single-Shot Waveform Acquisition with Multiple Analog Software Triggers

4 ratings | 3.50 out of 5
Print

Downloads

Filename: 201064.zip
Requirements: View

This VI retrieves the specified amount of data from one or more analog input channels each time an analog trigger occurs. It shows how to start a triggered acquisition multiple times while avoiding the overhead of configuration and buffer allocation each time. This is a timed acquisition, meaning that a hardware clock is used to control the acquisition rate for fast and accurate timing. It is also a buffered acquisition, meaning that the data are stored in an intermediate memory buffer after they are acquired from the DAQ board. Since this VI uses a software analog trigger, data are continuously acquired with LabVIEW checking the intermediate buffer for the analog trigger specifications to be met. Once met, this VI retrieves and displays data from that buffer after the appropriate amount of data (before and after the trigger) have been acquired. The vertical cursor on the graph indicates where the trigger occurred. With each iteration of the while loop, the VI waits for the next trigger, then reads the same amount of data again from the same channels at the same rate.

Use this VI to wait for multiple analog triggers, acquiring a relatively small amount of data for each trigger (it must fit in the memory available), where each point does not need to be viewed or processed while it is being acquired

INSTRUCTIONS:
1. Enter the device number, channels, trigger channel, number of scans to acquire, and the scan rate.
2. Enter the pretrigger scans, trigger slope, trigger level, and time limit.
3. Make the appropriate I/O connections as explained below.
4. Run the VI.

KEY PARAMETERS:
This VI shows how to use the intermediate analog input DAQ VIs to software trigger multiple acquisitions. On the diagram, notice that the AI Start.vi has a 0 wired for the number of scans to acquire. This sets up continuous acquisition, but LabVIEW only reads a specific amount of data. AI Config.vi is only called on the first iteration of the while loop. This avoids the overhead of configuration and buffer allocation for each acquisition. However, you must stop and restart the VI if you wish to change input parameters to AI Config.vi. Calculate Buffer Size.vi is used to allocate a buffer which is the largest of the following: 1000 scans, 400 msec worth of scans, or 2.5 times the "number of scans to acquire". This tries to provide enough cushion for the driver to keep up in searching for the trigger condition while data are acquired. It is still possible for the VI to overflow the buffer or time-out if the triggers are very infrequent and the acquisition speed is high.

NOTE: If you are using a device that has limitations on buffer size (e.g.: Lab and 1200 devices), please pay attention to the actual buffer size used and the number of channels. If the buffer size (in samples, not scans) exceeds the limit, you will get an error.
Set up Conditional Retrieval.vi provides trigger parameters, the trigger channel index, and turns on conditional retrieval in AI Read.vi.
The "read/search mode" for AI Read.vi is set to "relative to end of data". This assures that LabVIEW checks the most recently acquired data (end of data) for the software trigger.

AI Control.vi (an advanced analog input VI) is called, in the event that AI Read.vi times out, to momentarily stop the analog input clock. This is needed so the input clock is not running when AI Start.vi (which restarts the clock) is called again.

I/O CONNECTIONS:
Connect to the input channels on the I/O connector for your board to match the channels you have chosen on the front panel of this VI. For example ACH0 for analog input.

To find the actual pin numbers, refer to your hardware user manual.

DAQ VIs USED:
AI Config.vi, AI Start.vi, AI Read.vi, AI Control.vi, AI Clear.vi.

Requirements


Filename: 201064.zip

Software Requirements


Application Software: LabVIEW Full Development System 5.0.1
Language(s): LabVIEW

Hardware Requirements


Hardware Group: Multifunction DAQ (MIO)
Driver: Traditional NI-DAQ (Legacy) 6.7.0

 
4 ratings | 3.50 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).