LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start Trigger and Stop After Desired Number of Pulses on Trigger

I want to acquire data between a Digital Start and Digital Stop Trigger (both on same line & Stop Trigger occues after 10 pulses of Start Trigger). I found solution at the website at  "NI-DAQmx: Continuous Analog Input - Start Trigger and Stop After Desired Number of Pulses" at link http://zone.ni.com/devzone/cda/epd/p/id/5028

 

But I am little confused in the working of the example given for the above subject. When we will start acquiring data we do not know the number of samples which will occur between Start and Stop Trigger (infact these will change each time) but we have to set the number of samples to finite and give a fixed number of samples before running the VI. Similarly we give fixed number of samples in pretrigger samples of "Reference Digital Edge ". So please anyone explain that how this example exactly works and give waveform exactly between the two triggers)?

 

 

0 Kudos
Message 1 of 3
(3,517 Views)
Any replies please. 🙂
0 Kudos
Message 2 of 3
(3,487 Views)

I Got Solution from other post in Multifunctional DAQ Forum which is as follows :-

 

Attached is a VI that should do what you're asking for. I'll try to explain what the program is doing since it requires you to override a lot of the default behaviors in the driver. Also, the DAQ device you are using doesn't support a true "stop" trigger so I'm using a reference trigger to get as close to the desired functionality as possible.

First, the program configures a finite acquisition that uses both a start trigger and a reference trigger. The acquisition is using the onboard sample clock and will acquire 4 samples (2 pre-trigger samples and 2 post-trigger samples). Four may seem like an odd number here, but it allows us to emulate the functionality of a stop trigger as close as possible. Given this configuration, you must acquire at least 2 samples before the "stop" trigger is recognized, and you must acquire 2 more samples after the "stop" trigger is recognized. Hopefully this restriction is acceptable. You can always discard the last two data points after the stop trigger if they're not of interest, but you're stuck always acquiring at least two points between when the start and stop triggers are recognized.

The program also overrides the default buffer size and read position. By default, the DAQmx driver will pick a buffer size exactly big enough to fit the pre-trigger and post-trigger data (4 samples in this case) and will begin reading data from the start of the pre-trigger data. Explicitly allocating a larger buffer will allow your acquisition to execute without receiving buffer overflow errors, and changing the default read position will allow you to read all of the data between the start and stop triggers as it is acquired and not just the pre-trigger and post-trigger data.

Finally, the while loop takes care of reading the data. In this case, the loop continues to read data until the task is done and there are no longer samples available for reading from the buffer. The number of samples read per iteration is the lesser of the user specified amount or the number of samples available for reading from the buffer.

I hope this helps. Good luck.

 

BY-

 

reddog
Proven Veteran
0 Kudos
Message 3 of 3
(3,476 Views)