02-27-2008 02:36 PM
02-27-2008 06:03 PM
02-28-2008 09:41 AM
02-28-2008
12:50 PM
- last edited on
01-05-2026
09:39 AM
by
Content Cleaner
Hey Hanwei,
There may be different ways to accomplish this depending on your application. What DAQ device are you using? Are you doing a continuous are finite acquisition? Is your trigger a hardware or software trigger?
Falkpl's suggestion applies when you are using a hardware trigger. You can setup your application to read a certain amount of samples before and after the trigger, or pre-trigger and post-trigger samples. Please have a look at the KB below for some more details on this.
How Do I Use a Digital Trigger in LabVIEW to Start and Stop Acquiring Data?
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019MiHSAU&l=en-US
02-28-2008 03:17 PM
02-29-2008 10:07 AM
02-29-2008 10:17 AM
In your DAQ, do you have a reference parameter?
In the PCI 5122 I have a reference parameter. associated with the horizontal parameter. I set mine at 10.0. this will output 10% of the data before the trigger point.
02-29-2008
01:46 PM
- last edited on
01-05-2026
09:40 AM
by
Content Cleaner
Hi hanwei,
It sounds like you want to acquire an analog signal and once that signal reaches a certain voltage level you want the last 2 seconds of data and the next 5 seconds. This can be done using analog edge reference triggering, where your trigger source is the same as the signal you are acquiring. Assuming this is what you are trying to do I’ve included an example VI that does this. The Samples per Channel is the total number of samples that will be acquired both before and after the trigger. The Pre-Trigger Samples is the number of samples acquired before the trigger. So for example if you want 2 seconds before the trigger and 5 seconds after at a sampling rate of 1 kHz, you would set the Samples per Channel to 7000 and the Pre-Trigger Samples to 2000. The Level and Edge Trigger Parameters set when the trigger will occur. If Edge is set to Rising the trigger will occur when your analog signal is rising and reaches the voltage set by Level.
If you would like to use a software trigger there is a great example of this included with LabVIEW. The NI Example Finder can be found under Help » Find Examples… From there this specific example can be found under Hardware Input and Output » DAQmx » Analog Measurements » Voltage » Cont Acq&Graph Voltage-Analog SW Trigger.vi.