LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring pre-trigger recorded data

Solved!
Go to solution

Hello , 

How to record pre trigger analogue data. such that I need to put trigger (1.5 volt) for 5 second. and record data (1 second) before trigger.

0 Kudos
Message 1 of 2
(617 Views)
Solution
Accepted by topic author Mazin_Allami

I've never tried to do this, but I believe that certain NI DAQ devices have a "pre-triggering" option where you specify how many samples you want to be acquired before the AI Start Trigger occurs.  What I think is happening is that the DAQ device's "internal buffer" is being used as a "ring buffer" where the pre-trigger data just gets saved over and over until the Trigger occurs, then (say) the "1000 points" of the requested buffer is marked as "starting 300 points before the next buffer position and going to the next 700 points".  The advantage of this, of course, is that the pre-sample data is automatically saved for you.

 

The other way, of course, is to "roll your own" buffering (which you may need to do if your DAQ device doesn't support "pre-triggering").  Start sampling, say continuous sampling, 1000 points at 1 kHz, using a Producer/Consumer pattern.  In the Consumer, ask "Did the Start Trigger occur?".  You need two buffer's worth, but when you see the Trigger, you will have enough "pre-trigger" points to start (again, another Producer/Consumer, this time as the Producer) building a buffer with the Pre-trigger samples and enough Post-trigger points to make a full buffer, which you send to the "Save to Disk" Consumer.  You keep doing this until the final Consumer has saved enough points to disk.  Harder to describe in words than it is to simply start coding it (I would do this with pair of Stream Channel Wires, but Queues will also work -- the key is Producer -> intermediate Consumer/Producer (looking for Start Trigger) -> Consumer (to disk).

 

Bob Schor

Message 2 of 2
(574 Views)