Global TMW:
Login  |  Register          Free Newsletter Subscription
Subscribe
Email
Print
Reprint
Learn RSS

Choose the Right Trigger and Get the Right Data

You'll get more useful data if you first determine which combination of hardware and software triggers are appropriate for your application.

Chad Chesney and Josh Martin, National Instruments, Austin, TX -- Test & Measurement World, 2/1/1999

When you take measurements with a data-acquisition system, you often must program the system to get the right amount of data at the right time. The way you initiate, or trigger, the acquisition makes a significant difference in the quality of the data you collect. By learning about your options, you’ll know which combination of hardware and software triggers to use and whether the triggers should be analog or digital.

Different events require different triggers. When you measure a battery’s discharge rate, for example, you may not need a precise acquisition start time; a software trigger may be all you need. Software triggers are easy to develop. You program the system to start an acquisition when a software event occurs, such as when a program starts or when you click on a button on a user screen. Listing 1 contains some code for a software trigger. Once you start the program, the system acquires 1000 samples at 1 ksample/s.

Listing 1

/* set a timeout limit so that if there is something wrong, */
/* the program won’t hang on the DAQ_Op call. */
iStatus = Timeout_Config(iDevice, lTimeout);
iRetVal = NIDAQErrorHandler(iStatus, “Timeout_Config”,
    iIgnoreWarning);

/* Acquire data from a single channel. */
iStatus = DAQ_Op(iDevice, iChan, iGain, piBuffer, ulCount,              dSampRate);
iRetVal = NIDAQErrorHandler(iStatus, “DAQ_Op”, iIgnoreWarning);
Complete code examples are available at www.tmworld.com/sftw_files/sftw_files.htm

Many data-acquisition applications require software triggers only. Applications that employ triggers beyond basic software triggering usually do so to reference the acquisition to an external event or time. For example, when you measure vibration in a crash test, you may need to capture data for the 10 ms that immediately follow the impact. The acquisition must trigger at a specific time, based on an analog voltage proportional to vibration. Here, you need an analog hardware trigger.

Trigger on a Level
Analog triggers let you trigger an acquisition when a signal reaches a specified level. In an analog trigger, the signal itself determines whether or not you acquire it. There are two ways in which to implement analog triggers: in software or in hardware. Software analog triggering basically involves continuously acquiring data to a buffer and processing that buffer to see if the signal has met the desired criteria. When the signal meets the criteria, the program returns data to the user.

A hardware analog trigger requires a separate circuit that digitizes the analog signal on which you base the trigger decision. When the signal of interest meets the specified level and slope conditions, the trigger circuit initiates the acquisition. In the case of the car crash, you might use a hardware analog trigger because acquisition need not begin until impact occurs.

If you set the trigger level properly, you won’t get a false trigger caused by minor changes in the trigger signal. And you get only the time span you need. The code in Listing 2 illustrates how to acquire 1000 samples at 10 ksamples/s when the input signal increases through 3.0 V.

Listing 2

/* set up for hardware analog trigger. Notes specific to this example:
* ND_ON activates hardware analog triggering, lLow_Value is unused,
* lHighValue sets the trigger level, ND_ABOVE_HIGH_LEVEL specifies that
* the acquisition begins when the input voltage increases through
* lHighValue, and ND_THE_AI_CHANNEL indicates that the trigger channel is
* the channel being acquired */

iStatus = Configure_HW_Analog_Trigger(iDevice, ND_ON, lLowValue,
lHighValue, ND_ABOVE_HIGH_LEVEL, ND_THE_AI_CHANNEL);
iRetVal = NIDAQErrorHandler(iStatus, “Configure_HW_Analog_Trigger”,
iIgnoreWarning);

/* set up the board’s timing circuitry so that when the analog triggering
* circuitry matches the ND_ABOVE_HIGH_LEVEL condition above, it produces
* a transition on the TTL line (PFI0) that initiates the acquisition */
iStatus = Select_Signal(iDevice, ND_IN_START_TRIGGER, ND_PFI_0,
ND_LOW_TO_HIGH);
iRetVal = NIDAQErrorHandler(iStatus, “Select_Signal”, iIgnoreWarning);

Complete code examples are available at www.tmworld.com/sftw_files/sftw_files.htm

With a digital trigger, your system begins an acquisition on the transition of a digital signal. You can trigger the acquisition on either a rising edge or falling edge. If your equipment monitors the vibration or power consumption of an electric motor, then you may need a digital trigger. If a digital signal starts or stops the motor, you can use that signal to trigger your data-acquisition system.

Pre or Post-Trigger?
When an external event must trigger an acquisition, you must decide if you need a post-trigger or a pretrigger. In a post-triggered acquisition, such as the crash test, the trigger occurs and then the system collects all the data you want.

A pretriggered acquisition, initiated by a “stop trigger,” collects data before and after the trigger event occurs. If you want to perform a pretriggered acquisition, you can set up your system to begin digitizing on a software trigger, collect data, and place the data into a memory buffer. When the stop trigger occurs, the ADC continues to collect a predetermined number of samples. When you use a pretrigger you must preset the number of pretrigger and post-trigger samples the system will acquire.

You can set up a digital post-triggered acquisition; the system acquires data only after the trigger signal occurs and the motor starts. Alternatively, you can use a pretriggered acquisition if you need the data around the time of an event, such as a motor shutdown. The system starts acquiring data based on a software command while the motor runs, and the power-off signal becomes the stop trigger. You can program the system to acquire a specific number of points before and after that trigger. T&MW

Chad Chesney is the data acquisition product marketing manager and Josh Martin is an applications engineer at National Instruments.

Email
Print
Reprint
Learn RSS

Talkback

We would love your feedback!

Post a comment

» VIEW ALL TALKBACK THREADS

Related Content

Related Content

 

By This Author

There are no other articles written by this author.

Sponsored Links



 
Advertisement
SPONSORED LINKS

More Content

  • Blogs
  • Podcasts

Blogs

  • Rick Nelson
    Taking the Measure

    July 1, 2008
    S-parameters are so yesterday
    Textbook amplifiers operate in linear mode and are easy to analyze. Unfortunately, it’s often ...
    More
  • Martin Rowe
    Rowe's and Columns

    May 28, 2008
    More on Bill and Dave
    In my January 11 posting, "Tell your Bill and Dave Stories," I asked if the HP Way still e...
    More
  • » VIEW ALL BLOGS RSS

Podcasts

Advertisements





NEWSLETTERS
Click on a title below to learn more.

Test Industry News (3 Times Per Month)
Machine-Vision & Inspection (Monthly)
Communications Test (Monthly)
Design, Test & Yield (Monthly)
Automotive, Aerospace & Defense (Monthly)
Instrumentation (Monthly)
Resource Center E-Alert (Monthly)
©2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites