I'm currently using a NI USB-6000 to acquire an analog signal in form of a triangle wave. Now I want to know if there is a possibility to trigger an event in my VI using the extremes of the signal. I'm thinking of a while loop that waits, until a maximum or minimum is reached.
I know that there are DAQmx functions to trigger the data acquisition but I don't know if I could use them to trigger something else.
I would be very thankful for some advises!
Wiring the DAQmx Task into a 'Register for Events' node (such as is used to create the dynamic events for an Event Structure) allows you to trigger events on certain criteria. However, I'm not sure that you'll be able to do with with a USB-6000. A link describing the idea is here: http://www.ni.com/tutorial/4102/en/
For the analog signal you're describing, you might be able to use an Analog Edge to trigger your acquisition, and just acquire a small number (perhaps 1?) of points, and use the DAQmx Event with 'Sample Complete' to trigger an event structure when the acquisition completes, but I'm not sure how easy it would be to retrigger, and how you'd go about having two edges (or distinguishing them). If you could use two analog inputs, both of those problems would disappear (but you lose an input).
With using two analog inputs you mean that with the first input I trigger on the maximum and with the second on the minimum? And for retriggering I have to stop the task and set it up again every time? This sounds not very efficient to me... I also have the possibility to create an TTL signal from the triangle wave and could use this as a digital trigger, would this be any better to trigger, repeatable?
One more note... I don't have to trigger an event on every max and min. The VI waits for "command" --> trigger event on next max --> trigger another event on following min --> VI waits again for "command" -->...
With two inputs, yes, that's what I meant. I agree, not the nicest solution! Regarding retriggering, I'm not certain - it might be that just using 'Start' in the event case (or immediately preceeding/following the sending of your command) would be sufficient to reset it (I don't know).
If you have a TTL signal, you'd have a much easier time. In that case, you should see if your hardware can use the 'Change Detection' event on the DAQmx Event, wiring a Digital Input (rather than Analog Input, as shown in my first reply) and changing the enum constant to 'Change Detection'. This should presumably run every change, and so no extra code would be needed as far as I know to get it to repeat as you want (unless you have far too many max/min cycles, in which case you'd need to work out if you should ignore them!)
with your cheap USB6000 you can use the PFI inputs to count pulses and as start trigger - nothing less, nothing more.
Maybe you should buy hardware suitable to your requirements?