Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficiently change from continuous sample mode to finite sampling mode

Solved!
Go to solution

9188 chassis, various modules (all AI), Labview 9

 

I want to continuously acquire (and display) data at a fast update rate, then when an 'arm trigger' state is detected, switch to a finite, hardware triggered task with pretrigger samples with minimal loss of perceived update rate.

 

What is the best way to do this

 

Thanks

 

Collin

0 Kudos
Message 1 of 4
(3,487 Views)

Hi Collin,

 

The best way to do this would be to use a reference trigger for the pretrigger samples. You configure the total samples you want and the number of which must be before the reference trigger. Here's an example that does this with finite acquisition. https://decibel.ni.com/content/docs/DOC-11663. Be aware of an issue that a lot of people run into when using reference triggers; they do not give enough time to gather the number of pretrigger samples required before sending the trigger, meaning that DAQmx essentially ignores it. More on that here: http://digital.ni.com/public.nsf/allkb/8F176718EB09EC71862578230004E812?OpenDocument

 

Concerning the switch between the two types of acquisition, that may be accomplished using what's called a state machine. This is a type of application architecture that allows a new level of complexity to be added. What the code executes now is not dependent just on what happened before, but also on the state of the machine. More on that here:

 

http://www.ni.com/white-paper/3024/en

 

Use the shift registers within the state machine to indicate what state you are in. The two states are waiting on reference trigger, and finite acquisition after reference trigger. Please read the above information and let me know what further questions you have.

 

Regards,
Basil
Applications Engineering
National Instruments
Message 2 of 4
(3,462 Views)
Solution
Accepted by CollinVIMF

I started my reply long ago while waiting on a reboot and am just finally getting back to it.  I see you've gotten another another reply in the meantime.  Regarding reference triggering, here's another link that might help you out some: Cont. Acq w/ Ref Trig

 

I actually haven't fiddled around with Reference Triggering much, so am unsure what is meant in the link above about the task being "ultimately" a finite acquisition.  Perhaps the task stops filling the buffer just before it's about to overwrite the first pretrigger sample?

 

Anyway, my original thought on the whole thing was on a different track.  If the Ref triggering works for you, that'll be more straightforward.   But if Ref triggering causes the acquisition to stop *and* you really need to keep it going continuously, then consider the stuff below:  

 

-------------------------------------------------------------------------------------------

 

Switching from continuous to finite sampling will require stopping and reprogramming your task, and you'll have a "blind spot" of lost data while that's happening.

 

An approach I'd be thinking about is to stick with all continuous AI sampling, but also set up a counter task that can count the AI sample clocks and capture them on the trigger signal.  The count value captured will represent the AI sample # when the trigger occurred, and you then easily post-process your AI data to find the subset that represents your desired pre- and post-trigger data.

 

Below is a 2012 snippet of what I mean:

 

-Kevin P

 

 

 

mark trigger point with counter in continuous AI.png

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 3 of 4
(3,455 Views)

Thanks Basil and Kevin,

 

Kevin's approach is more what I'm after, what's left is figuring out an efficient way to insure the desired number of pre and post samples are retained.

 

Collin

0 Kudos
Message 4 of 4
(3,438 Views)