LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract a array before the trigger time

Hi all:
 
Now I meet a problem about array extraction.
 
In my DAQ test program, the test data are saved to a 1D array.  Then I set a trigger here, and when the value of data is surpass a reference value, a timer is triggered.
Now the question is:
 
  If I want to show the data which are collected at 2 sec before the trigger time, what should I implement it? How can I extract it from that 1D array based on the time.
 
 
Thanks a lot
 
Best regards
0 Kudos
Message 1 of 8
(2,818 Views)
consider pre-triggering DAQ if it is supported.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 8
(2,809 Views)
thanks for your replying, but what is pre-triggering DAQ, actually, my problem is how to extract the data array based on the time around the triggering time and  I suppose the DAQ sampling is normal.
0 Kudos
Message 3 of 8
(2,797 Views)
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?
http://digital.ni.com/public.nsf/allkb/BA775B0E445BFA79482571FE0032CCEB?OpenDocument
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 4 of 8
(2,784 Views)
Hi Chris:
 
Thanks for your help
 
The DAQ card I am using is PCI-6040E, besides, i also used SCXI-1001chasis, SCXI-1102 AI module, and SCXI-1130 terminal block. Can I implement the trigger based on these hardware?
 
The data sampling mode in my project is continuous mode, In each period, when the value of data is surpass the reference, the data which collected before 2 second and 5 second after should be sampled. Can I set the pre- and post  time  in  DAQ trigger ? 
 
PS: Do you have any good idea to implemented software trigger in program?
 
Thanks a lot, I really appreciate your help
0 Kudos
Message 5 of 8
(2,772 Views)
one more question is:
 
When I use the DAQmx trigger, must I need a source?  this source is a analog signal generated by hardware?
 
May I creat a reference in software, and compare the collection data with it?
 
Best regards
 
 
0 Kudos
Message 6 of 8
(2,753 Views)

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.

0 Kudos
Message 7 of 8
(2,749 Views)

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.

            Also the Developer Zone article, Tips and Techniques in Data Acquisition Triggering - NI-DAQmx, is a great overview of the different types of triggering available. Let me know if you have any questions and have a great weekend.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 8 of 8
(2,735 Views)